diff --git a/feature/gnoi/system/tests/chassis_reboot_status_and_cancel_test/chassis_reboot_status_and_cancel_test.go b/feature/gnoi/system/tests/chassis_reboot_status_and_cancel_test/chassis_reboot_status_and_cancel_test.go index 30d20401fc6..d709bd4adaa 100644 --- a/feature/gnoi/system/tests/chassis_reboot_status_and_cancel_test/chassis_reboot_status_and_cancel_test.go +++ b/feature/gnoi/system/tests/chassis_reboot_status_and_cancel_test/chassis_reboot_status_and_cancel_test.go @@ -197,7 +197,7 @@ func getSubCompPath(t *testing.T, dut *ondatra.DUTDevice) *tpb.Path { } activeRP := controllerCards[0] if len(controllerCards) == 2 { - _, activeRP = components.FindStandbyRP(t, dut, controllerCards) + _, activeRP = components.FindStandbyControllerCard(t, dut, controllerCards) } useNameOnly := deviations.GNOISubcomponentPath(dut) return components.GetSubcomponentPath(activeRP, useNameOnly) diff --git a/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go b/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go index 7a2bfcfc27a..27bbc03efb5 100644 --- a/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go +++ b/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go @@ -18,12 +18,15 @@ import ( "testing" "time" + comps "github.com/openconfig/featureprofiles/internal/components" + "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" "github.com/openconfig/featureprofiles/internal/system" hpb "github.com/openconfig/gnoi/healthz" spb "github.com/openconfig/gnoi/system" tpb "github.com/openconfig/gnoi/types" "github.com/openconfig/ondatra" + "github.com/openconfig/ondatra/gnmi/oc" ) var ( @@ -31,13 +34,15 @@ var ( ondatra.NOKIA: "sr_qos_mgr", ondatra.ARISTA: "IpRib", ondatra.JUNIPER: "rpd", + ondatra.CISCO: "ifmgr", } components = map[ondatra.Vendor]string{ ondatra.ARISTA: "Chassis", - ondatra.CISCO: "Chassis", + ondatra.CISCO: "Rack 0", ondatra.JUNIPER: "CHASSIS0", ondatra.NOKIA: "Chassis", } + componentName = map[string]string{} ) func TestMain(m *testing.M) { @@ -86,9 +91,29 @@ func TestCopyingDebugFiles(t *testing.T) { t.Logf("Wait 60 seconds for process to restart ...") time.Sleep(60 * time.Second) - componentName := map[string]string{"name": components[dut.Vendor()]} + ccList := comps.FindComponentsByType(t, dut, oc.PlatformTypes_OPENCONFIG_HARDWARE_COMPONENT_CONTROLLER_CARD) + t.Logf("Found CONTROLLER_CARD list: %v", ccList) + var activeCC string + if deviations.ChassisGetRPCUnsupported(dut) { + if len(ccList) < 2 { + switch dut.Vendor() { + case ondatra.CISCO: + activeCC = "0/RP0/CPU0" + } + } else { + standbyControllerName, activeControllerName := comps.FindStandbyControllerCard(t, dut, ccList) + t.Logf("Standby RP: %v, Active RP: %v", standbyControllerName, activeControllerName) + activeCC = activeControllerName + } + componentName = map[string]string{"name": activeCC + "-" + processName[dut.Vendor()]} // example: 0/RP0/CPU0-ifmgr + } else { + componentName = map[string]string{"name": components[dut.Vendor()]} + } + t.Logf("Component Name: %v", componentName) + req := &hpb.GetRequest{ Path: &tpb.Path{ + Origin: "openconfig", Elem: []*tpb.PathElem{ { Name: "components", @@ -106,10 +131,10 @@ func TestCopyingDebugFiles(t *testing.T) { case ondatra.ARISTA: t.Log("Skip logging validResponse for Arista") default: - t.Logf("Response: %v", (validResponse)) + t.Logf("Response: %v", validResponse) } if err != nil { - t.Fatalf("Unexpected error on healthz get response after restart of %v: %v", processName[dut.Vendor()], err) + t.Errorf("Unexpected error on healthz get response after restart of %v: %v", processName[dut.Vendor()], err) } } @@ -120,6 +145,7 @@ func TestChassisComponentArtifacts(t *testing.T) { // Execute Healthz Check RPC for the chassis component. chkReq := &hpb.CheckRequest{ Path: &tpb.Path{ + Origin: "openconfig", Elem: []*tpb.PathElem{ { Name: "components", diff --git a/feature/gnoi/system/tests/copying_debug_files_test/metadata.textproto b/feature/gnoi/system/tests/copying_debug_files_test/metadata.textproto index 4d3c878aa43..fc3f0cd55ac 100644 --- a/feature/gnoi/system/tests/copying_debug_files_test/metadata.textproto +++ b/feature/gnoi/system/tests/copying_debug_files_test/metadata.textproto @@ -5,3 +5,11 @@ uuid: "3265de19-8fb8-4b0c-8a71-a75df008aa61" plan_id: "gNOI-5.3" description: "Copying Debug Files" testbed: TESTBED_DUT_ATE_2LINKS +platform_exceptions: { + platform: { + vendor: CISCO + } + deviations: { + chassis_get_rpc_unsupported: true + } +} \ No newline at end of file diff --git a/feature/gnoi/system/tests/per_component_reboot_test/per_component_reboot_test.go b/feature/gnoi/system/tests/per_component_reboot_test/per_component_reboot_test.go index 53824b90d0c..18ccb12057d 100644 --- a/feature/gnoi/system/tests/per_component_reboot_test/per_component_reboot_test.go +++ b/feature/gnoi/system/tests/per_component_reboot_test/per_component_reboot_test.go @@ -95,7 +95,7 @@ func TestStandbyControllerCardReboot(t *testing.T) { t.Skipf("Not enough controller cards for the test on %v: got %v, want at least %v", dut.Model(), got, want) } - rpStandby, rpActive := components.FindStandbyRP(t, dut, controllerCards) + rpStandby, rpActive := components.FindStandbyControllerCard(t, dut, controllerCards) t.Logf("Detected rpStandby: %v, rpActive: %v", rpStandby, rpActive) gnoiClient := dut.RawAPIs().GNOI(t) diff --git a/feature/gnoi/system/tests/supervisor_switchover_test/supervisor_switchover_test.go b/feature/gnoi/system/tests/supervisor_switchover_test/supervisor_switchover_test.go index 4ce309a06c4..d40c60d8f67 100644 --- a/feature/gnoi/system/tests/supervisor_switchover_test/supervisor_switchover_test.go +++ b/feature/gnoi/system/tests/supervisor_switchover_test/supervisor_switchover_test.go @@ -85,7 +85,7 @@ func TestSupervisorSwitchover(t *testing.T) { t.Skipf("Not enough controller cards for the test on %v: got %v, want at least %v", dut.Model(), got, want) } - rpStandbyBeforeSwitch, rpActiveBeforeSwitch := components.FindStandbyRP(t, dut, controllerCards) + rpStandbyBeforeSwitch, rpActiveBeforeSwitch := components.FindStandbyControllerCard(t, dut, controllerCards) t.Logf("Detected rpStandby: %v, rpActive: %v", rpStandbyBeforeSwitch, rpActiveBeforeSwitch) switchoverReady := gnmi.OC().Component(rpActiveBeforeSwitch).SwitchoverReady() @@ -150,7 +150,7 @@ func TestSupervisorSwitchover(t *testing.T) { } t.Logf("RP switchover time: %.2f seconds", time.Since(startSwitchover).Seconds()) - rpStandbyAfterSwitch, rpActiveAfterSwitch := components.FindStandbyRP(t, dut, controllerCards) + rpStandbyAfterSwitch, rpActiveAfterSwitch := components.FindStandbyControllerCard(t, dut, controllerCards) t.Logf("Found standbyRP after switchover: %v, activeRP: %v", rpStandbyAfterSwitch, rpActiveAfterSwitch) if got, want := rpActiveAfterSwitch, rpStandbyBeforeSwitch; got != want { diff --git a/internal/components/components.go b/internal/components/components.go index c2e6a8b2896..e13fd064046 100644 --- a/internal/components/components.go +++ b/internal/components/components.go @@ -171,9 +171,9 @@ func (y Y) FindByType(ctx context.Context, want oc.Component_Type_Union) ([]stri return names, nil } -// FindStandbyRP gets a list of two components and finds out the active and standby rp. -func FindStandbyRP(t *testing.T, dut *ondatra.DUTDevice, supervisors []string) (string, string) { - var activeRP, standbyRP string +// FindStandbyControllerCard gets a list of two components and finds out the active and standby controller_cards. +func FindStandbyControllerCard(t *testing.T, dut *ondatra.DUTDevice, supervisors []string) (string, string) { + var activeCC, standbyCC string for _, supervisor := range supervisors { watch := gnmi.Watch(t, dut, gnmi.OC().Component(supervisor).RedundantRole().State(), 10*time.Minute, func(val *ygnmi.Value[oc.E_Platform_ComponentRedundantRole]) bool { return val.IsPresent() @@ -184,19 +184,19 @@ func FindStandbyRP(t *testing.T, dut *ondatra.DUTDevice, supervisors []string) ( role := gnmi.Get(t, dut, gnmi.OC().Component(supervisor).RedundantRole().State()) t.Logf("Component(supervisor).RedundantRole().Get(t): %v, Role: %v", supervisor, role) if role == standbyController { - standbyRP = supervisor + standbyCC = supervisor } else if role == activeController { - activeRP = supervisor + activeCC = supervisor } else { t.Fatalf("Expected controller %s to be active or standby, got %v", supervisor, role) } } - if standbyRP == "" || activeRP == "" { - t.Fatalf("Expected non-empty activeRP and standbyRP, got activeRP: %v, standbyRP: %v", activeRP, standbyRP) + if standbyCC == "" || activeCC == "" { + t.Fatalf("Expected non-empty activeCC and standbyCC, got activeCC: %v, standbyCC: %v", activeCC, standbyCC) } - t.Logf("Detected activeRP: %v, standbyRP: %v", activeRP, standbyRP) + t.Logf("Detected activeCC: %v, standbyCC: %v", activeCC, standbyCC) - return standbyRP, activeRP + return standbyCC, activeCC } // OpticalChannelComponentFromPort finds the optical channel component for a port. diff --git a/internal/deviations/deviations.go b/internal/deviations/deviations.go index 16757a9ef72..9c663b56ad2 100644 --- a/internal/deviations/deviations.go +++ b/internal/deviations/deviations.go @@ -1171,3 +1171,8 @@ func EthChannelIngressParametersUnsupported(dut *ondatra.DUTDevice) bool { func EthChannelAssignmentCiscoNumbering(dut *ondatra.DUTDevice) bool { return lookupDUTDeviations(dut).GetEthChannelAssignmentCiscoNumbering() } + +// ChassisGetRPCUnsupported returns true if a Healthz Get RPC against the Chassis component is unsupported +func ChassisGetRPCUnsupported(dut *ondatra.DUTDevice) bool { + return lookupDUTDeviations(dut).GetChassisGetRpcUnsupported() +} diff --git a/proto/metadata.proto b/proto/metadata.proto index bc6bd7fb913..35a62494db8 100644 --- a/proto/metadata.proto +++ b/proto/metadata.proto @@ -623,6 +623,8 @@ message Metadata { bool eth_channel_assignment_cisco_numbering = 223; // Devices needs time to update interface counters. bool interface_counters_update_delayed = 224; + // device does not support a Healthz GET RPC against Chassis level component like "CHASSIS" or "Rack 0" + bool chassis_get_rpc_unsupported = 225; // 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 139b2058c16..6a587b520f6 100644 --- a/proto/metadata_go_proto/metadata.pb.go +++ b/proto/metadata_go_proto/metadata.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.1 +// protoc v5.28.0 // source: metadata.proto package metadata_go_proto @@ -905,6 +905,8 @@ type Metadata_Deviations struct { EthChannelAssignmentCiscoNumbering bool `protobuf:"varint,223,opt,name=eth_channel_assignment_cisco_numbering,json=ethChannelAssignmentCiscoNumbering,proto3" json:"eth_channel_assignment_cisco_numbering,omitempty"` // Devices needs time to update interface counters. InterfaceCountersUpdateDelayed bool `protobuf:"varint,224,opt,name=interface_counters_update_delayed,json=interfaceCountersUpdateDelayed,proto3" json:"interface_counters_update_delayed,omitempty"` + // device does not support a Healthz GET RPC against Chassis level component like "CHASSIS" or "Rack 0" + ChassisGetRpcUnsupported bool `protobuf:"varint,225,opt,name=chassis_get_rpc_unsupported,json=chassisGetRpcUnsupported,proto3" json:"chassis_get_rpc_unsupported,omitempty"` } func (x *Metadata_Deviations) Reset() { @@ -2360,6 +2362,13 @@ func (x *Metadata_Deviations) GetInterfaceCountersUpdateDelayed() bool { return false } +func (x *Metadata_Deviations) GetChassisGetRpcUnsupported() bool { + if x != nil { + return x.ChassisGetRpcUnsupported + } + return false +} + type Metadata_PlatformExceptions struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2423,7 +2432,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, 0xb2, 0x7e, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x7e, 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, @@ -2457,7 +2466,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, 0x85, 0x76, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x1a, 0xc5, 0x76, 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, @@ -3396,7 +3405,11 @@ var file_metadata_proto_rawDesc = []byte{ 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x18, 0xe0, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x4a, 0x04, 0x08, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x12, 0x3e, 0x0a, + 0x1b, 0x63, 0x68, 0x61, 0x73, 0x73, 0x69, 0x73, 0x5f, 0x67, 0x65, 0x74, 0x5f, 0x72, 0x70, 0x63, + 0x5f, 0x75, 0x6e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0xe1, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x18, 0x63, 0x68, 0x61, 0x73, 0x73, 0x69, 0x73, 0x47, 0x65, 0x74, 0x52, + 0x70, 0x63, 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,