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

fixing isis_interface_level_passive_test with deviation #3653

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
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 @@ -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
15 changes: 15 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@
return lookupDUTDeviations(dut).GetBgpAfiSafiWildcardNotSupported()
}

// Admin Enable Table Connections in SRL native

Check failure on line 1237 in internal/deviations/deviations.go

View workflow job for this annotation

GitHub Actions / Static Analysis

comment on exported function EnableTableConnections should be of the form "EnableTableConnections ..."
func EnableTableConnections(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEnableTableConnections()
}
Expand All @@ -1243,3 +1243,18 @@
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
Loading