From 15d674e0fbd63b2218bde65e9f1ca9d8cdd214f8 Mon Sep 17 00:00:00 2001 From: lvaish05 Date: Mon, 13 Jan 2025 21:55:48 -0800 Subject: [PATCH 1/3] removing deviations that are not required and adding code for components presence --- .../metadata.textproto | 2 -- .../system_generic_health_check_test.go | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/feature/system/health/tests/system_generic_health_check/metadata.textproto b/feature/system/health/tests/system_generic_health_check/metadata.textproto index 7c47220cea4..b37466a0f83 100644 --- a/feature/system/health/tests/system_generic_health_check/metadata.textproto +++ b/feature/system/health/tests/system_generic_health_check/metadata.textproto @@ -10,11 +10,9 @@ platform_exceptions: { vendor: JUNIPER } deviations: { - linecard_cpu_utilization_unsupported: true consistent_component_names_unsupported: true controller_card_cpu_utilization_unsupported: true fabric_drop_counter_unsupported: true - linecard_memory_utilization_unsupported: true qos_voq_drop_counter_unsupported: true qos_inqueue_drop_counter_unsupported: true } diff --git a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go index 2c182375063..5b7764fd7c1 100644 --- a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go +++ b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go @@ -148,6 +148,22 @@ func TestComponentStatus(t *testing.T) { controllerCards := components.FindComponentsByType(t, dut, controllerCardType) lineCards := components.FindComponentsByType(t, dut, lineCardType) fabricCards := components.FindComponentsByType(t, dut, fabricCardType) + fabrics := make([]string, 0) + for _, f := range fabricCards { + compMtyVal, ok := gnmi.Lookup(t, dut, gnmi.OC().Component(f).Empty().State()).Val() + if !compMtyVal && ok { + fabrics = append(fabrics, f) + } + } + fabricCards = fabrics + chassisLineCards := make([]string, 0) + for _, lc := range lineCards { + compMtyVal, ok := gnmi.Lookup(t, dut, gnmi.OC().Component(lc).Empty().State()).Val() + if !compMtyVal && ok { + chassisLineCards = append(chassisLineCards, lc) + } + } + lineCards = chassisLineCards checkComponents := append(controllerCards, lineCards...) checkComponents = append(checkComponents, fabricCards...) if len(checkComponents) == 0 { @@ -246,6 +262,14 @@ func TestLineCardsNoHighCPUSpike(t *testing.T) { lineCards := components.FindComponentsByType(t, dut, lineCardType) cpuCards := components.FindComponentsByType(t, dut, cpuType) + chassisLineCards := make([]string, 0) + for _, lc := range lineCards { + compMtyVal, ok := gnmi.Lookup(t, dut, gnmi.OC().Component(lc).Empty().State()).Val() + if !compMtyVal && ok { + chassisLineCards = append(chassisLineCards, lc) + } + } + lineCards = chassisLineCards if len(lineCards) == 0 || len(cpuCards) == 0 { t.Errorf("ERROR: No controllerCard or cpuCard has been found.") } @@ -288,6 +312,14 @@ func TestComponentsNoHighMemoryUtilization(t *testing.T) { controllerCards := components.FindComponentsByType(t, dut, controllerCardType) lineCards := components.FindComponentsByType(t, dut, lineCardType) + chassisLineCards := make([]string, 0) + for _, lc := range lineCards { + compMtyVal, ok := gnmi.Lookup(t, dut, gnmi.OC().Component(lc).Empty().State()).Val() + if !compMtyVal && ok { + chassisLineCards = append(chassisLineCards, lc) + } + } + lineCards = chassisLineCards cardList := append(controllerCards, lineCards...) if len(cardList) == 0 { t.Errorf("ERROR: No card has been found.") From 6cf808c3d90a6f790c9b2b276037b57c0fdffaa3 Mon Sep 17 00:00:00 2001 From: lvaish05 Date: Tue, 21 Jan 2025 21:46:02 -0800 Subject: [PATCH 2/3] skipping test for FFF --- .../system_generic_health_check_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go index 5b7764fd7c1..cc0dee30974 100644 --- a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go +++ b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go @@ -269,6 +269,12 @@ func TestLineCardsNoHighCPUSpike(t *testing.T) { chassisLineCards = append(chassisLineCards, lc) } } + + for _, lc := range lineCards { + if !gnmi.Get(t, dut, gnmi.OC().Component(lc).Removable().State()) { + t.Skipf("Skip the test on non-removable linecard.") + } + } lineCards = chassisLineCards if len(lineCards) == 0 || len(cpuCards) == 0 { t.Errorf("ERROR: No controllerCard or cpuCard has been found.") @@ -324,6 +330,7 @@ func TestComponentsNoHighMemoryUtilization(t *testing.T) { if len(cardList) == 0 { t.Errorf("ERROR: No card has been found.") } + for _, component := range cardList { t.Run(component, func(t *testing.T) { query := gnmi.OC().Component(component).State() @@ -333,7 +340,9 @@ func TestComponentsNoHighMemoryUtilization(t *testing.T) { if componentType == lineCardType && deviations.LinecardMemoryUtilizationUnsupported(dut) { t.Skipf("INFO: Skipping test for linecard component %s due to deviation linecard_memory_utilization_unsupported", component) } - + if componentType == lineCardType && !gnmi.Get(t, dut, gnmi.OC().Component(component).Removable().State()) { + t.Skipf("Skip the test on non-removable linecard.") + } memoryState := componentState.GetMemory() if memoryState == nil { t.Errorf("ERROR: %s - Device: %s - %s: %-40s - Type: %-20s - Memory data not available", From f092655ff909b681d0c553215346279240d3df4d Mon Sep 17 00:00:00 2001 From: lvaish05 Date: Thu, 23 Jan 2025 19:56:05 -0800 Subject: [PATCH 3/3] edited the check from lineCards to chassisLineCards --- .../system_generic_health_check_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go index cc0dee30974..5b68e3b74cc 100644 --- a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go +++ b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go @@ -270,7 +270,7 @@ func TestLineCardsNoHighCPUSpike(t *testing.T) { } } - for _, lc := range lineCards { + for _, lc := range chassisLineCards { if !gnmi.Get(t, dut, gnmi.OC().Component(lc).Removable().State()) { t.Skipf("Skip the test on non-removable linecard.") }