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-5.7: Fix ISIS issues #3424

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
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 @@ -56,30 +56,35 @@ import (
)

const (
ipv4PLen = 30
ipv6PLen = 126
isisInstance = "DEFAULT"
dutAreaAddress = "49.0001"
ateAreaAddress = "49"
dutSysID = "1920.0000.2001"
asn = 64501
acceptRoutePolicy = "PERMIT-ALL"
trafficPPS = 2500000
srcTrafficV4 = "100.0.1.1"
srcTrafficV6 = "2002:db8:64:64::1"
dstTrafficV4 = "100.0.2.1"
dstTrafficV6 = "2003:db8:64:64::1"
v4Count = 254
v6Count = 100000000
lagTypeLACP = oc.IfAggregate_AggregationType_LACP
ieee8023adLag = oc.IETFInterfaces_InterfaceType_ieee8023adLag
ethernetCsmacd = oc.IETFInterfaces_InterfaceType_ethernetCsmacd
LAG1 = "lag1"
LAG2 = "lag2"
LAG3 = "lag3"
niTeVrf111 = "TE_VRF_111"
niRepairVrf = "REPAIR_VRF"
pfx1AdvV4WithMask = "100.0.1.0/24"
ipv4PLen = 30
ipv6PLen = 126
isisInstance = "DEFAULT"
dutAreaAddress = "49.0001"
ateAreaAddress = "49"
dutSysID = "1920.0000.2001"
asn = 64501
acceptRoutePolicy = "PERMIT-ALL"
trafficPPS = 1000
srcTrafficV4 = "100.0.1.1"
srcTrafficV6 = "2002:db8:64:64::1"
dstTrafficV4 = "100.0.2.1"
dstTrafficV6 = "2003:db8:64:64::1"
v4Count = 254
v6Count = 100000000
lagTypeLACP = oc.IfAggregate_AggregationType_LACP
ieee8023adLag = oc.IETFInterfaces_InterfaceType_ieee8023adLag
ethernetCsmacd = oc.IETFInterfaces_InterfaceType_ethernetCsmacd
LAG1 = "lag1"
LAG2 = "lag2"
LAG3 = "lag3"
niTeVrf111 = "TE_VRF_111"
niRepairVrf = "REPAIR_VRF"
pfx1AdvV4WithMask = "100.0.1.0/24"
niTEVRF222 = "TE_VRF_222"
ipv4OuterSrc111Addr = "198.51.100.111"
gribiIPv4EntryVRF111 = "203.0.113.1"
ipv4OuterSrc222Addr = "198.51.100.222"
gribiIPv4EntryVRF222 = "203.0.113.100"
)

