From 5719862adb63923716b492a27e8a538ec86854b5 Mon Sep 17 00:00:00 2001 From: Karthikeya Remilla Date: Wed, 25 Sep 2024 21:30:18 +0530 Subject: [PATCH 1/8] Cisco transceiver part 2: deviations (#3451) * cisco transceiver changes part 2 * cisco transceiver changes part 2 * variable name change * PR errors' fix * PR errors' fix --- .../zr_inventory_test/metadata.textproto | 8 ++ .../zr_inventory_test/zr_inventory_test.go | 6 +- .../zr_supply_voltage_test.go | 4 +- .../zr_temperature_test/metadata.textproto | 8 ++ .../zr_temperature_test.go | 91 ++++++------- internal/deviations/deviations.go | 10 ++ proto/metadata.proto | 4 + proto/metadata_go_proto/metadata.pb.go | 125 +++++++++++------- 8 files changed, 153 insertions(+), 103 deletions(-) diff --git a/feature/platform/transceiver/tests/zr_inventory_test/metadata.textproto b/feature/platform/transceiver/tests/zr_inventory_test/metadata.textproto index 02b3b95028f..c6eefbc266e 100644 --- a/feature/platform/transceiver/tests/zr_inventory_test/metadata.textproto +++ b/feature/platform/transceiver/tests/zr_inventory_test/metadata.textproto @@ -13,3 +13,11 @@ platform_exceptions: { missing_port_to_optical_channel_component_mapping: true } } +platform_exceptions: { + platform: { + vendor: CISCO + } + deviations: { + component_mfg_date_unsupported: true + } +} \ No newline at end of file diff --git a/feature/platform/transceiver/tests/zr_inventory_test/zr_inventory_test.go b/feature/platform/transceiver/tests/zr_inventory_test/zr_inventory_test.go index 66703f9a251..0d99c348697 100644 --- a/feature/platform/transceiver/tests/zr_inventory_test/zr_inventory_test.go +++ b/feature/platform/transceiver/tests/zr_inventory_test/zr_inventory_test.go @@ -5,6 +5,7 @@ import ( "time" "github.com/openconfig/featureprofiles/internal/cfgplugins" + "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" "github.com/openconfig/featureprofiles/internal/samplestream" "github.com/openconfig/ondatra" @@ -13,7 +14,6 @@ import ( ) const ( - dp16QAM = 1 samplingInterval = 10 * time.Second timeout = 5 * time.Minute waitInterval = 30 * time.Second @@ -81,11 +81,13 @@ func TestInventory(t *testing.T) { samplestream.New(t, dut, component1.SerialNo().State(), samplingInterval), samplestream.New(t, dut, component1.PartNo().State(), samplingInterval), samplestream.New(t, dut, component1.MfgName().State(), samplingInterval), - samplestream.New(t, dut, component1.MfgDate().State(), samplingInterval), samplestream.New(t, dut, component1.HardwareVersion().State(), samplingInterval), samplestream.New(t, dut, component1.FirmwareVersion().State(), samplingInterval), // samplestream.New(t, dut1, component1.Description().State(), samplingInterval), ) + if !deviations.ComponentMfgDateUnsupported(dut) { + p1StreamsStr = append(p1StreamsStr, samplestream.New(t, dut, component1.MfgDate().State(), samplingInterval)) + } p1StreamsUnion = append(p1StreamsUnion, samplestream.New(t, dut, component1.Type().State(), samplingInterval)) verifyAllInventoryValues(t, p1StreamsStr, p1StreamsUnion) diff --git a/feature/platform/transceiver/tests/zr_supply_voltage_test/zr_supply_voltage_test.go b/feature/platform/transceiver/tests/zr_supply_voltage_test/zr_supply_voltage_test.go index c05b29aae9f..3fc74a0e274 100644 --- a/feature/platform/transceiver/tests/zr_supply_voltage_test/zr_supply_voltage_test.go +++ b/feature/platform/transceiver/tests/zr_supply_voltage_test/zr_supply_voltage_test.go @@ -83,7 +83,7 @@ func TestZrSupplyVoltage(t *testing.T) { // Disable interface i.Enabled = ygot.Bool(false) gnmi.Replace(t, dut, gnmi.OC().Interface(dp.Name()).Config(), i) - // Wait for the cooling off period + // Wait for the cooling-off period gnmi.Await(t, dut, gnmi.OC().Interface(dp.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_DOWN) volInstNew := verifyVoltageValue(t, streamInst, "Instant") @@ -92,7 +92,7 @@ func TestZrSupplyVoltage(t *testing.T) { // Enable interface again. i.Enabled = ygot.Bool(true) gnmi.Replace(t, dut, gnmi.OC().Interface(dp.Name()).Config(), i) - // Wait for the cooling off period + // Wait for the cooling-off period gnmi.Await(t, dut, gnmi.OC().Interface(dp.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP) }) } diff --git a/feature/platform/transceiver/tests/zr_temperature_test/metadata.textproto b/feature/platform/transceiver/tests/zr_temperature_test/metadata.textproto index cf055bacbc7..73787e4b97c 100644 --- a/feature/platform/transceiver/tests/zr_temperature_test/metadata.textproto +++ b/feature/platform/transceiver/tests/zr_temperature_test/metadata.textproto @@ -16,3 +16,11 @@ platform_exceptions: { missing_zr_optical_channel_tunable_parameters_telemetry: true } } +platform_exceptions: { + platform: { + vendor: CISCO + } + deviations: { + use_parent_component_for_temperature_telemetry: true + } +} \ No newline at end of file diff --git a/feature/platform/transceiver/tests/zr_temperature_test/zr_temperature_test.go b/feature/platform/transceiver/tests/zr_temperature_test/zr_temperature_test.go index d23599054c9..38f3c3f133a 100644 --- a/feature/platform/transceiver/tests/zr_temperature_test/zr_temperature_test.go +++ b/feature/platform/transceiver/tests/zr_temperature_test/zr_temperature_test.go @@ -19,7 +19,7 @@ import ( "testing" "time" - "github.com/openconfig/featureprofiles/internal/components" + "github.com/openconfig/featureprofiles/internal/cfgplugins" "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" "github.com/openconfig/featureprofiles/internal/samplestream" @@ -30,10 +30,7 @@ import ( ) const ( - sensorType = oc.PlatformTypes_OPENCONFIG_HARDWARE_COMPONENT_SENSOR - dp16QAM = 1 - targetOutputPower = -10 - frequency = 193500000 + sensorType = oc.PlatformTypes_OPENCONFIG_HARDWARE_COMPONENT_SENSOR ) func TestMain(m *testing.M) { @@ -44,19 +41,6 @@ func TestMain(m *testing.M) { // // dut:port1 <--> port2:dut -func interfaceConfig(t *testing.T, dut1 *ondatra.DUTDevice, dp *ondatra.Port) { - d := &oc.Root{} - i := d.GetOrCreateInterface(dp.Name()) - i.Enabled = ygot.Bool(true) - i.Type = oc.IETFInterfaces_InterfaceType_ethernetCsmacd - gnmi.Replace(t, dut1, gnmi.OC().Interface(dp.Name()).Config(), i) - OCcomponent := components.OpticalChannelComponentFromPort(t, dut1, dp) - gnmi.Replace(t, dut1, gnmi.OC().Component(OCcomponent).OpticalChannel().Config(), &oc.Component_OpticalChannel{ - TargetOutputPower: ygot.Float64(targetOutputPower), - Frequency: ygot.Uint64(frequency), - }) -} - func verifyTemperatureSensorValue(t *testing.T, pStream *samplestream.SampleStream[float64], sensorName string) float64 { temperatureSample := pStream.Next() if temperatureSample == nil { @@ -83,37 +67,39 @@ func TestZRTemperatureState(t *testing.T) { t.Logf("dut1: %v", dut1) t.Logf("dut1 dp1 name: %v", dp1.Name()) intUpdateTime := 2 * time.Minute - interfaceConfig(t, dut1, dp1) - interfaceConfig(t, dut1, dp2) + cfgplugins.InterfaceConfig(t, dut1, dp1) + cfgplugins.InterfaceConfig(t, dut1, dp2) gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP) transceiverName := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State()) // Check if TRANSCEIVER is of type 400ZR if dp1.PMD() != ondatra.PMD400GBASEZR { t.Fatalf("%s Transceiver is not 400ZR its of type: %v", transceiverName, dp1.PMD()) } - component1 := gnmi.OC().Component(transceiverName) - subcomponents := gnmi.LookupAll[*oc.Component_Subcomponent](t, dut1, component1.SubcomponentAny().State()) - for _, s := range subcomponents { - subc, ok := s.Val() - if ok { - sensorComponent := gnmi.Get[*oc.Component](t, dut1, gnmi.OC().Component(subc.GetName()).State()) - if sensorComponent.GetType() == sensorType { - scomponent := gnmi.OC().Component(sensorComponent.GetName()) - if scomponent != nil { - component1 = scomponent + compWithTemperature := gnmi.OC().Component(transceiverName) + if !deviations.UseParentComponentForTemperatureTelemetry(dut1) { + subcomponents := gnmi.LookupAll[*oc.Component_Subcomponent](t, dut1, compWithTemperature.SubcomponentAny().State()) + for _, s := range subcomponents { + subc, ok := s.Val() + if ok { + sensorComponent := gnmi.Get[*oc.Component](t, dut1, gnmi.OC().Component(subc.GetName()).State()) + if sensorComponent.GetType() == sensorType { + scomponent := gnmi.OC().Component(sensorComponent.GetName()) + if scomponent != nil { + compWithTemperature = scomponent + } } } } } - p1StreamInstant := samplestream.New(t, dut1, component1.Temperature().Instant().State(), 10*time.Second) + p1StreamInstant := samplestream.New(t, dut1, compWithTemperature.Temperature().Instant().State(), 10*time.Second) temperatureInstant := verifyTemperatureSensorValue(t, p1StreamInstant, "Instant") t.Logf("Port1 dut1 %s Instant Temperature: %v", dp1.Name(), temperatureInstant) if deviations.MissingZROpticalChannelTunableParametersTelemetry(dut1) { t.Log("Skipping Min/Max/Avg Tunable Parameters Telemetry validation. Deviation MissingZROpticalChannelTunableParametersTelemetry enabled.") } else { - p1StreamAvg := samplestream.New(t, dut1, component1.Temperature().Avg().State(), 10*time.Second) - p1StreamMin := samplestream.New(t, dut1, component1.Temperature().Min().State(), 10*time.Second) - p1StreamMax := samplestream.New(t, dut1, component1.Temperature().Max().State(), 10*time.Second) + p1StreamAvg := samplestream.New(t, dut1, compWithTemperature.Temperature().Avg().State(), 10*time.Second) + p1StreamMin := samplestream.New(t, dut1, compWithTemperature.Temperature().Min().State(), 10*time.Second) + p1StreamMax := samplestream.New(t, dut1, compWithTemperature.Temperature().Max().State(), 10*time.Second) temperatureMax := verifyTemperatureSensorValue(t, p1StreamMax, "Max") t.Logf("Port1 dut1 %s Max Temperature: %v", dp1.Name(), temperatureMax) @@ -139,8 +125,8 @@ func TestZRTemperatureStateInterfaceFlap(t *testing.T) { dp2 := dut1.Port(t, "port2") t.Logf("dut1: %v", dut1) t.Logf("dut1 dp1 name: %v", dp1.Name()) - interfaceConfig(t, dut1, dp1) - interfaceConfig(t, dut1, dp2) + cfgplugins.InterfaceConfig(t, dut1, dp1) + cfgplugins.InterfaceConfig(t, dut1, dp2) intUpdateTime := 2 * time.Minute gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP) transceiverName := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State()) @@ -152,26 +138,29 @@ func TestZRTemperatureStateInterfaceFlap(t *testing.T) { d := &oc.Root{} i := d.GetOrCreateInterface(dp1.Name()) i.Enabled = ygot.Bool(false) + i.Type = oc.IETFInterfaces_InterfaceType_ethernetCsmacd gnmi.Replace(t, dut1, gnmi.OC().Interface(dp1.Name()).Config(), i) - component1 := gnmi.OC().Component(transceiverName) - subcomponents := gnmi.LookupAll[*oc.Component_Subcomponent](t, dut1, component1.SubcomponentAny().State()) - for _, s := range subcomponents { - subc, ok := s.Val() - if ok { - sensorComponent := gnmi.Get[*oc.Component](t, dut1, gnmi.OC().Component(subc.GetName()).State()) - if sensorComponent.GetType() == sensorType { - scomponent := gnmi.OC().Component(sensorComponent.GetName()) - if scomponent != nil { - component1 = scomponent + compWithTemperature := gnmi.OC().Component(transceiverName) + if !deviations.UseParentComponentForTemperatureTelemetry(dut1) { + subcomponents := gnmi.LookupAll[*oc.Component_Subcomponent](t, dut1, compWithTemperature.SubcomponentAny().State()) + for _, s := range subcomponents { + subc, ok := s.Val() + if ok { + sensorComponent := gnmi.Get[*oc.Component](t, dut1, gnmi.OC().Component(subc.GetName()).State()) + if sensorComponent.GetType() == sensorType { + scomponent := gnmi.OC().Component(sensorComponent.GetName()) + if scomponent != nil { + compWithTemperature = scomponent + } } } } } - p1StreamInstant := samplestream.New(t, dut1, component1.Temperature().Instant().State(), 10*time.Second) - p1StreamAvg := samplestream.New(t, dut1, component1.Temperature().Avg().State(), 10*time.Second) - p1StreamMin := samplestream.New(t, dut1, component1.Temperature().Min().State(), 10*time.Second) - p1StreamMax := samplestream.New(t, dut1, component1.Temperature().Max().State(), 10*time.Second) - // Wait 120 sec cooling off period + p1StreamInstant := samplestream.New(t, dut1, compWithTemperature.Temperature().Instant().State(), 10*time.Second) + p1StreamAvg := samplestream.New(t, dut1, compWithTemperature.Temperature().Avg().State(), 10*time.Second) + p1StreamMin := samplestream.New(t, dut1, compWithTemperature.Temperature().Min().State(), 10*time.Second) + p1StreamMax := samplestream.New(t, dut1, compWithTemperature.Temperature().Max().State(), 10*time.Second) + // Wait 120 sec cooling-off period gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_DOWN) temperatureInstant := verifyTemperatureSensorValue(t, p1StreamInstant, "Instant") t.Logf("Port1 dut1 %s Instant Temperature: %v", dp1.Name(), temperatureInstant) diff --git a/internal/deviations/deviations.go b/internal/deviations/deviations.go index db3440bdd75..43895c6ef5e 100644 --- a/internal/deviations/deviations.go +++ b/internal/deviations/deviations.go @@ -1140,3 +1140,13 @@ func SflowSourceAddressUpdateUnsupported(dut *ondatra.DUTDevice) bool { func LinkLocalMaskLen(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetLinkLocalMaskLen() } + +// UseParentComponentForTemperatureTelemetry returns true if parent component supports temperature telemetry +func UseParentComponentForTemperatureTelemetry(dut *ondatra.DUTDevice) bool { + return lookupDUTDeviations(dut).GetUseParentComponentForTemperatureTelemetry() +} + +// ComponentMfgDateUnsupported returns true if component's mfg-date leaf is unsupported +func ComponentMfgDateUnsupported(dut *ondatra.DUTDevice) bool { + return lookupDUTDeviations(dut).GetComponentMfgDateUnsupported() +} diff --git a/proto/metadata.proto b/proto/metadata.proto index c8bcff28025..25ea4d71cc6 100644 --- a/proto/metadata.proto +++ b/proto/metadata.proto @@ -611,6 +611,10 @@ message Metadata { // Linklocal mask length is not 64 // Cisco: b/368271859 bool link_local_mask_len = 218; + // use parent component for temperature telemetry + bool use_parent_component_for_temperature_telemetry = 219; + // component manufactured date is unsupported + bool component_mfg_date_unsupported = 220; // Reserved field numbers and identifiers. reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173; } diff --git a/proto/metadata_go_proto/metadata.pb.go b/proto/metadata_go_proto/metadata.pb.go index b26206a2edc..74bd44e8e0b 100644 --- a/proto/metadata_go_proto/metadata.pb.go +++ b/proto/metadata_go_proto/metadata.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v3.21.12 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: metadata.proto package metadata_go_proto @@ -893,6 +893,10 @@ type Metadata_Deviations struct { // Linklocal mask length is not 64 // Cisco: b/368271859 LinkLocalMaskLen bool `protobuf:"varint,218,opt,name=link_local_mask_len,json=linkLocalMaskLen,proto3" json:"link_local_mask_len,omitempty"` + // use parent component for temperature telemetry + UseParentComponentForTemperatureTelemetry bool `protobuf:"varint,219,opt,name=use_parent_component_for_temperature_telemetry,json=useParentComponentForTemperatureTelemetry,proto3" json:"use_parent_component_for_temperature_telemetry,omitempty"` + // component manufactured date is unsupported + ComponentMfgDateUnsupported bool `protobuf:"varint,220,opt,name=component_mfg_date_unsupported,json=componentMfgDateUnsupported,proto3" json:"component_mfg_date_unsupported,omitempty"` } func (x *Metadata_Deviations) Reset() { @@ -2306,6 +2310,20 @@ func (x *Metadata_Deviations) GetLinkLocalMaskLen() bool { return false } +func (x *Metadata_Deviations) GetUseParentComponentForTemperatureTelemetry() bool { + if x != nil { + return x.UseParentComponentForTemperatureTelemetry + } + return false +} + +func (x *Metadata_Deviations) GetComponentMfgDateUnsupported() bool { + if x != nil { + return x.ComponentMfgDateUnsupported + } + return false +} + type Metadata_PlatformExceptions struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2369,7 +2387,7 @@ var file_metadata_proto_rawDesc = []byte{ 0x74, 0x69, 0x6e, 0x67, 0x1a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x72, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x65, - 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc8, 0x7a, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x7b, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, @@ -2403,7 +2421,7 @@ var file_metadata_proto_rawDesc = []byte{ 0x67, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x0e, 0x68, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x5f, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x1a, 0x9b, 0x72, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x1a, 0xc5, 0x73, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x69, 0x70, 0x76, 0x34, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x70, 0x76, 0x34, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x45, @@ -3312,45 +3330,56 @@ var file_metadata_proto_rawDesc = []byte{ 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0xda, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x6c, 0x69, 0x6e, 0x6b, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x61, 0x73, 0x6b, - 0x4c, 0x65, 0x6e, 0x4a, 0x04, 0x08, 0x54, 0x10, 0x55, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x4a, - 0x04, 0x08, 0x1c, 0x10, 0x1d, 0x4a, 0x04, 0x08, 0x14, 0x10, 0x15, 0x4a, 0x04, 0x08, 0x5a, 0x10, - 0x5b, 0x4a, 0x04, 0x08, 0x61, 0x10, 0x62, 0x4a, 0x04, 0x08, 0x37, 0x10, 0x38, 0x4a, 0x04, 0x08, - 0x59, 0x10, 0x5a, 0x4a, 0x04, 0x08, 0x13, 0x10, 0x14, 0x4a, 0x04, 0x08, 0x24, 0x10, 0x25, 0x4a, - 0x04, 0x08, 0x23, 0x10, 0x24, 0x4a, 0x04, 0x08, 0x28, 0x10, 0x29, 0x4a, 0x06, 0x08, 0xad, 0x01, - 0x10, 0xae, 0x01, 0x1a, 0xa0, 0x01, 0x0a, 0x12, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, - 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x08, 0x70, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, - 0x6f, 0x72, 0x6d, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x47, 0x0a, - 0x0a, 0x64, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xfa, 0x01, 0x0a, 0x07, 0x54, 0x65, 0x73, 0x74, 0x62, - 0x65, 0x64, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x54, - 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, - 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x44, 0x55, 0x54, 0x5f, - 0x34, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x45, 0x53, 0x54, - 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, 0x45, 0x5f, 0x32, 0x4c, 0x49, 0x4e, - 0x4b, 0x53, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, - 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, 0x45, 0x5f, 0x34, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x04, - 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, - 0x41, 0x54, 0x45, 0x5f, 0x39, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x5f, 0x4c, 0x41, 0x47, 0x10, 0x05, - 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, - 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, 0x45, 0x5f, 0x32, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x06, - 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, - 0x41, 0x54, 0x45, 0x5f, 0x38, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x07, 0x12, 0x15, 0x0a, 0x11, - 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x34, 0x30, 0x30, 0x5a, - 0x52, 0x10, 0x08, 0x22, 0x6d, 0x0a, 0x04, 0x54, 0x61, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x54, - 0x41, 0x47, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x47, 0x53, 0x5f, 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x41, 0x47, 0x53, 0x5f, - 0x44, 0x41, 0x54, 0x41, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x45, 0x44, 0x47, 0x45, 0x10, - 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x41, 0x47, 0x53, 0x5f, 0x45, 0x44, 0x47, 0x45, 0x10, 0x03, - 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x41, 0x47, 0x53, 0x5f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x49, 0x54, - 0x10, 0x04, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4c, 0x65, 0x6e, 0x12, 0x62, 0x0a, 0x2e, 0x75, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x5f, + 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x74, 0x65, 0x6c, 0x65, + 0x6d, 0x65, 0x74, 0x72, 0x79, 0x18, 0xdb, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x29, 0x75, 0x73, + 0x65, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x46, 0x6f, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x12, 0x44, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x66, 0x67, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x75, 0x6e, + 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0xdc, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x1b, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x4d, 0x66, 0x67, 0x44, 0x61, + 0x74, 0x65, 0x55, 0x6e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x4a, 0x04, 0x08, + 0x54, 0x10, 0x55, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x1c, 0x10, 0x1d, 0x4a, + 0x04, 0x08, 0x14, 0x10, 0x15, 0x4a, 0x04, 0x08, 0x5a, 0x10, 0x5b, 0x4a, 0x04, 0x08, 0x61, 0x10, + 0x62, 0x4a, 0x04, 0x08, 0x37, 0x10, 0x38, 0x4a, 0x04, 0x08, 0x59, 0x10, 0x5a, 0x4a, 0x04, 0x08, + 0x13, 0x10, 0x14, 0x4a, 0x04, 0x08, 0x24, 0x10, 0x25, 0x4a, 0x04, 0x08, 0x23, 0x10, 0x24, 0x4a, + 0x04, 0x08, 0x28, 0x10, 0x29, 0x4a, 0x06, 0x08, 0xad, 0x01, 0x10, 0xae, 0x01, 0x1a, 0xa0, 0x01, + 0x0a, 0x12, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x08, 0x70, + 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x47, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, + 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0xfa, 0x01, 0x0a, 0x07, 0x54, 0x65, 0x73, 0x74, 0x62, 0x65, 0x64, 0x12, 0x17, 0x0a, 0x13, + 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, + 0x5f, 0x44, 0x55, 0x54, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, + 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x34, 0x4c, 0x49, 0x4e, 0x4b, 0x53, + 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, + 0x54, 0x5f, 0x41, 0x54, 0x45, 0x5f, 0x32, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x03, 0x12, 0x1a, + 0x0a, 0x16, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, + 0x45, 0x5f, 0x34, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x04, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x45, + 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, 0x45, 0x5f, 0x39, 0x4c, + 0x49, 0x4e, 0x4b, 0x53, 0x5f, 0x4c, 0x41, 0x47, 0x10, 0x05, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x45, + 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, + 0x45, 0x5f, 0x32, 0x4c, 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x45, + 0x53, 0x54, 0x42, 0x45, 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x41, 0x54, 0x45, 0x5f, 0x38, 0x4c, + 0x49, 0x4e, 0x4b, 0x53, 0x10, 0x07, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x45, 0x53, 0x54, 0x42, 0x45, + 0x44, 0x5f, 0x44, 0x55, 0x54, 0x5f, 0x34, 0x30, 0x30, 0x5a, 0x52, 0x10, 0x08, 0x22, 0x6d, 0x0a, + 0x04, 0x54, 0x61, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x47, 0x53, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, + 0x41, 0x47, 0x53, 0x5f, 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, + 0x01, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x41, 0x47, 0x53, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x43, 0x45, + 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x45, 0x44, 0x47, 0x45, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x54, + 0x41, 0x47, 0x53, 0x5f, 0x45, 0x44, 0x47, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x41, + 0x47, 0x53, 0x5f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x49, 0x54, 0x10, 0x04, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3367,7 +3396,7 @@ func file_metadata_proto_rawDescGZIP() []byte { var file_metadata_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_metadata_proto_goTypes = []interface{}{ +var file_metadata_proto_goTypes = []any{ (Metadata_Testbed)(0), // 0: openconfig.testing.Metadata.Testbed (Metadata_Tags)(0), // 1: openconfig.testing.Metadata.Tags (*Metadata)(nil), // 2: openconfig.testing.Metadata @@ -3396,7 +3425,7 @@ func file_metadata_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_metadata_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Metadata); i { case 0: return &v.state @@ -3408,7 +3437,7 @@ func file_metadata_proto_init() { return nil } } - file_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_metadata_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Metadata_Platform); i { case 0: return &v.state @@ -3420,7 +3449,7 @@ func file_metadata_proto_init() { return nil } } - file_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_metadata_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Metadata_Deviations); i { case 0: return &v.state @@ -3432,7 +3461,7 @@ func file_metadata_proto_init() { return nil } } - file_metadata_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_metadata_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Metadata_PlatformExceptions); i { case 0: return &v.state From 10c8fe3c28246864885ef1469304a2b690183e5a Mon Sep 17 00:00:00 2001 From: sachendras <44847441+sachendras@users.noreply.github.com> Date: Thu, 26 Sep 2024 07:47:27 -0700 Subject: [PATCH 2/8] Update testregistry.textproto (#3459) Creating a new test for ERR --- testregistry.textproto | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testregistry.textproto b/testregistry.textproto index f1a44b514a3..7d59c29dc3b 100644 --- a/testregistry.textproto +++ b/testregistry.textproto @@ -581,6 +581,12 @@ test: { readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/bgp/admin_distance/README.md" exec: " " } +test: { + id: "RT-1.35" + description: "Extended routes retention" + readme: "" + exec: " " +} test: { id: "RT-1.51" description: "BGP multipath ECMP" From 0257e85a913f09e2c3e7a736f9a62dc5b662b91b Mon Sep 17 00:00:00 2001 From: Dan Ameme Date: Thu, 26 Sep 2024 12:41:08 -0700 Subject: [PATCH 3/8] Creating a new test for Static GUE encapsulation to IPv4 tunnel (#3461) --- testregistry.textproto | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testregistry.textproto b/testregistry.textproto index 7d59c29dc3b..a5b0dba0913 100644 --- a/testregistry.textproto +++ b/testregistry.textproto @@ -390,6 +390,12 @@ test: { readme: "https://github.com/openconfig/featureprofiles/blob/main/feature/policy_forwarding/encapsulation/otg_tests/encap_gre_ipv4/README.md" exec: " " } +test: { + id: "PF-1.3" + description: "Policy-based Static GUE Encapsulation to IPv4 tunnel" + readme: " " + exec: " " +} test: { id: "PLT-1.1" description: "Interface breakout Test" From 78a0fc03996bf07cf6492d8fb893637c0c5c2fcd Mon Sep 17 00:00:00 2001 From: daveruturaj Date: Thu, 26 Sep 2024 17:34:59 -0700 Subject: [PATCH 4/8] Update testregistry.textproto (#3464) Updated testregistry to include the Test cases for - Interface based GUE Decapsulation to IPv4 tunnel - Interface based MPLSoGUE Decapsulation to IPv4 tunnel --- testregistry.textproto | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testregistry.textproto b/testregistry.textproto index a5b0dba0913..533758476f2 100644 --- a/testregistry.textproto +++ b/testregistry.textproto @@ -396,6 +396,18 @@ test: { readme: " " exec: " " } +test: { + id: "PF-1.4" + description: "Interface based GUE Decapsulation to IPv4 tunnel" + readme: " " + exec: " " +} +test: { + id: "PF-1.5" + description: "Interface based MPLSoGUE Decapsulation to IPv4 tunnel" + readme: " " + exec: " " +} test: { id: "PLT-1.1" description: "Interface breakout Test" From 9a1f5a542a31badd48875372cb1522c662cb8052 Mon Sep 17 00:00:00 2001 From: Ram Date: Fri, 27 Sep 2024 10:08:56 +0530 Subject: [PATCH 5/8] fix network instance (#3332) * fix network instance * fixed vet errors --- .../gribi/otg_tests/static_lsp_test/static_lsp_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/feature/gribi/otg_tests/static_lsp_test/static_lsp_test.go b/feature/gribi/otg_tests/static_lsp_test/static_lsp_test.go index 712f8ebed32..46ad3a5a7c1 100644 --- a/feature/gribi/otg_tests/static_lsp_test/static_lsp_test.go +++ b/feature/gribi/otg_tests/static_lsp_test/static_lsp_test.go @@ -142,14 +142,18 @@ func configureOTG(t *testing.T) gosnappi.Config { // configureStaticLSP configures a static MPLS LSP with the provided parameters. func configureStaticLSP(t *testing.T, dut *ondatra.DUTDevice, lspName string, incomingLabel uint32, nextHopIP string) { d := &oc.Root{} - mplsCfg := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut)).GetOrCreateMpls() + dni := deviations.DefaultNetworkInstance(dut) + defPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)) + gnmi.Update(t, dut, defPath.Config(), &oc.NetworkInstance{ + Name: ygot.String(deviations.DefaultNetworkInstance(dut)), + Type: oc.NetworkInstanceTypes_NETWORK_INSTANCE_TYPE_DEFAULT_INSTANCE, + }) + mplsCfg := d.GetOrCreateNetworkInstance(dni).GetOrCreateMpls() staticMplsCfg := mplsCfg.GetOrCreateLsps().GetOrCreateStaticLsp(lspName) staticMplsCfg.GetOrCreateEgress().SetIncomingLabel(oc.UnionUint32(incomingLabel)) staticMplsCfg.GetOrCreateEgress().SetNextHop(nextHopIP) staticMplsCfg.GetOrCreateEgress().SetPushLabel(oc.Egress_PushLabel_IMPLICIT_NULL) - gnmi.Update(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Mpls().Config(), mplsCfg) - } func createTrafficFlow(t *testing.T, From 311915d7f0574eec764147e99f196e837e79a00f Mon Sep 17 00:00:00 2001 From: divyarema <134387379+divyarema@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:57:58 +0530 Subject: [PATCH 6/8] Modifications to RT2.13- Weighted-ECMP for IS-IS (#3074) * modifications to isisRT2.13 * modifications to RT2.13 * cosmetic change * rectifying gofmt error --- .../weighted_ecmp_test/metadata.textproto | 8 ++ .../weighted_ecmp_test/weighted_ecmp_test.go | 90 +++++++------------ 2 files changed, 40 insertions(+), 58 deletions(-) diff --git a/feature/isis/otg_tests/weighted_ecmp_test/metadata.textproto b/feature/isis/otg_tests/weighted_ecmp_test/metadata.textproto index 8057787e787..947afd21cf8 100644 --- a/feature/isis/otg_tests/weighted_ecmp_test/metadata.textproto +++ b/feature/isis/otg_tests/weighted_ecmp_test/metadata.textproto @@ -35,3 +35,11 @@ platform_exceptions: { weighted_ecmp_fixed_packet_verification: true } } +platform_exceptions: { + platform: { + vendor: JUNIPER + } + deviations: { + isis_level_enabled: true + } +} diff --git a/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go b/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go index 9e434f24e2a..ce6638892c2 100644 --- a/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go +++ b/feature/isis/otg_tests/weighted_ecmp_test/weighted_ecmp_test.go @@ -9,7 +9,6 @@ import ( "github.com/open-traffic-generator/snappi/gosnappi" "github.com/openconfig/featureprofiles/internal/attrs" - "github.com/openconfig/featureprofiles/internal/cfgplugins" "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" "github.com/openconfig/featureprofiles/internal/helpers" @@ -104,8 +103,8 @@ var ( agg4 = &aggPortData{ dutIPv4: "192.0.2.13", ateIPv4: "192.0.2.14", - dutIPv6: "2001:db8::14", - ateIPv6: "2001:db8::15", + dutIPv6: "2001:db8::15", + ateIPv6: "2001:db8::16", ateAggName: "lag4", ateAggMAC: "02:00:01:01:01:10", atePort1MAC: "02:00:01:01:01:11", @@ -174,12 +173,33 @@ func TestWeightedECMPForISIS(t *testing.T) { ate.OTG().PushConfig(t, top) ate.OTG().StartProtocols(t) VerifyISISTelemetry(t, dut, aggIDs, []*aggPortData{agg1, agg2}) + for _, agg := range []*aggPortData{agg1, agg2} { bgpPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp() gnmi.Await(t, dut, bgpPath.Neighbor(agg.ateLoopbackV4).SessionState().State(), 2*time.Minute, oc.Bgp_Neighbor_SessionState_ESTABLISHED) gnmi.Await(t, dut, bgpPath.Neighbor(agg.ateLoopbackV6).SessionState().State(), 2*time.Minute, oc.Bgp_Neighbor_SessionState_ESTABLISHED) } + statePath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp() + + t.Log("Waiting for BGP v4 prefix to be installed") + got, found := gnmi.Watch(t, dut, statePath.Neighbor(agg2.ateLoopbackV4).AfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Prefixes().Installed().State(), 120*time.Second, func(val *ygnmi.Value[uint32]) bool { + prefixCount, ok := val.Val() + return ok && prefixCount == 1 + }).Await(t) + if !found { + t.Fatalf("Installed prefixes v4 mismatch: got %v, want %v", got, 1) + } + + t.Log("Waiting for BGP v6 prefix to be installed") + got, found = gnmi.Watch(t, dut, statePath.Neighbor(agg2.ateLoopbackV6).AfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST).Prefixes().Installed().State(), 120*time.Second, func(val *ygnmi.Value[uint32]) bool { + prefixCount, ok := val.Val() + return ok && prefixCount == 1 + }).Await(t) + if !found { + t.Fatalf("Installed prefixes v6 mismatch: got %v, want %v", got, 1) + } + startTraffic(t, ate, top) time.Sleep(time.Minute) t.Run("Equal_Distribution_Of_Traffic", func(t *testing.T) { @@ -427,7 +447,6 @@ func configureOTGBGP(t *testing.T, dev gosnappi.Device, agg *aggPortData, advV4, func configureOTGISIS(t *testing.T, dev gosnappi.Device, agg *aggPortData) { t.Helper() - dut := ondatra.DUT(t, "dut") isis := dev.Isis().SetSystemId(agg.ateISISSysID).SetName(agg.ateAggName + ".ISIS") isis.Basic().SetHostname(isis.Name()) isis.Advanced().SetAreaAddresses([]string{ateAreaAddress}) @@ -437,13 +456,12 @@ func configureOTGISIS(t *testing.T, dev gosnappi.Device, agg *aggPortData) { SetNetworkType(gosnappi.IsisInterfaceNetworkType.POINT_TO_POINT). SetLevelType(gosnappi.IsisInterfaceLevelType.LEVEL_2).SetMetric(10) isisInt.Advanced().SetAutoAdjustMtu(true).SetAutoAdjustArea(true).SetAutoAdjustSupportedProtocols(true) - if deviations.ISISLoopbackRequired(dut) { - // configure ISIS loopback interface and advertise them via ISIS. - isisPort2V4 := dev.Isis().V4Routes().Add().SetName(agg.ateAggName + ".ISISV4").SetLinkMetric(10) - isisPort2V4.Addresses().Add().SetAddress(agg.ateLoopbackV4).SetPrefix(32) - isisPort2V6 := dev.Isis().V6Routes().Add().SetName(agg.ateAggName + ".ISISV6").SetLinkMetric(10) - isisPort2V6.Addresses().Add().SetAddress(agg.ateLoopbackV6).SetPrefix(uint32(128)) - } + + // configure ISIS loopback interface and advertise them via ISIS. + isisPort2V4 := dev.Isis().V4Routes().Add().SetName(agg.ateAggName + ".ISISV4").SetLinkMetric(10) + isisPort2V4.Addresses().Add().SetAddress(agg.ateLoopbackV4).SetPrefix(32) + isisPort2V6 := dev.Isis().V6Routes().Add().SetName(agg.ateAggName + ".ISISV6").SetLinkMetric(10) + isisPort2V6.Addresses().Add().SetAddress(agg.ateLoopbackV6).SetPrefix(uint32(128)) } @@ -514,9 +532,6 @@ func configureDUT(t *testing.T, dut *ondatra.DUTDevice) []string { for _, aggID := range aggIDs { gnmi.Await(t, dut, gnmi.OC().Interface(aggID).AdminStatus().State(), 60*time.Second, oc.Interface_AdminStatus_UP) } - if !deviations.ISISLoopbackRequired(dut) { - configureStaticRouteToATELoopbacks(t, dut) - } configureRoutingPolicy(t, dut) configureDUTISIS(t, dut, aggIDs) configureDUTBGP(t, dut) @@ -563,50 +578,6 @@ func configureDUTLoopback(t *testing.T, dut *ondatra.DUTDevice) { } } -func configureStaticRouteToATELoopbacks(t *testing.T, dut *ondatra.DUTDevice) { - t.Helper() - - sr4ATE1 := &cfgplugins.StaticRouteCfg{ - NetworkInstance: deviations.DefaultNetworkInstance(dut), - Prefix: agg1.ateLoopbackV4 + "/32", - NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ - "0": oc.UnionString(agg1.ateIPv4), - }, - } - sr6ATE1 := &cfgplugins.StaticRouteCfg{ - NetworkInstance: deviations.DefaultNetworkInstance(dut), - Prefix: agg1.ateLoopbackV6 + "/128", - NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ - "0": oc.UnionString(agg1.ateIPv6), - }, - } - sr4ATE2 := &cfgplugins.StaticRouteCfg{ - NetworkInstance: deviations.DefaultNetworkInstance(dut), - Prefix: agg2.ateLoopbackV4 + "/32", - NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ - "0": oc.UnionString(agg2.ateIPv4), - "1": oc.UnionString(agg3.ateIPv4), - "2": oc.UnionString(agg4.ateIPv4), - }, - } - sr6ATE2 := &cfgplugins.StaticRouteCfg{ - NetworkInstance: deviations.DefaultNetworkInstance(dut), - Prefix: agg2.ateLoopbackV6 + "/128", - NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ - "0": oc.UnionString(agg2.ateIPv6), - "1": oc.UnionString(agg3.ateIPv6), - "2": oc.UnionString(agg4.ateIPv6), - }, - } - b := &gnmi.SetBatch{} - for _, cfg := range []*cfgplugins.StaticRouteCfg{sr4ATE1, sr6ATE1, sr4ATE2, sr6ATE2} { - if _, err := cfgplugins.NewStaticRouteCfg(b, cfg, dut); err != nil { - t.Fatalf("Failed to configure static route to ATE Loopback: %v", err) - } - } - b.Set(t, dut) -} - func configureDUTISIS(t *testing.T, dut *ondatra.DUTDevice, aggIDs []string) { t.Helper() @@ -632,6 +603,9 @@ func configureDUTISIS(t *testing.T, dut *ondatra.DUTDevice, aggIDs []string) { isisLevel2 := isis.GetOrCreateLevel(2) isisLevel2.MetricStyle = oc.Isis_MetricStyle_WIDE_METRIC + if deviations.ISISLevelEnabled(dut) { + isisLevel2.Enabled = ygot.Bool(true) + } if deviations.ISISLoopbackRequired(dut) { gnmi.Update(t, dut, gnmi.OC().Config(), d) // add loopback interface to ISIS From 584d2ec13107af293e1db37cf07a9615ac45ac6a Mon Sep 17 00:00:00 2001 From: Pramod Maurya Date: Fri, 27 Sep 2024 14:28:42 +0530 Subject: [PATCH 7/8] Add test for adding and removing next hops to a static route (#3458) * Add test for adding and removing next hops to a static route * remove recrsive flag --------- Co-authored-by: Swetha-haridasula --- .../basic_static_route_support_test/README.md | 21 +++- .../basic_static_route_support_test.go | 114 +++++++++++++++++- .../metadata.textproto | 1 - 3 files changed, 131 insertions(+), 5 deletions(-) diff --git a/feature/staticroute/otg_tests/basic_static_route_support_test/README.md b/feature/staticroute/otg_tests/basic_static_route_support_test/README.md index a50aa04c701..1127cffe981 100644 --- a/feature/staticroute/otg_tests/basic_static_route_support_test/README.md +++ b/feature/staticroute/otg_tests/basic_static_route_support_test/README.md @@ -16,8 +16,8 @@ #### Initial Setup: -* Connect DUT port-1, port-2 and port-3 to ATE port-1, port-2 and port-3 - respectively +* Connect DUT port-1, port-2, port-3 and port-4 to ATE port-1, port-2, port-3 + and port-4 respectively * Configure IPv4/IPv6 addresses on DUT and ATE the interfaces * Configure one IPv4 destination i.e. `ipv4-network = 203.0.113.0/24` connected to ATE port 1 and 2 @@ -177,9 +177,24 @@ 203.0.113.0/24` and `ipv6-network 2001:db8:128:128::/64` * Validate that traffic is NOT received from DUT +### RT-1.26.9 + +#### Test to validate add and remove to next-hops in a static route + +* Configure one IPv4 static route i.e. ipv4-route with the next hop set to the + IPv4 address of ATE port-2(0 index) and port-3(1 index). +* Validate next-hops of `ipv4-route` static route and indexes. +* Update IPv4 static route i.e. ipv4-route with the next hop set to the IPv4 + address of ATE port-1(0 index), port-2(1 index), port-3(2 index) and + port-4(3 index). +* Validate next-hops of `ipv4-route` static route and indexes. +* Remove two next hops at index 0 and 3 added in previous step. +* Validate next-hops of `ipv4-route` static route and indexes. + ## OpenConfig Path and RPC Coverage -The below yaml defines the OC paths intended to be covered by this test. OC paths used for test setup are not listed here. +The below yaml defines the OC paths intended to be covered by this test. OC +paths used for test setup are not listed here. ```yaml paths: diff --git a/feature/staticroute/otg_tests/basic_static_route_support_test/basic_static_route_support_test.go b/feature/staticroute/otg_tests/basic_static_route_support_test/basic_static_route_support_test.go index fbfd8da98ef..932e28281af 100644 --- a/feature/staticroute/otg_tests/basic_static_route_support_test/basic_static_route_support_test.go +++ b/feature/staticroute/otg_tests/basic_static_route_support_test/basic_static_route_support_test.go @@ -102,6 +102,23 @@ var ( IPv6: "2001:db8::192:0:2:a", IPv6Len: ipv6PrefixLen, } + + dutPort4 = attrs.Attributes{ + Desc: "dutPort4", + IPv4: "192.0.2.13", + IPv4Len: ipv4PrefixLen, + IPv6: "2001:db8::192:0:2:d", + IPv6Len: ipv6PrefixLen, + } + + atePort4 = attrs.Attributes{ + Name: "atePort4", + MAC: "02:00:01:01:01:04", + IPv4: "192.0.2.14", + IPv4Len: ipv4PrefixLen, + IPv6: "2001:db8::192:0:2:e", + IPv6Len: ipv6PrefixLen, + } ) func TestMain(m *testing.M) { @@ -209,6 +226,92 @@ func TestBasicStaticRouteSupport(t *testing.T) { } } +func TestStaticRouteAddRemove(t *testing.T) { + dut := ondatra.DUT(t, "dut") + configureDUT(t, dut) + + ate := ondatra.ATE(t, "ate") + top := gosnappi.NewConfig() + configureOTG(t, ate, top) + + ate.OTG().PushConfig(t, top) + ate.OTG().StartProtocols(t) + defer ate.OTG().StopProtocols(t) + otgutils.WaitForARP(t, ate.OTG(), top, "IPv4") + + prefix := ipAddr{address: v4Route, prefix: v4RoutePrefix} + b := &gnmi.SetBatch{} + sV4 := &cfgplugins.StaticRouteCfg{ + NetworkInstance: deviations.DefaultNetworkInstance(dut), + Prefix: prefix.cidr(t), + NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ + "0": oc.UnionString(atePort2.IPv4), + "1": oc.UnionString(atePort3.IPv4), + }, + } + if _, err := cfgplugins.NewStaticRouteCfg(b, sV4, dut); err != nil { + t.Fatalf("Failed to configure IPv4 static route: %v", err) + } + b.Set(t, dut) + validateStaticRoute(t, dut, prefix.cidr(t), sV4) + + // add 2 new nextHops, one at 0 index and another at 3 index + b = &gnmi.SetBatch{} + sV4 = &cfgplugins.StaticRouteCfg{ + NetworkInstance: deviations.DefaultNetworkInstance(dut), + Prefix: prefix.cidr(t), + NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ + "0": oc.UnionString(atePort1.IPv4), + "1": oc.UnionString(atePort2.IPv4), + "2": oc.UnionString(atePort3.IPv4), + "3": oc.UnionString(atePort4.IPv4), + }, + } + if _, err := cfgplugins.NewStaticRouteCfg(b, sV4, dut); err != nil { + t.Fatalf("Failed to configure IPv4 static route: %v", err) + } + b.Set(t, dut) + validateStaticRoute(t, dut, prefix.cidr(t), sV4) + + // remove previously added indexes + b = &gnmi.SetBatch{} + sV4 = &cfgplugins.StaticRouteCfg{ + NetworkInstance: deviations.DefaultNetworkInstance(dut), + Prefix: prefix.cidr(t), + NextHops: map[string]oc.NetworkInstance_Protocol_Static_NextHop_NextHop_Union{ + "0": oc.UnionString(atePort2.IPv4), + "1": oc.UnionString(atePort3.IPv4), + }, + } + if _, err := cfgplugins.NewStaticRouteCfg(b, sV4, dut); err != nil { + t.Fatalf("Failed to configure IPv4 static route: %v", err) + } + b.Set(t, dut) + validateStaticRoute(t, dut, prefix.cidr(t), sV4) +} + +func validateStaticRoute(t *testing.T, dut *ondatra.DUTDevice, prefix string, sV4 *cfgplugins.StaticRouteCfg) { + sp := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, deviations.StaticProtocolName(dut)) + gnmi.Await(t, dut, sp.Static(prefix).Prefix().State(), 120*time.Second, prefix) + + if deviations.SkipStaticNexthopCheck(dut) { + nexthops := gnmi.LookupAll(t, dut, sp.Static(prefix).NextHopAny().NextHop().State()) + if got, want := len(nexthops), len(sV4.NextHops); got != want { + t.Errorf("Static route next hop count - %s: got: %v, want: %v", prefix, got, want) + } + } else { + // Validate both the routes i.e. ipv4-route-[a|b] are configured and reported + // correctly + gotStatic := gnmi.Get(t, dut, sp.Static(prefix).State()) + t.Logf("Static route %s: got: %v, want: %v", prefix, len(gotStatic.NextHop), len(sV4.NextHops)) + for index, nextHop := range gotStatic.NextHop { + if got, want := nextHop.GetNextHop(), sV4.NextHops[index]; got != want { + t.Errorf("Static route %s: got: %v, want: %v", prefix, got, want) + } + } + } +} + func TestDisableRecursiveNextHopResolution(t *testing.T) { dut := ondatra.DUT(t, "dut") if deviations.UnsupportedStaticRouteNextHopRecurse(dut) { @@ -1208,23 +1311,29 @@ func configureDUT(t *testing.T, dut *ondatra.DUTDevice) { p1 := dut.Port(t, "port1") p2 := dut.Port(t, "port2") p3 := dut.Port(t, "port3") + p4 := dut.Port(t, "port4") b := &gnmi.SetBatch{} i1 := dutPort1.NewOCInterface(p1.Name(), dut) i2 := dutPort2.NewOCInterface(p2.Name(), dut) i3 := dutPort3.NewOCInterface(p3.Name(), dut) + i4 := dutPort4.NewOCInterface(p4.Name(), dut) if deviations.IPv6StaticRouteWithIPv4NextHopRequiresStaticARP(dut) { i1.GetOrCreateSubinterface(0).GetOrCreateIpv6().GetOrCreateNeighbor(dummyV6).LinkLayerAddress = ygot.String(dummyMAC) i2.GetOrCreateSubinterface(0).GetOrCreateIpv6().GetOrCreateNeighbor(dummyV6).LinkLayerAddress = ygot.String(dummyMAC) + i3.GetOrCreateSubinterface(0).GetOrCreateIpv6().GetOrCreateNeighbor(dummyV6).LinkLayerAddress = ygot.String(dummyMAC) + i4.GetOrCreateSubinterface(0).GetOrCreateIpv6().GetOrCreateNeighbor(dummyV6).LinkLayerAddress = ygot.String(dummyMAC) } gnmi.BatchReplace(b, gnmi.OC().Interface(p1.Name()).Config(), i1) gnmi.BatchReplace(b, gnmi.OC().Interface(p2.Name()).Config(), i2) gnmi.BatchReplace(b, gnmi.OC().Interface(p3.Name()).Config(), i3) + gnmi.BatchReplace(b, gnmi.OC().Interface(p4.Name()).Config(), i4) b.Set(t, dut) if deviations.ExplicitPortSpeed(dut) { fptest.SetPortSpeed(t, p1) fptest.SetPortSpeed(t, p2) fptest.SetPortSpeed(t, p3) + fptest.SetPortSpeed(t, p4) } fptest.ConfigureDefaultNetworkInstance(t, dut) @@ -1233,6 +1342,7 @@ func configureDUT(t *testing.T, dut *ondatra.DUTDevice) { fptest.AssignToNetworkInstance(t, dut, p1.Name(), deviations.DefaultNetworkInstance(dut), 0) fptest.AssignToNetworkInstance(t, dut, p2.Name(), deviations.DefaultNetworkInstance(dut), 0) fptest.AssignToNetworkInstance(t, dut, p3.Name(), deviations.DefaultNetworkInstance(dut), 0) + fptest.AssignToNetworkInstance(t, dut, p4.Name(), deviations.DefaultNetworkInstance(dut), 0) } } @@ -1241,11 +1351,13 @@ func configureOTG(t *testing.T, ate *ondatra.ATEDevice, top gosnappi.Config) []g p1 := ate.Port(t, "port1") p2 := ate.Port(t, "port2") p3 := ate.Port(t, "port3") + p4 := ate.Port(t, "port4") d1 := atePort1.AddToOTG(top, p1, &dutPort1) d2 := atePort2.AddToOTG(top, p2, &dutPort2) d3 := atePort3.AddToOTG(top, p3, &dutPort3) - return []gosnappi.Device{d1, d2, d3} + d4 := atePort4.AddToOTG(top, p4, &dutPort4) + return []gosnappi.Device{d1, d2, d3, d4} } func (td *testData) advertiseRoutesWithISIS(t *testing.T) { diff --git a/feature/staticroute/otg_tests/basic_static_route_support_test/metadata.textproto b/feature/staticroute/otg_tests/basic_static_route_support_test/metadata.textproto index 34fb8af4eaf..af7f010bc52 100644 --- a/feature/staticroute/otg_tests/basic_static_route_support_test/metadata.textproto +++ b/feature/staticroute/otg_tests/basic_static_route_support_test/metadata.textproto @@ -36,7 +36,6 @@ platform_exceptions: { unsupported_static_route_next_hop_recurse: true static_route_with_explicit_metric: true interface_ref_config_unsupported: true - } } platform_exceptions: { From 3f72a2313233bc561571e964638408d725e3bd6a Mon Sep 17 00:00:00 2001 From: ANISH-GOTTAPU <48308607+ANISH-GOTTAPU@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:40:31 +0530 Subject: [PATCH 8/8] OTG TE - 9.1 Changing the test not to update the flows dynamically (#2716) * update te9.1 * revert to original * add egress tracking * added fail criteria * change fail condition * update file * Add rxPackets greater than zero check * update readme --- .../README.md | 16 +- .../fib_failed_due_to_hw_res_exhaust_test.go | 147 ++++++++++++------ 2 files changed, 108 insertions(+), 55 deletions(-) diff --git a/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/README.md b/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/README.md index 94fb48612b5..1cf7be3987d 100644 --- a/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/README.md +++ b/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/README.md @@ -23,10 +23,18 @@ Validate gRIBI FIB_FAILED functionality. * Pick any route that received FIB_PROGRAMMED. Validate that traffic hitting the route should be forwarded to port2 -## Protocol/RPC Parameter coverage - -* gRIBI - * Flush +## OpenConfig Path and RPC Coverage +```yaml +rpcs: + gnmi: + gNMI.Get: + gNMI.Set: + gNMI.Subscribe: + gribi: + gRIBI.Get: + gRIBI.Modify: + gRIBI.Flush: +``` ## Config parameter coverage diff --git a/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/fib_failed_due_to_hw_res_exhaust_test.go b/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/fib_failed_due_to_hw_res_exhaust_test.go index d30e5b5fcff..99761f18b35 100644 --- a/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/fib_failed_due_to_hw_res_exhaust_test.go +++ b/feature/experimental/gribi/otg_tests/fib_failed_due_to_hw_res_exhaust_test/fib_failed_due_to_hw_res_exhaust_test.go @@ -19,6 +19,8 @@ import ( "encoding/binary" "fmt" "net" + "strconv" + "strings" "testing" "time" @@ -27,7 +29,6 @@ import ( "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" "github.com/openconfig/featureprofiles/internal/gribi" - "github.com/openconfig/featureprofiles/internal/otgutils" "github.com/openconfig/gribigo/fluent" "github.com/openconfig/ondatra" "github.com/openconfig/ondatra/gnmi" @@ -64,6 +65,10 @@ const ( tolerance = 50 plenIPv4 = 30 plenIPv6 = 126 + fibPassedTraffic = "fibPassedTraffic" + fibFailedTraffic = "fibFailedTraffic" + dstTrackingf1 = "dstTrackingf1" + dstTrackingf2 = "dstTrackingf2" ) var ( @@ -102,8 +107,9 @@ var ( IPv4Len: plenIPv4, IPv6Len: plenIPv6, } - fibPassedDstRoute string - fibFailedDstRoute string + fibPassedDstRoute string + fibFailedDstRoute string + fibFailedDstRouteInHex string ) func configureBGP(dut *ondatra.DUTDevice) *oc.NetworkInstance_Protocol { @@ -143,7 +149,7 @@ func configureBGP(dut *ondatra.DUTDevice) *oc.NetworkInstance_Protocol { return niProto } -func configureOTG(t *testing.T, otg *otg.OTG) (gosnappi.BgpV6Peer, gosnappi.DeviceIpv6, gosnappi.Config) { +func configureOTG(t *testing.T, otg *otg.OTG, dstIPList []string) (gosnappi.BgpV6Peer, gosnappi.DeviceIpv6, gosnappi.Config) { t.Helper() config := gosnappi.NewConfig() port1 := config.Ports().Add().SetName("port1") @@ -168,6 +174,44 @@ func configureOTG(t *testing.T, otg *otg.OTG) (gosnappi.BgpV6Peer, gosnappi.Devi iDut1Bgp6Peer.SetPeerAddress(iDut1Ipv6.Gateway()).SetAsNumber(ateAS).SetAsType(gosnappi.BgpV6PeerAsType.EBGP) iDut1Bgp6Peer.LearnedInformationFilter().SetUnicastIpv4Prefix(true).SetUnicastIpv6Prefix(true) + flow1ipv4 := config.Flows().Add().SetName(fibPassedTraffic) + flow1ipv4.Metrics().SetEnable(true) + flow1ipv4.TxRx().Device(). + SetTxNames([]string{atePort1.Name + ".IPv4"}). + SetRxNames([]string{atePort2.Name + ".IPv4"}) + flow1ipv4.Size().SetFixed(512) + flow1ipv4.Rate().SetPps(100) + flow1ipv4.Duration().Continuous() + e1 := flow1ipv4.Packet().Add().Ethernet() + e1.Src().SetValue(atePort1.MAC) + v4 := flow1ipv4.Packet().Add().Ipv4() + v4.Src().SetValue(atePort1.IPv4) + v4.Dst().Increment().SetStart(dstIPList[0]) + + flow1ipv4.EgressPacket().Add().Ethernet() + ipTrackingf1 := flow1ipv4.EgressPacket().Add().Ipv4() + ipDstTrackingf1 := ipTrackingf1.Dst().MetricTags().Add() + ipDstTrackingf1.SetName(dstTrackingf1).SetOffset(22).SetLength(10) + + flow2ipv4 := config.Flows().Add().SetName(fibFailedTraffic) + flow2ipv4.Metrics().SetEnable(true) + flow2ipv4.TxRx().Device(). + SetTxNames([]string{atePort1.Name + ".IPv4"}). + SetRxNames([]string{atePort2.Name + ".IPv4"}) + flow2ipv4.Size().SetFixed(512) + flow2ipv4.Rate().SetPps(100) + flow2ipv4.Duration().Continuous() + e2 := flow2ipv4.Packet().Add().Ethernet() + e2.Src().SetValue(atePort1.MAC) + v4Flow2 := flow2ipv4.Packet().Add().Ipv4() + v4Flow2.Src().SetValue(atePort1.IPv4) + v4Flow2.Dst().SetValues(dstIPList[1:]) + + flow2ipv4.EgressPacket().Add().Ethernet() + ipTrackingf2 := flow2ipv4.EgressPacket().Add().Ipv4() + ipDstTrackingf2 := ipTrackingf2.Dst().MetricTags().Add() + ipDstTrackingf2.SetName(dstTrackingf2).SetOffset(22).SetLength(10) + t.Logf("Pushing config to ATE and starting protocols...") otg.PushConfig(t, config) time.Sleep(30 * time.Second) @@ -206,6 +250,8 @@ type testArgs struct { func TestFibFailDueToHwResExhaust(t *testing.T) { ctx := context.Background() dut := ondatra.DUT(t, "dut") + dstIPList := createIPv4Entries(t, fmt.Sprintf("%s/%d", dstIPBlock, 20)) + vipList := createIPv4Entries(t, fmt.Sprintf("%s/%d", vipBlock, 20)) configureDUT(t, dut) configureRoutePolicy(t, dut, "ALLOW", oc.RoutingPolicy_PolicyResultType_ACCEPT_ROUTE) @@ -243,7 +289,7 @@ func TestFibFailDueToHwResExhaust(t *testing.T) { var otgConfig gosnappi.Config var otgBgpPeer gosnappi.BgpV6Peer var otgIPv6Device gosnappi.DeviceIpv6 - otgBgpPeer, otgIPv6Device, otgConfig = configureOTG(t, otg) + otgBgpPeer, otgIPv6Device, otgConfig = configureOTG(t, otg, dstIPList) verifyBgpTelemetry(t, dut) @@ -287,7 +333,7 @@ func TestFibFailDueToHwResExhaust(t *testing.T) { otg: otg, } start := time.Now() - injectEntry(ctx, t, args) + injectEntry(ctx, t, args, dstIPList, vipList) t.Logf("Main Function: Time elapsed %.2f seconds since start", time.Since(start).Seconds()) t.Log("Send traffic to any of the programmed entries and validate.") @@ -297,50 +343,16 @@ func TestFibFailDueToHwResExhaust(t *testing.T) { func sendTraffic(t *testing.T, args *testArgs) { // Ensure that traffic can be forwarded between ATE port-1 and ATE port-2. t.Helper() - t.Logf("TestBGP:start otg Traffic config") - flow1ipv4 := args.otgConfig.Flows().Add().SetName("Flow1") - flow1ipv4.Metrics().SetEnable(true) - flow1ipv4.TxRx().Device(). - SetTxNames([]string{atePort1.Name + ".IPv4"}). - SetRxNames([]string{atePort2.Name + ".IPv4"}) - flow1ipv4.Size().SetFixed(512) - flow1ipv4.Rate().SetPps(100) - flow1ipv4.Duration().Continuous() - e1 := flow1ipv4.Packet().Add().Ethernet() - e1.Src().SetValue(atePort1.MAC) - v4 := flow1ipv4.Packet().Add().Ipv4() - v4.Src().SetValue(atePort1.IPv4) - v4.Dst().Increment().SetStart(fibPassedDstRoute) - flow2ipv4 := args.otgConfig.Flows().Add().SetName("Flow2") - flow2ipv4.Metrics().SetEnable(true) - flow2ipv4.TxRx().Device(). - SetTxNames([]string{atePort1.Name + ".IPv4"}). - SetRxNames([]string{atePort2.Name + ".IPv4"}) - flow2ipv4.Size().SetFixed(512) - flow2ipv4.Rate().SetPps(100) - flow2ipv4.Duration().Continuous() - e2 := flow2ipv4.Packet().Add().Ethernet() - e2.Src().SetValue(atePort1.MAC) - v4Flow2 := flow2ipv4.Packet().Add().Ipv4() - v4Flow2.Src().SetValue(atePort1.IPv4) - v4Flow2.Dst().Increment().SetStart(fibFailedDstRoute) + t.Logf("TestBGP:start otg Traffic") - args.otg.PushConfig(t, args.otgConfig) - time.Sleep(2 * time.Minute) - args.otg.StartProtocols(t) - otgutils.WaitForARP(t, args.ate.OTG(), args.otg.FetchConfig(t), "IPv4") t.Logf("Starting traffic") args.otg.StartTraffic(t) time.Sleep(15 * time.Second) t.Logf("Stop traffic") args.otg.StopTraffic(t) - verifyTraffic(t, args, flow1ipv4.Name(), !wantLoss) - /* - if !deviations.GRIBISkipFIBFailedTrafficForwardingCheck(args.dut) { - verifyTraffic(t, args, flow2ipv4.Name(), wantLoss) - } - */ + verifyTraffic(t, args, fibPassedTraffic, !wantLoss) + verifyTraffic(t, args, fibFailedTraffic, wantLoss) } func verifyTraffic(t *testing.T, args *testArgs, flowName string, wantLoss bool) { @@ -351,16 +363,31 @@ func verifyTraffic(t *testing.T, args *testArgs, flowName string, wantLoss bool) rxPackets := recvMetric.GetCounters().GetInPkts() lostPackets := txPackets - rxPackets var lossPct uint64 + trafficPassed := false if txPackets != 0 { lossPct = lostPackets * 100 / txPackets } else { t.Errorf("Traffic stats are not correct %v", recvMetric) } if wantLoss { - if lossPct < 100-tolerancePct { - t.Errorf("Traffic is expected to fail %s\n got %v, want 100%% failure", flowName, lossPct) + // If no rxPackets are received, the first route is fibFailedRoute, resulting in no packets being generated with tagged metrics. + if rxPackets > 0 { + etPath := gnmi.OTG().Flow(flowName).TaggedMetricAny() + ets := gnmi.GetAll(t, args.otg, etPath.State()) + for _, et := range ets { + tags := et.Tags + for _, tag := range tags { + if tag.GetTagName() == dstTrackingf2 && tag.GetTagValue().GetValueAsHex() == fibFailedDstRouteInHex { + trafficPassed = true + break + } + } + } + } + if trafficPassed { + t.Errorf("Traffic received on Failed FIB") } else { - t.Logf("Traffic Loss Test Passed!") + t.Logf("Traffic Test Passed!") } } else { if lossPct > tolerancePct { @@ -369,6 +396,7 @@ func verifyTraffic(t *testing.T, args *testArgs, flowName string, wantLoss bool) t.Logf("Traffic Test Passed!") } } + } func verifyBgpTelemetry(t *testing.T, dut *ondatra.DUTDevice) { @@ -466,15 +494,31 @@ func createIPv4Entries(t *testing.T, startIP string) []string { return entries } +func IPv4LastTenBitsToHex(ip string) string { + // Convert IPv4 address to a 32-bit integer + ipParts := strings.Split(ip, ".") + var ipInt uint32 + for i := 0; i < 4; i++ { + part, _ := strconv.Atoi(ipParts[i]) + ipInt = (ipInt << 8) | uint32(part) + } + + // Convert the IP address to binary string + ipBinary := fmt.Sprintf("%032b", ipInt) + // Extract the last 10 bits + last10Bits := ipBinary[len(ipBinary)-10:] + // Convert the last 10 bits to hexadecimal + last10Hex, _ := strconv.ParseInt(last10Bits, 2, 64) + return fmt.Sprintf("0x%03x", last10Hex) +} + // injectEntry programs gRIBI nh, nhg and ipv4 entry. -func injectEntry(ctx context.Context, t *testing.T, args *testArgs) { +func injectEntry(ctx context.Context, t *testing.T, args *testArgs, dstIPList []string, vipList []string) { t.Helper() - dstIPList := createIPv4Entries(t, fmt.Sprintf("%s/%d", dstIPBlock, 20)) - vipList := createIPv4Entries(t, fmt.Sprintf("%s/%d", vipBlock, 20)) j := uint64(0) routeAddLoop: - for i := uint64(1); i <= uint64(1500); i += 2 { + for i := uint64(1); i <= uint64(1000); i += 2 { vipNhIndex := i dstNhIndex := vipNhIndex + 1 @@ -503,6 +547,7 @@ routeAddLoop: if v.ProgrammingResult == aftspb.AFTResult_FIB_FAILED { t.Logf("FIB FAILED received %v", v.Details) fibFailedDstRoute = dstIPList[j] + fibFailedDstRouteInHex = IPv4LastTenBitsToHex(fibFailedDstRoute) break routeAddLoop } } @@ -512,7 +557,7 @@ routeAddLoop: // routes through gRIBI client. Since FIB is already full , we should get // FIB FAILED while programming gRIBI routes. Here we are trying to program // 1500 VIP/Dst entries along with unique NH/NHG entries. - if i >= 1498 { + if i >= 998 { t.Fatalf("FIB FAILED is not received as expected") } if j == 1 {