Skip to content

Commit

Permalink
added ISIS p2p circuit type and hello timer sub tests
Browse files Browse the repository at this point in the history
  • Loading branch information
self-maurya committed Feb 3, 2025
1 parent 3c834bb commit bd8410f
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 10 deletions.
4 changes: 2 additions & 2 deletions feature/isis/otg_tests/base_adjacencies_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Base IS-IS functionality and adjacency establishment.
* Confirm in each case that that adjacency forms and the correct values
are reported back by the device.
### RT-2.1.4 [TODO: https://github.com/openconfig/featureprofiles/issues/3421]
### RT-2.1.4 P2P Circuit Type
* Configuration:
* Configure ISIS for ATE port-1 and DUT port-1.
Expand All @@ -70,7 +70,7 @@ Base IS-IS functionality and adjacency establishment.
* With a known LSP content, ensure that the telemetry received from the
device for the LSP matches the expected content.
### RT-2.1.6 [TODO: https://github.com/openconfig/featureprofiles/issues/3422]
### RT-2.1.6 ISIS Hello Timer
* Baseline Configuration on the DUT:
* Set the hello-interval to a standard value (10 seconds).
Expand Down
107 changes: 102 additions & 5 deletions feature/isis/otg_tests/base_adjacencies_test/base_adjacencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func EqualToDefault[T any](query ygnmi.SingletonQuery[T], val T, missingValueFor
return check.Equal(query, val)
}

// CheckPresence check for the leaf presense only when missingValueForDefaults is false.
// CheckPresence check for the leaf presence only when missingValueForDefaults is false.
func CheckPresence(query ygnmi.SingletonQuery[uint32], missingValueForDefaults bool) check.Validator {
if !missingValueForDefaults {
return check.Present[uint32](query)
Expand Down Expand Up @@ -377,7 +377,7 @@ func TestBasic(t *testing.T) {
})
}

// TestHelloPadding tests several different hello padding modes to confirm they all work.
// TestHelloPadding tests different hello padding modes to confirm they all work.
func TestHelloPadding(t *testing.T) {
for _, tc := range []struct {
name string
Expand Down Expand Up @@ -410,7 +410,9 @@ func TestHelloPadding(t *testing.T) {
global.HelloPadding = tc.mode
})
ts.ATEIntf1.Isis().Advanced().SetEnableHelloPadding(tc.mode != oc.Isis_HelloPaddingType_DISABLE)
ts.PushAndStart(t)
if err := ts.PushAndStart(t); err != nil {
t.Fatalf("Unable to push initial DUT config: %v", err)
}
_, err := ts.AwaitAdjacency()
if err != nil {
t.Fatalf("No IS-IS adjacency formed: %v", err)
Expand Down Expand Up @@ -474,7 +476,9 @@ func TestAuthentication(t *testing.T) {
t.Fatalf("test case has bad mode: %v", tc.mode)
}
}
ts.PushAndStart(t)
if err := ts.PushAndStart(t); err != nil {
t.Fatalf("Unable to push initial DUT config: %v", err)
}
ts.MustAdjacency(t)
})
}
Expand Down Expand Up @@ -575,7 +579,9 @@ func TestTraffic(t *testing.T) {
deadFlow.Metrics().SetEnable(true)

t.Log("Starting protocols on ATE...")
ts.PushAndStart(t)
if err := ts.PushAndStart(t); err != nil {
t.Fatalf("Unable to push initial DUT config: %v", err)
}
ts.MustAdjacency(t)

gnmi.Watch(t, otg, gnmi.OTG().IsisRouter("devIsis").Counters().Level2().InLsp().State(), 30*time.Second, func(v *ygnmi.Value[uint64]) bool {
Expand Down Expand Up @@ -613,3 +619,94 @@ func TestTraffic(t *testing.T) {
t.Errorf("Got %v%% invalid packet loss; expected 100%%", deadLoss)
}
}

// TestPointToPointCircuitType verifies that the circuit type is set to point-to-point for a
// point-to-point IS-IS session.
func TestPointToPointCircuitType(t *testing.T) {
ts := isissession.MustNew(t).WithISIS()
ts.ConfigISIS(func(isis *oc.NetworkInstance_Protocol_Isis) {
for _, intf := range isis.Interface {
intf.SetCircuitType(oc.Isis_CircuitType_POINT_TO_POINT)
}
})
if err := ts.PushAndStart(t); err != nil {
t.Fatalf("Unable to push initial DUT config: %v", err)
}
ts.MustAdjacency(t)

intfName := ts.DUTPort1.Name()
if deviations.ExplicitInterfaceInDefaultVRF(ts.DUT) {
intfName = intfName + ".0"
}
circuitType := gnmi.Get(t, ts.DUT, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(ts.DUT)).
Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isissession.ISISName).Isis().Interface(intfName).CircuitType().State())
if circuitType != oc.Isis_CircuitType_POINT_TO_POINT {
t.Errorf("Got circuit type %v; want %v", circuitType, oc.Isis_CircuitType_POINT_TO_POINT)
}
}