type aggPortData struct {
Expand Down Expand Up @@ -215,12 +220,17 @@ func TestAggregateAllNotForwardingViable(t *testing.T) {
})
t.Run("RT-5.7.1.2: Setting Forwarding-Viable to False for Lag2 all ports", func(t *testing.T) {
// Ensure ISIS Adjacency is up on LAG_2
if ok := awaitAdjacency(t, dut, aggIDs[1], oc.Isis_IsisInterfaceAdjState_UP); !ok {
if ok := awaitAdjacency(t, dut, aggIDs[1], []oc.E_Isis_IsisInterfaceAdjState{oc.Isis_IsisInterfaceAdjState_UP}); !ok {
t.Fatal("ISIS Adjacency is Down on LAG_2")
}
configForwardingViable(t, dut, dutPortList[1:2], false)
configForwardingViable(t, dut, dutPortList[1:agg2.ateLagCount+1], false)
// Ensure ISIS Adjacency is Down on LAG_2

if ok := awaitAdjacency(t, dut, aggIDs[1], []oc.E_Isis_IsisInterfaceAdjState{oc.Isis_IsisInterfaceAdjState_INIT, oc.Isis_IsisInterfaceAdjState_DOWN}); !ok {
if presence := gnmi.LookupAll(t, dut, ocpath.Root().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isisInstance).Isis().Interface(aggIDs[1]).LevelAny().AdjacencyAny().AdjacencyState().State()); len(presence) > 0 {
t.Fatalf("ISIS Adjacency is Established on LAG_2 ")
}
}
startTraffic(t, dut, ate, top)
if err := confirmNonViableForwardingTraffic(t, dut, ate, atePortList[1:agg2.ateLagCount+1], dutPortList[1:agg2.ateLagCount+1]); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -261,7 +271,7 @@ func TestAggregateAllNotForwardingViable(t *testing.T) {

t.Run("RT-5.7.1.4: Setting Forwarding-Viable to False and Down some Port on Lag2", func(t *testing.T) {
// Ensure ISIS Adjacency is up on LAG_2
if ok := awaitAdjacency(t, dut, aggIDs[1], oc.Isis_IsisInterfaceAdjState_UP); !ok {
if ok := awaitAdjacency(t, dut, aggIDs[1], []oc.E_Isis_IsisInterfaceAdjState{oc.Isis_IsisInterfaceAdjState_UP}); !ok {
t.Fatal("ISIS Adjacency is Down on LAG_2")
}
configForwardingViable(t, dut, dutPortList[1:agg2.ateLagCount+1], false)
Expand Down Expand Up @@ -337,10 +347,16 @@ func TestAggregateAllNotForwardingViable(t *testing.T) {

t.Run("RT-5.7.2.2: Setting Forwarding-Viable to False for Lag2 all ports", func(t *testing.T) {
// Ensure ISIS Adjacency is up on LAG_2
if ok := awaitAdjacency(t, dut, aggIDs[1], oc.Isis_IsisInterfaceAdjState_UP); !ok {
if ok := awaitAdjacency(t, dut, aggIDs[1], []oc.E_Isis_IsisInterfaceAdjState{oc.Isis_IsisInterfaceAdjState_UP}); !ok {
t.Fatal("ISIS Adjacency is Down on LAG_2")
}
configForwardingViable(t, dut, dutPortList[1:2], false)
configForwardingViable(t, dut, dutPortList[1:agg2.ateLagCount+1], false)
// Ensure ISIS Adjacency is Down on LAG_2
if ok := awaitAdjacency(t, dut, aggIDs[1], []oc.E_Isis_IsisInterfaceAdjState{oc.Isis_IsisInterfaceAdjState_INIT, oc.Isis_IsisInterfaceAdjState_DOWN}); !ok {
if presence := gnmi.LookupAll(t, dut, ocpath.Root().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isisInstance).Isis().Interface(aggIDs[1]).LevelAny().AdjacencyAny().AdjacencyState().State()); len(presence) > 0 {
t.Fatalf("ISIS Adjacency is Established on LAG_2")
}
}
startTraffic(t, dut, ate, top)
if err := confirmNonViableForwardingTraffic(t, dut, ate, atePortList[1:(agg2.ateLagCount+1)], dutPortList[1:(agg2.ateLagCount+1)]); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -377,7 +393,7 @@ func TestAggregateAllNotForwardingViable(t *testing.T) {

t.Run("RT-5.7.2.4: Setting Forwarding-Viable to False and Down some Port on Lag2", func(t *testing.T) {
// Ensure ISIS Adjacency is up on LAG_2
if ok := awaitAdjacency(t, dut, aggIDs[1], oc.Isis_IsisInterfaceAdjState_UP); !ok {
if ok := awaitAdjacency(t, dut, aggIDs[1], []oc.E_Isis_IsisInterfaceAdjState{oc.Isis_IsisInterfaceAdjState_UP}); !ok {
t.Fatal("ISIS Adjacency is Down on LAG_2")
}
configForwardingViable(t, dut, dutPortList[1:agg2.ateLagCount+1], false)
Expand Down Expand Up @@ -432,7 +448,7 @@ func setDUTInterfaceWithState(t testing.TB, dut *ondatra.DUTDevice, ports []*ond
func configNonDefaultNetworkInstance(t *testing.T, dut *ondatra.DUTDevice) {
t.Helper()
c := &oc.Root{}
vrfs := []string{niTeVrf111, niRepairVrf}
vrfs := []string{niTeVrf111, niRepairVrf, niTEVRF222}
for _, vrf := range vrfs {
ni := c.GetOrCreateNetworkInstance(vrf)
ni.Type = oc.NetworkInstanceTypes_NETWORK_INSTANCE_TYPE_L3VRF
Expand All @@ -451,7 +467,9 @@ func configureDUT(t *testing.T, dut *ondatra.DUTDevice) []string {
if len(dut.Ports()) > 4 {
agg2.ateLagCount = uint32(len(dut.Ports()) - 3)
agg3.ateLagCount = 2
trafficDistributionWeights = []uint64{33, 67}
if dut.Vendor() != ondatra.CISCO {
trafficDistributionWeights = []uint64{33, 67}
}
}
var aggIDs []string
for _, a := range []*aggPortData{agg1, agg2, agg3} {
Expand Down Expand Up @@ -989,17 +1007,26 @@ func installGRIBIRoutes(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra.ATEDe
WithIndex(uint64(1000)).WithIPAddress(agg3.ateIPv4),
fluent.NextHopGroupEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithID(uint64(1000)).AddNextHop(uint64(1000), uint64(1)),
fluent.IPv4Entry().WithNetworkInstance(niTEVRF222).WithNextHopGroupNetworkInstance(deviations.DefaultNetworkInstance(dut)).
WithPrefix(gribiIPv4EntryVRF222+"/32").WithNextHopGroup(1000),

fluent.IPv4Entry().WithNetworkInstance(niRepairVrf).WithNextHopGroupNetworkInstance(deviations.DefaultNetworkInstance(dut)).
WithPrefix(pfx4AdvV4.ip+"/24").WithNextHopGroup(1000))
fluent.NextHopEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithIndex(2000).WithDecapsulateHeader(fluent.IPinIP).WithEncapsulateHeader(fluent.IPinIP).
WithIPinIP(ipv4OuterSrc222Addr, gribiIPv4EntryVRF222).
WithNextHopNetworkInstance(niTEVRF222),
fluent.NextHopGroupEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithID(2000).AddNextHop(2000, 1),

fluent.IPv4Entry().WithNetworkInstance(niRepairVrf).WithNextHopGroup(2000).WithPrefix(gribiIPv4EntryVRF111+"/32").
WithNextHopGroupNetworkInstance(deviations.DefaultNetworkInstance(dut)))

if err := awaitTimeout(tcArgs.ctx, t, tcArgs.client, time.Minute); err != nil {
t.Logf("Could not program entries via client, got err, check error codes: %v", err)
}

chk.HasResult(t, tcArgs.client.Results(t),
fluent.OperationResult().
WithIPv4Operation(pfx4AdvV4.ip+"/24").
WithIPv4Operation(gribiIPv4EntryVRF111+"/32").
WithOperationType(constants.Add).
WithProgrammingResult(fluent.InstalledInFIB).
AsResult(),
Expand All @@ -1010,7 +1037,7 @@ func installGRIBIRoutes(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra.ATEDe
tcArgs.client.Modify().AddEntry(t,
fluent.NextHopEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithIndex(uint64(1)).WithEncapsulateHeader(fluent.IPinIP).
WithIPinIP("100.0.1.254", "100.0.4.254").
WithIPinIP(ipv4OuterSrc111Addr, gribiIPv4EntryVRF111).
WithNextHopNetworkInstance(niTeVrf111),
fluent.NextHopGroupEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithID(uint64(1)).AddNextHop(uint64(1), uint64(1)),
Expand All @@ -1032,15 +1059,15 @@ func installGRIBIRoutes(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra.ATEDe
chk.IgnoreOperationID(),
)

// Programming AFT entries for encapped prefixes "100.0.4.254/32"
// Programming AFT entries for encapped prefixes "203.0.113.1/32"
tcArgs.client.Modify().AddEntry(t,
fluent.NextHopEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithIndex(uint64(101)).WithIPAddress(agg2.ateIPv4),
fluent.NextHopGroupEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithID(uint64(101)).AddNextHop(uint64(101), uint64(1)).WithBackupNHG(3000),

fluent.IPv4Entry().WithNetworkInstance(niTeVrf111).
WithPrefix("100.0.4.254/32").WithNextHopGroup(101).
WithPrefix(gribiIPv4EntryVRF111+"/32").WithNextHopGroup(101).
WithNextHopGroupNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)),
)

Expand All @@ -1050,7 +1077,7 @@ func installGRIBIRoutes(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra.ATEDe

chk.HasResult(t, tcArgs.client.Results(t),
fluent.OperationResult().
WithIPv4Operation("100.0.4.254/32").
WithIPv4Operation(gribiIPv4EntryVRF111+"/32").
WithOperationType(constants.Add).
WithProgrammingResult(fluent.InstalledInFIB).
AsResult(),
Expand Down Expand Up @@ -1096,6 +1123,7 @@ func verifyTrafficFlow(t *testing.T, ate *ondatra.ATEDevice, flows []gosnappi.Fl
rxPkts := gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flows[0].Name()).Counters().InPkts().State())
txPkts := gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flows[0].Name()).Counters().OutPkts().State())
lostPkt := txPkts - rxPkts

if status {
if got := (lostPkt * 100 / txPkts); got >= 51 {
return false
Expand All @@ -1108,6 +1136,7 @@ func verifyTrafficFlow(t *testing.T, ate *ondatra.ATEDevice, flows []gosnappi.Fl
rxPkts := gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flow.Name()).Counters().InPkts().State())
txPkts := gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flow.Name()).Counters().OutPkts().State())
lostPkt := txPkts - rxPkts

if got := (lostPkt * 100 / txPkts); got > 0 {
return false
}
Expand All @@ -1117,15 +1146,19 @@ func verifyTrafficFlow(t *testing.T, ate *ondatra.ATEDevice, flows []gosnappi.Fl
}

// awaitAdjacency wait for adjacency to be up/down
func awaitAdjacency(t *testing.T, dut *ondatra.DUTDevice, intfName string, state oc.E_Isis_IsisInterfaceAdjState) bool {
func awaitAdjacency(t *testing.T, dut *ondatra.DUTDevice, intfName string, state []oc.E_Isis_IsisInterfaceAdjState) bool {
isisPath := ocpath.Root().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isisInstance).Isis()
intf := isisPath.Interface(intfName)
query := intf.LevelAny().AdjacencyAny().AdjacencyState().State()
_, ok := gnmi.WatchAll(t, dut, query, 90*time.Second, func(val *ygnmi.Value[oc.E_Isis_IsisInterfaceAdjState]) bool {
v, ok := val.Val()
return v == state && ok
for _, s := range state {
if (v == s) && ok {
return true
}
}
return false
}).Await(t)

return ok
}

Expand Down
Loading