Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT-1.28: Fixed script with added deviations #3567

Merged
merged 20 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6101863
RT-1.28: Fixed script with additional deviations
snaragund Nov 7, 2024
16404a0
-Removed comment
snaragund Nov 7, 2024
1b139d5
-Adding changes to deviations.go, metadata.proto & metadata.pb.go for…
snaragund Nov 7, 2024
40cd4b0
Merge branch 'main' into SND-RT1dot28
snaragund Nov 8, 2024
4eb101b
Merge remote-tracking branch 'upstream/main' into SND-RT1dot28
snaragund Nov 14, 2024
9324ca4
Merge branch 'SND-RT1dot28' of https://github.com/nokia/featureprofil…
snaragund Nov 14, 2024
f41b14a
-Resolving conflicts
snaragund Nov 27, 2024
74348f7
Revert "-Resolving conflicts"
trathod1 Dec 3, 2024
d2491bc
Merge remote-tracking branch 'upstream/main' into SND-RT1dot28
snaragund Dec 3, 2024
7c0aed4
-Defined & calling `ConfigEnableTbNative` function from fptest.
snaragund Dec 4, 2024
4f3d286
-updated deviation comment
snaragund Dec 4, 2024
c8b2489
Merge branch 'main' into SND-RT1dot28
trathod1 Dec 11, 2024
f919777
Merge remote-tracking branch 'upstream/main' into SND-RT1dot28
snaragund Dec 12, 2024
09e873c
Fixed tableconnection with comment
snaragund Dec 12, 2024
61b5226
Merge branch 'SND-RT1dot28' of https://github.com/nokia/featureprofil…
snaragund Dec 12, 2024
6c4ed58
Merge branch 'main' into SND-RT1dot28
snaragund Dec 14, 2024
4bf4455
Merge remote-tracking branch 'upstream/main' into SND-RT1dot28
snaragund Dec 20, 2024
3b43b91
Merge branch 'SND-RT1dot28' of https://github.com/nokia/featureprofil…
snaragund Dec 20, 2024
3fc5125
-Resolved conflicts
snaragund Dec 23, 2024
cf9a628
-Removing extra space in deviations.go
snaragund Dec 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ func nonMatchingPrefixRoutePolicy(t *testing.T, dut *ondatra.DUTDevice) {
}

prefixSet := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(v4PrefixSet)
prefixSet.SetMode(oc.PrefixSet_Mode_IPV4)
if !deviations.SkipPrefixSetMode(dut) {
prefixSet.SetMode(oc.PrefixSet_Mode_IPV4)
}
prefixSet.GetOrCreatePrefix(nonAdvertisedIPv4.cidr(t), maskLenExact)