// TestISISHelloTimer tests several different hello timer values.
func TestISISHelloTimer(t *testing.T) {
ts := isissession.MustNew(t).WithISIS()
if err := ts.PushAndStart(t); err != nil {
t.Fatalf("Unable to push initial DUT config: %v", err)
}
ts.MustAdjacency(t)

testCases := []struct {
name string
helloInterval uint32
helloMultiplier uint8
}{
{
name: "hello_interval_multiplier_10_3",
helloInterval: 10,
helloMultiplier: 3,
},
{
name: "hello_interval_multiplier_15_3",
helloInterval: 15,
helloMultiplier: 3,
},
{
name: "hello_interval_multiplier_15_5",
helloInterval: 15,
helloMultiplier: 5,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
intfName := ts.DUTPort1.Name()
if deviations.ExplicitInterfaceInDefaultVRF(ts.DUT) {
intfName = intfName + ".0"
}
level2 := 2

d := &oc.Root{}
intf := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(ts.DUT)).
GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isissession.ISISName).
GetOrCreateIsis().GetOrCreateInterface(intfName)
if !deviations.ISISInterfaceLevel1DisableRequired(ts.DUT) {
timers1 := intf.GetOrCreateLevel(uint8(1)).GetOrCreateTimers()
timers1.SetHelloInterval(tc.helloInterval)
timers1.SetHelloMultiplier(tc.helloMultiplier)
}

timers2 := intf.GetOrCreateLevel(uint8(level2)).GetOrCreateTimers()
timers2.SetHelloInterval(tc.helloInterval)
timers2.SetHelloMultiplier(tc.helloMultiplier)

gnmi.Update(t, ts.DUT, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(ts.DUT)).
Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isissession.ISISName).Isis().Interface(intfName).Config(), intf)

got := gnmi.Get[*oc.NetworkInstance_Protocol_Isis_Interface_Level_Timers](t, ts.DUT, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(ts.DUT)).
Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isissession.ISISName).Isis().Interface(intfName).Level(uint8(level2)).Timers().State())
if got.GetHelloInterval() != tc.helloInterval {
t.Errorf("Got hello interval %v; want %v", got.GetHelloInterval(), tc.helloInterval)
}
if got.GetHelloMultiplier() != tc.helloMultiplier {
t.Errorf("Got hello multiplier %v; want %v", got.GetHelloMultiplier(), tc.helloMultiplier)
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ platform_exceptions: {
omit_l2_mtu: true
missing_value_for_defaults: true
interface_enabled: true
default_network_instance: "default"
isis_instance_enabled_required: true
isis_interface_afi_unsupported: true
default_network_instance: "default"
isis_instance_enabled_required: true
isis_interface_afi_unsupported: true
}
}
platform_exceptions: {
Expand Down

0 comments on commit bd8410f

Please sign in to comment.