Skip to content

Commit

Permalink
RT-2.12 Fixed with deviations & minor changes (#3513)
Browse files Browse the repository at this point in the history
* RT-2.12 Fixed with deviations & minor changes
- Edited dp2v6Route such that it is advertised as ISIS route.
- Set separate tag value for IPv4 & IPv6 as per README.
- Added missing metricPropogation parameter.

PS: Script needs alteration (apart from this PR) such that it adheres to README.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* - Added dut.vendor switch for enable_table_connection deviation.
- Reverted dp2v6 route

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* -Minor change

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* Update feature/isis/otg_tests/static_route_isis_redistribution/static_route_isis_redistribution_test.go

Co-authored-by: Darren Loher <dloher@google.com>

* Update feature/isis/otg_tests/static_route_isis_redistribution/static_route_isis_redistribution_test.go
  • Loading branch information
snaragund authored Dec 3, 2024
1 parent 4cccbec commit e394152
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ platform_exceptions: {
match_tag_set_condition_unsupported: true
}
}
platform_exceptions: {
platform: {
vendor: NOKIA
}
deviations: {
explicit_interface_in_default_vrf: true
interface_enabled: true
static_protocol_name: "static"
skip_prefix_set_mode: true
enable_table_connections: true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ const (
protoDst = oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS
dummyV6 = "2001:db8::192:0:2:d"
dummyMAC = "00:1A:11:00:0A:BC"
tagValue = 100
V4tagValue = 40
V6tagValue = 60
)

var (
Expand Down Expand Up @@ -113,7 +114,7 @@ func getAndVerifyIsisImportPolicy(t *testing.T,
if err != nil {
t.Fatalf("failed due to %v", err)
}
t.Log(getResponse)
t.Log("Received parameters of table connections")

t.Log("Verify Get outputs ")
for _, notification := range getResponse.Notification {
Expand Down Expand Up @@ -142,9 +143,9 @@ func getAndVerifyIsisImportPolicy(t *testing.T,
t.Fatalf("import-policy is not set to %s as expected", RplName)
}
}
t.Logf("Table Connection Details:"+
t.Logf("Table Connection Details:\n"+
"SRC PROTO GOT %v WANT STATIC\n"+
"DST PRTO GOT %v WANT ISIS\n"+
"DST PROTO GOT %v WANT ISIS\n"+
"ADDRESS FAMILY GOT %v WANT %v\n"+
"DISABLEMETRICPROPAGATION GOT %v WANT %v\n", config.SrcProtocol,
config.DstProtocol, config.AddressFamily, addressFamily,
Expand All @@ -171,6 +172,10 @@ func isisImportPolicyConfig(t *testing.T, dut *ondatra.DUTDevice, policyName str
if !deviations.SkipSettingDisableMetricPropagation(dut) {
tableConn.SetDisableMetricPropagation(metricPropagation)
}
if deviations.EnableTableConnections(dut) {
state := "enable"
configEnableTbNative(t, dut, state)
}
gnmi.BatchReplace(batchSet, gnmi.OC().NetworkInstance(dni).TableConnection(srcProto, dstProto, addfmly).Config(), tableConn)

if deviations.SamePolicyAttachedToAllAfis(dut) {
Expand Down Expand Up @@ -206,7 +211,9 @@ func configureRoutePolicy(dut *ondatra.DUTDevice, rplName string, statement stri
v4Prefix := v4Route + "/" + strconv.FormatUint(uint64(v4RoutePrefix), 10)
pset := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(v4PrefixSet)
pset.GetOrCreatePrefix(v4Prefix, prefixMatch)
pset.SetMode(oc.PrefixSet_Mode_IPV4)
if !deviations.SkipPrefixSetMode(dut) {
pset.SetMode(oc.PrefixSet_Mode_IPV4)
}
stmt1.GetOrCreateConditions().GetOrCreateMatchPrefixSet().SetPrefixSet(v4PrefixSet)
stmt1.GetOrCreateActions().SetPolicyResult(rplType)

Expand All @@ -217,7 +224,9 @@ func configureRoutePolicy(dut *ondatra.DUTDevice, rplName string, statement stri
v6Prefix := v6Route + "/" + strconv.FormatUint(uint64(v6RoutePrefix), 10)
pset = rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(v6PrefixSet)
pset.GetOrCreatePrefix(v6Prefix, prefixMatch)
pset.SetMode(oc.PrefixSet_Mode_IPV6)
if !deviations.SkipPrefixSetMode(dut) {
pset.SetMode(oc.PrefixSet_Mode_IPV6)
}
stmt2.GetOrCreateConditions().GetOrCreateMatchPrefixSet().SetPrefixSet(v6PrefixSet)
stmt2.GetOrCreateActions().SetPolicyResult(rplType)
} else if tagSetCond {
Expand All @@ -228,7 +237,7 @@ func configureRoutePolicy(dut *ondatra.DUTDevice, rplName string, statement stri
}
v4tagSet := getTagSetName(dut, rplName, v4Statement, "v4")
tagSet1 := rp.GetOrCreateDefinedSets().GetOrCreateTagSet(v4tagSet)
tagSet1.SetTagValue([]oc.RoutingPolicy_DefinedSets_TagSet_TagValue_Union{oc.UnionUint32(tagValue)})
tagSet1.SetTagValue([]oc.RoutingPolicy_DefinedSets_TagSet_TagValue_Union{oc.UnionUint32(V4tagValue)})
stmt1.GetOrCreateConditions().GetOrCreateMatchTagSet().SetTagSet(v4tagSet)
stmt1.GetOrCreateActions().SetPolicyResult(rplType)

Expand All @@ -238,7 +247,7 @@ func configureRoutePolicy(dut *ondatra.DUTDevice, rplName string, statement stri
}
v6tagSet := getTagSetName(dut, rplName, v6Statement, "v6")
tagSet2 := rp.GetOrCreateDefinedSets().GetOrCreateTagSet(v6tagSet)
tagSet2.SetTagValue([]oc.RoutingPolicy_DefinedSets_TagSet_TagValue_Union{oc.UnionUint32(tagValue)})
tagSet2.SetTagValue([]oc.RoutingPolicy_DefinedSets_TagSet_TagValue_Union{oc.UnionUint32(V6tagValue)})
stmt2.GetOrCreateConditions().GetOrCreateMatchTagSet().SetTagSet(v6tagSet)
stmt2.GetOrCreateActions().SetPolicyResult(rplType)
} else {
Expand Down Expand Up @@ -366,6 +375,46 @@ func getTagSetName(dut *ondatra.DUTDevice, policyName, stmtName, afStr string) s
return fmt.Sprintf("tag-set-%s", afStr)
}

func configEnableTbNative(t testing.TB, d *ondatra.DUTDevice, state string) {
t.Helper()
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())
}
}

func TestStaticToISISRedistribution(t *testing.T) {
var ts *isissession.TestSession

Expand Down Expand Up @@ -462,6 +511,7 @@ func TestStaticToISISRedistribution(t *testing.T) {
desc: "RT-2.12.8: Redistribute IPv6 static route to IS-IS matching a prefix using a route-policy",
protoAf: oc.Types_ADDRESS_FAMILY_IPV6,
RplName: v6RoutePolicy,
metricPropogation: true,
policyStmtType: oc.RoutingPolicy_PolicyResultType_ACCEPT_ROUTE,
verifyTrafficStats: true,
trafficFlows: []string{v6Flow},
Expand Down Expand Up @@ -497,8 +547,8 @@ func TestStaticToISISRedistribution(t *testing.T) {

if tc.TagSetCondition {
t.Run("Verify Configuration for RPL TagSet", func(t *testing.T) {
verifyRplConfig(t, ts.DUT, getTagSetName(ts.DUT, tc.RplName, v4Statement, "v4"), oc.UnionUint32(tagValue))
verifyRplConfig(t, ts.DUT, getTagSetName(ts.DUT, tc.RplName, v6Statement, "v6"), oc.UnionUint32(tagValue))
verifyRplConfig(t, ts.DUT, getTagSetName(ts.DUT, tc.RplName, v4Statement, "v4"), oc.UnionUint32(V4tagValue))
verifyRplConfig(t, ts.DUT, getTagSetName(ts.DUT, tc.RplName, v6Statement, "v6"), oc.UnionUint32(V6tagValue))
})
}

Expand Down
5 changes: 5 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,3 +1233,8 @@ func BgpExtendedNextHopEncodingLeafUnsupported(dut *ondatra.DUTDevice) bool {
func BgpAfiSafiWildcardNotSupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetBgpAfiSafiWildcardNotSupported()
}

// Admin Enable Table Connections in SRL native

Check failure on line 1237 in internal/deviations/deviations.go

View workflow job for this annotation

GitHub Actions / Static Analysis

comment on exported function EnableTableConnections should be of the form "EnableTableConnections ..."

Check failure on line 1237 in internal/deviations/deviations.go

View workflow job for this annotation

GitHub Actions / Static Analysis

comment on exported function EnableTableConnections should be of the form "EnableTableConnections ..."
func EnableTableConnections(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEnableTableConnections()
}
2 changes: 2 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ message Metadata {
// Device does not support bgp afi safi wildcard.
// Cisco: b/379863985
bool bgp_afi_safi_wildcard_not_supported = 235;
// Nokia; b/304493065 comment#7 SRL native admin_enable for table-connections
bool enable_table_connections = 236;
// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
102 changes: 57 additions & 45 deletions proto/metadata_go_proto/metadata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e394152

Please sign in to comment.