Skip to content

Commit

Permalink
Merge branch 'main' into dplore-patch-12
Browse files Browse the repository at this point in the history
  • Loading branch information
dplore authored Dec 17, 2024
2 parents 5940760 + 5ccd97e commit b88efde
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package isis_interface_level_passive_test

import (
"fmt"
"net"
"testing"
"time"
Expand All @@ -23,8 +24,10 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/featureprofiles/internal/fptest"
"github.com/openconfig/featureprofiles/internal/helpers"
"github.com/openconfig/featureprofiles/internal/isissession"
"github.com/openconfig/featureprofiles/internal/otgutils"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
"github.com/openconfig/ondatra/gnmi/oc"
"github.com/openconfig/ygot/ygot"
Expand Down Expand Up @@ -99,8 +102,8 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) {
// Interface level configs.
isisIntfLevel2 := intf.GetOrCreateLevel(2)
isisIntfLevel2.LevelNumber = ygot.Uint8(2)
isisIntfLevel2.SetEnabled(true)
isisIntfLevel2.Enabled = ygot.Bool(true)
isisIntfLevel2.Passive = ygot.Bool(true)

isisIntfLevel2.GetOrCreateHelloAuthentication().Enabled = ygot.Bool(true)
isisIntfLevel2.GetHelloAuthentication().AuthPassword = ygot.String(password)
Expand Down Expand Up @@ -170,39 +173,67 @@ func configureOTG(t *testing.T, ts *isissession.TestSession) {
func TestISISLevelPassive(t *testing.T) {
ts := isissession.MustNew(t).WithISIS()
configureISIS(t, ts)

dut := ts.DUT
configureOTG(t, ts)
otg := ts.ATE.OTG()

pcl := ts.DUTConf.GetNetworkInstance(deviations.DefaultNetworkInstance(ts.DUT)).GetProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_ISIS, isissession.ISISName)
fptest.LogQuery(t, "Protocol ISIS", isissession.ProtocolPath(ts.DUT).Config(), pcl)

ts.PushAndStart(t)
time.Sleep(time.Minute * 2)

statePath := isissession.ISISPath(ts.DUT)
intfName := ts.DUTPort1.Name()
if deviations.ExplicitInterfaceInDefaultVRF(ts.DUT) {
intfName += ".0"
}
t.Run("Isis telemetry", func(t *testing.T) {
time.Sleep(time.Minute * 1)
var isispassiveconfig string
t.Run("Passive checks", func(t *testing.T) {
// Passive should be true.
if got := gnmi.Get(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().State()); got != true {
t.Errorf("FAIL- Expected level 2 passive state not found, got %t, want %t", got, true)
if deviations.IsisInterfaceLevelPassiveUnsupported(ts.DUT) {
switch dut.Vendor() {
case ondatra.CISCO:
isispassiveconfig = fmt.Sprintf("router isis DEFAULT\n interface %s\n passive\n", intfName)
default:
t.Fatalf("Unsupported vendor %s for deviation 'IsisInterfaceLevelPassiveUnsupported'", dut.Vendor())
}
helpers.GnmiCLIConfig(t, dut, isispassiveconfig)
} else {
gnmi.Update(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().Config(), true)
}
if !deviations.IsisInterfaceLevelPassiveUnsupported(ts.DUT) {
// Passive should be true.
if got := gnmi.Get(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().State()); got != true {
t.Errorf("FAIL- Expected level 2 passive state not found, got %t, want %t", got, true)
}
}
t.Logf("Adjacency state after passive update is %s", statePath.Interface(intfName).Level(2).AdjacencyAny().AdjacencyState().State())
// Adjacency should be down.
for _, val := range gnmi.LookupAll(t, ts.DUT, statePath.Interface(intfName).LevelAny().AdjacencyAny().AdjacencyState().State()) {
if v, _ := val.Val(); v == oc.Isis_IsisInterfaceAdjState_UP {
t.Fatalf("Adjacency should not be up as level 2 is passive")
}
}
// Updating passive config to false on dut.
gnmi.Update(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().Config(), false)
time.Sleep(time.Second * 5)

if got := gnmi.Get(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().State()); got != false {
t.Errorf("FAIL- Expected level 2 passive state not found, got %t, want %t", got, true)
if deviations.IsisInterfaceLevelPassiveUnsupported(ts.DUT) {
switch dut.Vendor() {
case ondatra.CISCO:
isispassiveconfig = fmt.Sprintf("router isis DEFAULT\n interface %s\n no passive\n", intfName)
default:
t.Fatalf("Unsupported vendor %s for deviation 'IsisInterfaceLevelPassiveUnsupported'", dut.Vendor())
}
helpers.GnmiCLIConfig(t, dut, isispassiveconfig)
} else {
gnmi.Update(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().Config(), false)
}
if !deviations.IsisInterfaceLevelPassiveUnsupported(ts.DUT) {
if got := gnmi.Get(t, ts.DUT, statePath.Interface(intfName).Level(2).Passive().State()); got != false {
t.Errorf("FAIL- Expected level 2 passive state not found, got %t, want %t", got, true)
}
}
t.Logf("Adjacency state after passive update is %s", statePath.Interface(intfName).LevelAny().AdjacencyAny().AdjacencyState().State())
// Level 2 adjacency should be up.
_, err := ts.AwaitAdjacency()
if err != nil {
Expand Down Expand Up @@ -244,8 +275,10 @@ func TestISISLevelPassive(t *testing.T) {
if got := gnmi.Get(t, ts.DUT, adjPath.AreaAddress().State()); !cmp.Equal(got, want, cmpopts.SortSlices(func(a, b string) bool { return a < b })) {
t.Errorf("FAIL- Expected area address not found, got %s, want %s", got, want)
}
if got := gnmi.Get(t, ts.DUT, adjPath.DisSystemId().State()); got != "0000.0000.0000" {
t.Errorf("FAIL- Expected dis system id not found, got %s, want %s", got, "0000.0000.0000")
if !deviations.IsisDisSysidUnsupported(ts.DUT) {
if got := gnmi.Get(t, ts.DUT, adjPath.DisSystemId().State()); got != "0000.0000.0000" {
t.Errorf("FAIL- Expected dis system id not found, got %s, want %s", got, "0000.0000.0000")
}
}
if got := gnmi.Get(t, ts.DUT, adjPath.LocalExtendedCircuitId().State()); got == 0 {
t.Errorf("FAIL- Expected local extended circuit id not found,expected non-zero value, got %d", got)
Expand Down Expand Up @@ -298,8 +331,10 @@ func TestISISLevelPassive(t *testing.T) {
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().CorruptedLsps().State()); got != 0 {
t.Errorf("FAIL- Not expecting any corrupted lsps, got %d, want %d", got, 0)
}
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 {
t.Errorf("FAIL- Not expecting non zero database_overloads, got %d, want %d", got, 0)
if !deviations.IsisDatabaseOverloadsUnsupported(ts.DUT) {
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 {
t.Errorf("FAIL- Not expecting non zero database_overloads, got %d, want %d", got, 0)
}
}
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ExceedMaxSeqNums().State()); got != 0 {
t.Errorf("FAIL- Not expecting non zero max_seqnum counter, got %d, want %d", got, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ platform_exceptions: {
deviations: {
ipv4_missing_enabled: true
isis_interface_level1_disable_required: true
isis_dis_sysid_unsupported: true
isis_database_overloads_unsupported: true
}
}
platform_exceptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ func TestManagementHA1(t *testing.T) {
})

t.Run("traffic received by port1", func(t *testing.T) {
createFlowV6(t, bs)
gnmi.Replace(t, dut, gnmi.OC().Interface(p1.Name()).Enabled().Config(), true)
gnmi.Await(t, dut, gnmi.OC().Interface(p1.Name()).AdminStatus().State(), 30*time.Second, oc.Interface_AdminStatus_UP)
createFlowV6(t, bs)
time.Sleep(30 * time.Second)
bs.ATE.OTG().StartTraffic(t)
time.Sleep(30 * time.Second)
Expand Down
15 changes: 15 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,3 +1243,18 @@ func EnableTableConnections(dut *ondatra.DUTDevice) bool {
func NoZeroSuppression(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetNoZeroSuppression()
}

// IsisInterfaceLevelPassiveUnsupported returns true for devices that do not support passive leaf
func IsisInterfaceLevelPassiveUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetIsisInterfaceLevelPassiveUnsupported()
}

// IsisDisSysidUnsupported returns true for devices that do not support dis-system-id leaf
func IsisDisSysidUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetIsisDisSysidUnsupported()
}

// IsisDatabaseOverloadsUnsupported returns true for devices that do not support database-overloads leaf
func IsisDatabaseOverloadsUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetIsisDatabaseOverloadsUnsupported()
}
6 changes: 6 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ message Metadata {
// Device has default zero suppression.
// Juniper : b/378646018
bool no_zero_suppression = 237;
// Cisco: b/378801305
bool isis_interface_level_passive_unsupported = 238;
// Cisco: b/378616912
bool isis_dis_sysid_unsupported = 239;
// Cisco: b/378616912
bool isis_database_overloads_unsupported = 240;
// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
Loading

0 comments on commit b88efde

Please sign in to comment.