Skip to content

Commit

Permalink
Rt 1.26 git issue fix (#2915)
Browse files Browse the repository at this point in the history
* There is an issue with the DUT ISIS adding sub-interfaces where it should expect main interfaces.

Also IPv6 subscribe is not working

* addressing few issues where they are unsupported

* update

* updates

* updates

* Update basic_static_route_support_test.go

updates

* updates

* updates

* resolved deviation conflicts

* updated comments

* updated timer from 30 to 120
  • Loading branch information
mastarkey authored May 8, 2024
1 parent 4f069df commit 63cc0ec
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,34 @@ import (
)

const (
ipv4PrefixLen = 30
ipv6PrefixLen = 126
isisName = "DEFAULT"
dutAreaAddr = "49.0001"
ateAreaAddr = "49.0002"
dutSysID = "1920.0000.2001"
ate1SysID = "640000000001"
ate2SysID = "640000000002"
v4Route = "203.0.113.0"
v4TrafficStart = "203.0.113.1"
v4RoutePrefix = uint32(24)
v6Route = "2001:db8:128:128::0"
v6TrafficStart = "2001:db8:128:128::1"
v6RoutePrefix = uint32(64)
v4LoopbackRoute = "198.51.100.100"
v4LoopbackRoutePrefix = uint32(32)
v6LoopbackRoute = "2001:db8:64:64::1"
v6LoopbackRoutePrefix = uint32(128)
v4Flow = "v4Flow"
v6Flow = "v6Flow"
trafficDuration = 2 * time.Minute
lossTolerance = float64(1)
ecmpTolerance = uint64(2)
port1Tag = "0x101"
port2Tag = "0x102"
dummyV6 = "2001:db8::192:0:2:d"
dummyMAC = "00:1A:11:00:0A:BC"
ipv4PrefixLen = 30
ipv6PrefixLen = 126
isisName = "DEFAULT"
dutAreaAddr = "49.0001"
ateAreaAddr = "49.0002"
dutSysID = "1920.0000.2001"
ate1SysID = "640000000001"
ate2SysID = "640000000002"
v4Route = "203.0.113.0"
v4TrafficStart = "203.0.113.1"
v4RoutePrefix = uint32(24)
v6Route = "2001:db8:128:128::0"
v6TrafficStart = "2001:db8:128:128::1"
v6RoutePrefix = uint32(64)
v4LoopbackRoute = "198.51.100.100"
v4LoopbackRoutePrefix = uint32(32)
v6LoopbackRoute = "2001:db8:64:64::1"
v6LoopbackRoutePrefix = uint32(128)
v4Flow = "v4Flow"
v6Flow = "v6Flow"
trafficDuration = 2 * time.Minute
lossTolerance = float64(1)
ecmpTolerance = uint64(2)
port1Tag = "0x101"
port2Tag = "0x102"
dummyV6 = "2001:db8::192:0:2:d"
dummyMAC = "00:1A:11:00:0A:BC"
explicitMetricTolerance = float64(2)
)

var (
Expand Down Expand Up @@ -428,9 +429,10 @@ func (td *testData) testStaticRouteECMP(t *testing.T) {
defer td.deleteStaticRoutes(t)

t.Run("Telemetry", func(t *testing.T) {

sp := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(td.dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, deviations.StaticProtocolName(td.dut))
gnmi.Await(t, td.dut, sp.Static(td.staticIPv4.cidr(t)).Prefix().State(), 30*time.Second, td.staticIPv4.cidr(t))
gnmi.Await(t, td.dut, sp.Static(td.staticIPv6.cidr(t)).Prefix().State(), 30*time.Second, td.staticIPv6.cidr(t))
gnmi.Await(t, td.dut, sp.Static(td.staticIPv4.cidr(t)).Prefix().State(), 120*time.Second, td.staticIPv4.cidr(t))
gnmi.Await(t, td.dut, sp.Static(td.staticIPv6.cidr(t)).Prefix().State(), 120*time.Second, td.staticIPv6.cidr(t))

// Validate both the routes i.e. ipv4-route-[a|b] are configured and reported
// correctly
Expand Down Expand Up @@ -518,12 +520,21 @@ func (td *testData) testStaticRouteWithMetric(t *testing.T) {
td.configureStaticRouteToATEP1AndP2(t)
defer td.deleteStaticRoutes(t)

const port2Metric = uint32(100)

var port2Metric = uint32(100)
sp := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(td.dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, deviations.StaticProtocolName(td.dut))

// Configure metric of ipv4-route-b and ipv6-route-b to 100
batch := &gnmi.SetBatch{}
if deviations.StaticRouteWithExplicitMetric(td.dut) {
// per the cisco specifications setting the metric is equivlent to setting the weight, so in this case
// we want the majority of the traffic to go over port 1 so setting the metric to 100 and port 2 as 1
var port1Metric = uint32(100)
port2Metric = uint32(1)
gnmi.BatchReplace(batch, sp.Static(td.staticIPv4.cidr(t)).NextHop("0").Metric().Config(), port1Metric)
gnmi.BatchReplace(batch, sp.Static(td.staticIPv6.cidr(t)).NextHop("0").Metric().Config(), port1Metric)

}

gnmi.BatchReplace(batch, sp.Static(td.staticIPv4.cidr(t)).NextHop("1").Metric().Config(), port2Metric)
gnmi.BatchReplace(batch, sp.Static(td.staticIPv6.cidr(t)).NextHop("1").Metric().Config(), port2Metric)
batch.Set(t, td.dut)
Expand Down Expand Up @@ -567,19 +578,43 @@ func (td *testData) testStaticRouteWithMetric(t *testing.T) {
if !ok {
t.Errorf("Port1 IPv4 egress tracking counter not found: %v", portCounters)
}
if got, want := float64(port1Counter)*100/float64(rxV4), float64(100); got+lossTolerance < want {
t.Errorf("IPv4 traffic on port1, got: %v, want: %v", got, want)

if deviations.StaticRouteWithExplicitMetric(td.dut) {
// validate traffic
got, want := float64(port1Counter)*100/float64(rxV4), float64(100)
expectedMinTraffic := want * (1 - explicitMetricTolerance/100)
if got < expectedMinTraffic {
t.Errorf("IPv4 traffic on port1, got: %v%%, expected to be at least %v%%", got, expectedMinTraffic)
}
} else {
// validate traffic default behavior
if got, want := float64(port1Counter)*100/float64(rxV4), float64(100); got+lossTolerance < want {
t.Errorf("IPv4 traffic on port1, got: %v, want: %v", got, want)
}
}

// Validate that traffic is received from DUT on port-1 and not on port-2
portCounters = egressTrackingCounters(t, td.ate, v6Flow)
_, rxV6 := otgutils.GetFlowStats(t, td.ate.OTG(), v6Flow, 20*time.Second)
port1Counter, ok = portCounters[port1Tag]
if !ok {
t.Errorf("Port1 IPv6 egress tracking counter not found: %v", portCounters)
}
if got, want := float64(port1Counter)*100/float64(rxV6), float64(100); got+lossTolerance < want {
t.Errorf("IPv6 traffic on port1, got: %v, want: %v", got, want)
if deviations.StaticRouteWithExplicitMetric(td.dut) {
// validate traffic
got, want := float64(port1Counter)*100/float64(rxV6), float64(100)
expectedMinTraffic := want * (1 - explicitMetricTolerance/100)
if got < expectedMinTraffic {
t.Errorf("IPv6 traffic on port1, got: %v%%, expected to be at least %v%%", got, expectedMinTraffic)
}

} else {
// validate traffic default behavior
if got, want := float64(port1Counter)*100/float64(rxV6), float64(100); got+lossTolerance < want {
t.Errorf("IPv6 traffic on port1, got: %v, want: %v", got, want)
}
}

})
}

Expand Down Expand Up @@ -726,6 +761,9 @@ func (td *testData) testIPv6StaticRouteWithIPv4NextHop(t *testing.T) {
// IPv4 address of ATE port-1
// Change the IPv6 next-hop of the ipv6-route-b with the next hop set to the
// IPv4 address of ATE port-2
if deviations.IPv6StaticRouteWithIPv4NextHopUnsupported(td.dut) {
t.Skip("Skipping Ipv6 with Ipv4 route unsupported. Deviation IPv4StaticRouteWithIPv6NextHopUnsupported enabled.")
}
b := &gnmi.SetBatch{}
var v6Cfg *cfgplugins.StaticRouteCfg
if deviations.IPv6StaticRouteWithIPv4NextHopRequiresStaticARP(td.dut) {
Expand Down Expand Up @@ -853,6 +891,9 @@ func (td *testData) testIPv4StaticRouteWithIPv6NextHop(t *testing.T) {
// IPv6 address of ATE port-1
// Change the IPv4 next-hop of the ipv4-route-b with the next hop set to the
// IPv6 address of ATE port-2
if deviations.IPv4StaticRouteWithIPv6NextHopUnsupported(td.dut) {
t.Skip("Skipping Ipv4 with Ipv6 route unsupported. Deviation IPv4StaticRouteWithIPv6NextHopUnsupported enabled.")
}
v4Cfg := &cfgplugins.StaticRouteCfg{
NetworkInstance: deviations.DefaultNetworkInstance(td.dut),
Prefix: td.staticIPv4.cidr(t),
Expand Down Expand Up @@ -921,7 +962,9 @@ func (td *testData) testIPv4StaticRouteWithIPv6NextHop(t *testing.T) {
}

func (td *testData) testStaticRouteWithDropNextHop(t *testing.T) {

if deviations.StaticRouteWithDropNhUnsupported(td.dut) {
t.Skip("Skipping test static route with drop nexthop. Deviation StaticRouteWithDropNhUnsupported enabled.")
}
b := &gnmi.SetBatch{}
// Configure IPv4 static routes:
// * Configure one IPv4 static route i.e. ipv4-route-a on the DUT for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,18 @@ platform_exceptions: {
missing_static_route_drop_next_hop_telemetry: true
}
}
platform_exceptions: {
platform: {
vendor: CISCO
}
deviations: {
ipv4_static_route_with_ipv6_nh_unsupported: true
ipv6_static_route_with_ipv4_nh_unsupported: true
static_route_with_drop_nh: true
unsupported_static_route_next_hop_recurse: true
static_route_with_explicit_metric: true
interface_ref_config_unsupported: true
}
}
tags: TAGS_DATACENTER_EDGE
21 changes: 21 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ func SkipBgpSendCommunityType(dut *ondatra.DUTDevice) bool {
// BgpActionsSetCommunityMethodUnsupported return true if BGP actions set-community method is unsupported
func BgpActionsSetCommunityMethodUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetBgpActionsSetCommunityMethodUnsupported()

}

// SetNoPeerGroup Ensure that no BGP configurations exists under PeerGroups.
Expand All @@ -946,3 +947,23 @@ func SetNoPeerGroup(dut *ondatra.DUTDevice) bool {
func BgpCommunityMemberIsAString(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetBgpCommunityMemberIsAString()
}

// IPv4StaticRouteWithIPv6NextHopUnsupported unsupported ipv4 with ipv6 nexthop
func IPv4StaticRouteWithIPv6NextHopUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetIpv4StaticRouteWithIpv6NhUnsupported()
}

// IPv6StaticRouteWithIPv4NextHopUnsupported unsported ipv6 with ipv4 nexthop
func IPv6StaticRouteWithIPv4NextHopUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetIpv6StaticRouteWithIpv4NhUnsupported()
}

// StaticRouteWithDropNhUnsupported unsuported drop nexthop
func StaticRouteWithDropNhUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetStaticRouteWithDropNh()
}

// StaticRouteWithExplicitMetric set explict metric
func StaticRouteWithExplicitMetric(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetStaticRouteWithExplicitMetric()
}
10 changes: 10 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,16 @@ message Metadata {
bool set_no_peer_group = 175;
// Bgp community member is a string
bool bgp_community_member_is_a_string = 176;
// Flag to indicate whether IPv4 static routes with IPv6 next-hops are unsupported.
bool ipv4_static_route_with_ipv6_nh_unsupported = 177;
// Flag to indicate whether IPv6 static routes with IPv4 next-hops are unsupported.
bool ipv6_static_route_with_ipv4_nh_unsupported = 178;
// Flag to indicate support for static routes that simply drop packets
bool static_route_with_drop_nh = 179;
// Flag to indicate support for static routes that can be configured with an explicit metric.
bool static_route_with_explicit_metric = 180;


// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19;
}
Expand Down
Loading

0 comments on commit 63cc0ec

Please sign in to comment.