Skip to content

Commit

Permalink
Modify ISIS awaitAdjacency function
Browse files Browse the repository at this point in the history
  • Loading branch information
suredhar committed Sep 9, 2024
1 parent 67a907f commit afd7016
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ 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.Isis_IsisInterfaceAdjState_DOWN); !ok {
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 ")
}
Expand Down Expand Up @@ -290,12 +290,12 @@ 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.Isis_IsisInterfaceAdjState_DOWN); !ok {
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")
}
Expand Down Expand Up @@ -960,15 +960,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
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ platform_exceptions: {
explicit_interface_in_default_vrf: false
}
}

platform_exceptions: {
platform: {
vendor: CISCO
}
deviations: {
interface_ref_config_unsupported: true
}
}

0 comments on commit afd7016

Please sign in to comment.