Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeya-remilla committed Oct 3, 2024
1 parent 43e3890 commit 658b987
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,31 @@ 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 (
processName = map[ondatra.Vendor]string{
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) {
Expand Down Expand Up @@ -86,9 +91,26 @@ 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()]}
if deviations.ChassisGetRPCUnsupported(dut) {
var activeRp string
rpList := comps.FindComponentsByType(t, dut, oc.PlatformTypes_OPENCONFIG_HARDWARE_COMPONENT_CONTROLLER_CARD)
t.Logf("Found RP list: %v", rpList)
if len(rpList) < 2 {
activeRp = "0/RP0/CPU0"
} else {
standbyRpName, activeRpName := comps.FindStandbyRP(t, dut, rpList)
t.Logf("Standby RP: %v, Active RP: %v", standbyRpName, activeRpName)
activeRp = activeRpName
}
componentName = map[string]string{"name": activeRp + "-" + 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",
Expand All @@ -106,10 +128,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)
}
}

Expand All @@ -120,6 +142,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
5 changes: 5 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
2 changes: 2 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
21 changes: 17 additions & 4 deletions proto/metadata_go_proto/metadata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 658b987

Please sign in to comment.