if !deviations.SkipSetRpMatchSetOptions(dut) {
Expand All @@ -330,7 +332,7 @@ func matchingPrefixRoutePolicy(t *testing.T, dut *ondatra.DUTDevice) {
rp := root.GetOrCreateRoutingPolicy()
prefixSet := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(v4PrefixSet)
prefixSet.GetOrCreatePrefix(advertisedIPv4.cidr(t), maskLenExact)
gnmi.Update(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().PrefixSet(v4PrefixSet).Config(), prefixSet)
gnmi.Replace(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().PrefixSet(v4PrefixSet).Config(), prefixSet)
}

func nonMatchingCommunityRoutePolicy(t *testing.T, dut *ondatra.DUTDevice) {
Expand All @@ -355,12 +357,14 @@ func nonMatchingCommunityRoutePolicy(t *testing.T, dut *ondatra.DUTDevice) {

communitySet := rp.GetOrCreateDefinedSets().GetOrCreateBgpDefinedSets().GetOrCreateCommunitySet(v4CommunitySet)
communitySet.SetCommunityMember([]oc.RoutingPolicy_DefinedSets_BgpDefinedSets_CommunitySet_CommunityMember_Union{oc.UnionString(fmt.Sprintf("%d:%d", dummyAS, 200))})
communitySet.SetMatchSetOptions(oc.BgpPolicy_MatchSetOptionsType_ANY)

if deviations.BGPConditionsMatchCommunitySetUnsupported(dut) {
communitySet.SetMatchSetOptions(oc.BgpPolicy_MatchSetOptionsType_ANY)
stmt.GetOrCreateConditions().GetOrCreateBgpConditions().SetCommunitySet(v4CommunitySet)
} else {
stmt.GetOrCreateConditions().GetOrCreateBgpConditions().GetOrCreateMatchCommunitySet().SetCommunitySet(v4CommunitySet)
ref1 := stmt.GetOrCreateConditions().GetOrCreateBgpConditions().GetOrCreateMatchCommunitySet()
ref1.SetCommunitySet(v4CommunitySet)
ref1.SetMatchSetOptions(oc.RoutingPolicy_MatchSetOptionsType_ANY)
}
// Configure ALLOWAll policy
pdef = rp.GetOrCreatePolicyDefinition(allowAllPolicy)
Expand All @@ -383,7 +387,7 @@ func matchingCommunityRoutePolicy(t *testing.T, dut *ondatra.DUTDevice) {
rp := root.GetOrCreateRoutingPolicy()
communitySet := rp.GetOrCreateDefinedSets().GetOrCreateBgpDefinedSets().GetOrCreateCommunitySet(v4CommunitySet)
communitySet.SetCommunityMember([]oc.RoutingPolicy_DefinedSets_BgpDefinedSets_CommunitySet_CommunityMember_Union{oc.UnionString(fmt.Sprintf("%d:%d", ateAS, 100))})
gnmi.Update(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().BgpDefinedSets().CommunitySet(v4CommunitySet).Config(), communitySet)
gnmi.Replace(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().BgpDefinedSets().CommunitySet(v4CommunitySet).Config(), communitySet)
}
}

Expand All @@ -410,8 +414,10 @@ func verifyNonMatchingPrefixTelemetry(t *testing.T, dut *ondatra.DUTDevice, ate
if pName := prefixSet.GetName(); pName != v4PrefixSet {
t.Errorf("Prefix set name: %s, want: %s", pName, v4PrefixSet)
}
if pMode := prefixSet.GetMode(); pMode != oc.PrefixSet_Mode_IPV4 {
t.Errorf("Prefix set mode: %s, want: %s", pMode, oc.PrefixSet_Mode_IPV4)
if !deviations.SkipPrefixSetMode(dut) {
if pMode := prefixSet.GetMode(); pMode != oc.PrefixSet_Mode_IPV4 {
t.Errorf("Prefix set mode: %s, want: %s", pMode, oc.PrefixSet_Mode_IPV4)
}
}
if prefix := prefixSet.GetPrefix(nonAdvertisedIPv4.cidr(t), maskLenExact); prefix == nil {
t.Errorf("Prefix is nil, want: %s", nonAdvertisedIPv4.cidr(t))
Expand Down Expand Up @@ -525,7 +531,9 @@ func nonMatchingPrefixRoutePolicyV6(t *testing.T, dut *ondatra.DUTDevice) {
}

prefixSet := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(v6PrefixSet)
prefixSet.SetMode(oc.PrefixSet_Mode_IPV6)
if !deviations.SkipPrefixSetMode(dut) {
prefixSet.SetMode(oc.PrefixSet_Mode_IPV6)
}
prefixSet.GetOrCreatePrefix(nonAdvertisedIPv6.cidr(t), maskLenExact)

if !deviations.SkipSetRpMatchSetOptions(dut) {
Expand All @@ -540,7 +548,7 @@ func matchingPrefixRoutePolicyV6(t *testing.T, dut *ondatra.DUTDevice) {
rp := root.GetOrCreateRoutingPolicy()
prefixSet := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(v6PrefixSet)
prefixSet.GetOrCreatePrefix(advertisedIPv6.cidr(t), maskLenExact)
gnmi.Update(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().PrefixSet(v6PrefixSet).Config(), prefixSet)
gnmi.Replace(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().PrefixSet(v6PrefixSet).Config(), prefixSet)
}

func nonMatchingCommunityRoutePolicyV6(t *testing.T, dut *ondatra.DUTDevice) {
Expand All @@ -565,12 +573,14 @@ func nonMatchingCommunityRoutePolicyV6(t *testing.T, dut *ondatra.DUTDevice) {

communitySet := rp.GetOrCreateDefinedSets().GetOrCreateBgpDefinedSets().GetOrCreateCommunitySet(v6CommunitySet)
communitySet.SetCommunityMember([]oc.RoutingPolicy_DefinedSets_BgpDefinedSets_CommunitySet_CommunityMember_Union{oc.UnionString(fmt.Sprintf("%d:%d", dummyAS, 200))})
communitySet.SetMatchSetOptions(oc.BgpPolicy_MatchSetOptionsType_ANY)

if deviations.BGPConditionsMatchCommunitySetUnsupported(dut) {
stmt.GetOrCreateConditions().GetOrCreateBgpConditions().SetCommunitySet(v6CommunitySet)
communitySet.SetMatchSetOptions(oc.BgpPolicy_MatchSetOptionsType_ANY)
} else {
stmt.GetOrCreateConditions().GetOrCreateBgpConditions().GetOrCreateMatchCommunitySet().SetCommunitySet(v6CommunitySet)
ref1 := stmt.GetOrCreateConditions().GetOrCreateBgpConditions().GetOrCreateMatchCommunitySet()
ref1.SetCommunitySet(v6CommunitySet)
ref1.SetMatchSetOptions(oc.RoutingPolicy_MatchSetOptionsType_ANY)
}
// Configure ALLOWAll policy
pdef = rp.GetOrCreatePolicyDefinition(allowAllPolicy)
Expand All @@ -592,7 +602,7 @@ func matchingCommunityRoutePolicyV6(t *testing.T, dut *ondatra.DUTDevice) {
rp := root.GetOrCreateRoutingPolicy()
communitySet := rp.GetOrCreateDefinedSets().GetOrCreateBgpDefinedSets().GetOrCreateCommunitySet(v6CommunitySet)
communitySet.SetCommunityMember([]oc.RoutingPolicy_DefinedSets_BgpDefinedSets_CommunitySet_CommunityMember_Union{oc.UnionString(fmt.Sprintf("%d:%d", ateAS, 100))})
gnmi.Update(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().BgpDefinedSets().CommunitySet(v6CommunitySet).Config(), communitySet)
gnmi.Replace(t, dut, gnmi.OC().RoutingPolicy().DefinedSets().BgpDefinedSets().CommunitySet(v6CommunitySet).Config(), communitySet)
}
}

Expand All @@ -619,8 +629,10 @@ func verifyNonMatchingPrefixTelemetryV6(t *testing.T, dut *ondatra.DUTDevice, at
if pName := prefixSet.GetName(); pName != v6PrefixSet {
t.Errorf("Prefix set name: %s, want: %s", pName, v6PrefixSet)
}
if pMode := prefixSet.GetMode(); pMode != oc.PrefixSet_Mode_IPV6 {
t.Errorf("Prefix set mode: %s, want: %s", pMode, oc.PrefixSet_Mode_IPV6)
if !deviations.SkipPrefixSetMode(dut) {
if pMode := prefixSet.GetMode(); pMode != oc.PrefixSet_Mode_IPV6 {
t.Errorf("Prefix set mode: %s, want: %s", pMode, oc.PrefixSet_Mode_IPV6)
}
}
if prefix := prefixSet.GetPrefix(nonAdvertisedIPv6.cidr(t), maskLenExact); prefix == nil {
t.Errorf("Prefix is nil, want: %s", nonAdvertisedIPv6.cidr(t))
Expand Down Expand Up @@ -718,6 +730,9 @@ func verifyMatchingCommunityTelemetryV6(t *testing.T, dut *ondatra.DUTDevice, at
func bgpISISRedistribution(t *testing.T, dut *ondatra.DUTDevice, operation string) {
dni := deviations.DefaultNetworkInstance(dut)
root := &oc.Root{}
if deviations.EnableTableConnections(dut) {
fptest.ConfigEnableTbNative(t, dut)
}
tableConn := root.GetOrCreateNetworkInstance(dni).GetOrCreateTableConnection(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, oc.Types_ADDRESS_FAMILY_IPV4)
if operation == "set" {
if !deviations.SkipSettingDisableMetricPropagation(dut) {
Expand All @@ -736,6 +751,9 @@ func bgpISISRedistribution(t *testing.T, dut *ondatra.DUTDevice, operation strin
func bgpISISRedistributionV6(t *testing.T, dut *ondatra.DUTDevice, operation string) {
dni := deviations.DefaultNetworkInstance(dut)
root := &oc.Root{}
if deviations.EnableTableConnections(dut) {
fptest.ConfigEnableTbNative(t, dut)
}
tableConn := root.GetOrCreateNetworkInstance(dni).GetOrCreateTableConnection(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, oc.Types_ADDRESS_FAMILY_IPV6)
if operation == "set" {
if !deviations.SkipSettingDisableMetricPropagation(dut) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,14 @@ platform_exceptions: {
default_route_policy_unsupported: true
}
}
platform_exceptions: {
platform: {
vendor: NOKIA
}
deviations: {
explicit_interface_in_default_vrf: true
interface_enabled: true
skip_prefix_set_mode: true
enable_table_connections: true
}
}
10 changes: 5 additions & 5 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1234,11 +1234,6 @@ func BgpAfiSafiWildcardNotSupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetBgpAfiSafiWildcardNotSupported()
}

// EnableTableConnections Admin Enable Table Connections in SRL native
func EnableTableConnections(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEnableTableConnections()
}

// NoZeroSuppression returns true if device wants to remove zero suppression
func NoZeroSuppression(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetNoZeroSuppression()
Expand All @@ -1264,3 +1259,8 @@ func IsisDatabaseOverloadsUnsupported(dut *ondatra.DUTDevice) bool {
func BgpSetMedV7Unsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetBgpSetMedV7Unsupported()
}

// EnableTableConnections returns true if admin state of tableconnections needs to be enabled in SRL native model
func EnableTableConnections(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEnableTableConnections()
}
66 changes: 66 additions & 0 deletions internal/fptest/tableconnection.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package fptest

import (
"context"
"encoding/json"
"testing"

gpb "github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/ondatra"
)

// ConfigEnableTbNative enables admin-state of table-connections in native mode.
func ConfigEnableTbNative(t testing.TB, d *ondatra.DUTDevice) {
snaragund marked this conversation as resolved.
Show resolved Hide resolved
t.Helper()
state := "enable"
switch d.Vendor() {
case ondatra.NOKIA:
adminEnable, err := json.Marshal(state)
if err != nil {
t.Fatalf("Error with json Marshal: %v", err)
}

gpbSetRequest := &gpb.SetRequest{
Prefix: &gpb.Path{
Origin: "native",
},
Update: []*gpb.Update{
{
Path: &gpb.Path{
Elem: []*gpb.PathElem{
{Name: "network-instance", Key: map[string]string{"name": "DEFAULT"}},
{Name: "table-connections"},
{Name: "admin-state"},
},
},
Val: &gpb.TypedValue{
Value: &gpb.TypedValue_JsonIetfVal{
JsonIetfVal: adminEnable,
},
},
},
},
}

gnmiClient := d.RawAPIs().GNMI(t)
if _, err := gnmiClient.Set(context.Background(), gpbSetRequest); err != nil {
t.Fatalf("Unexpected error updating SRL static-route tag-set: %v", err)
}
default:
t.Fatalf("Unsupported vendor %s for deviation 'EnableTableConnections'", d.Vendor())
}
}
2 changes: 1 addition & 1 deletion proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ message Metadata {
// EnableMultipathUnderAfiSafi returns true for devices that do not support multipath under /global path and instead support under global/afi/safi path
// CISCO: b/376241033
// CISCO: b/340859662
bool enable_multipath_under_afi_safi = 230;
bool enable_multipath_under_afi_safi = 230;
// Device have different default value for allow own as.
// Juniper : b/373559004
bool bgp_allowownas_diff_default_value = 231;
Expand Down
Loading