From df66e1e5308dabee789bcc9e56debb1d5508d57c Mon Sep 17 00:00:00 2001 From: AmrNJ <155722765+AmrNJ@users.noreply.github.com> Date: Thu, 21 May 2026 11:08:56 +0530 Subject: [PATCH 1/2] Update dscp_transparency_test.go --- .../dscp_transparency_test.go | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go b/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go index d0020cf98d2..1d1563dc009 100644 --- a/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go +++ b/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go @@ -553,6 +553,29 @@ func testNoCongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *on } } + // Wait for ALL tagged metrics to populate first + deadline := time.Now().Add(45 * time.Second) + metricsPopulated := false + for time.Now().Before(deadline) { + allFound := true + for dscpValue := 0; dscpValue < 64; dscpValue++ { + etPath := gnmi.OTG().Flow(fmt.Sprintf("dscp-%d-%s", dscpValue, atePort2.Name)).TaggedMetricAny() + vals := gnmi.LookupAll(t, ate.OTG(), etPath.State()) + if len(vals) == 0 || !vals[0].IsPresent() { + allFound = false + break + } + } + if allFound { + metricsPopulated = true + break + } + time.Sleep(2 * time.Second) + } + if !metricsPopulated { + t.Fatalf("Timed out waiting for tagged metrics to populate on the ATE") + } + for dscpValue := 0; dscpValue < 64; dscpValue++ { etPath := gnmi.OTG().Flow(fmt.Sprintf("dscp-%d-%s", dscpValue, atePort2.Name)).TaggedMetricAny() ets := gnmi.GetAll(t, ate.OTG(), etPath.State()) @@ -655,6 +678,35 @@ func testCongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *onda var congestedFlowCount int + // Wait for ALL tagged metrics across both ports to populate first + deadline := time.Now().Add(45 * time.Second) + metricsPopulated := false + for time.Now().Before(deadline) { + allFound := true + for _, sourceAtePort := range []*attrs.Attributes{atePort2, atePort3} { + for dscpValue := 0; dscpValue < 64; dscpValue++ { + etPath := gnmi.OTG().Flow(fmt.Sprintf("dscp-%d-%s", dscpValue, sourceAtePort.Name)).TaggedMetricAny() + vals := gnmi.LookupAll(t, ate.OTG(), etPath.State()) + if len(vals) == 0 || !vals[0].IsPresent() { + allFound = false + break + } + } + if !allFound { + break + } + } + if allFound { + metricsPopulated = true + break + } + time.Sleep(2 * time.Second) + } + + if !metricsPopulated { + t.Fatalf("Timed out waiting for tagged metrics to populate on the ATE") + } + // These should have the majority of flows have ecn set. for _, sourceAtePort := range []*attrs.Attributes{atePort2, atePort3} { for dscpValue := 0; dscpValue < 48; dscpValue++ { @@ -789,6 +841,35 @@ func testNC1CongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *o var congestedFlowCount int + // Wait for ALL 48-63 tagged metrics to populate first + deadline := time.Now().Add(45 * time.Second) + metricsPopulated := false + for time.Now().Before(deadline) { + allFound := true + for _, sourceAtePort := range []*attrs.Attributes{atePort2, atePort3} { + for dscpValue := 48; dscpValue < 64; dscpValue++ { + etPath := gnmi.OTG().Flow(fmt.Sprintf("dscp-%d-%s", dscpValue, sourceAtePort.Name)).TaggedMetricAny() + vals := gnmi.LookupAll(t, ate.OTG(), etPath.State()) + if len(vals) == 0 || !vals[0].IsPresent() { + allFound = false + break + } + } + if !allFound { + break + } + } + if allFound { + metricsPopulated = true + break + } + time.Sleep(2 * time.Second) + } + + if !metricsPopulated { + t.Fatalf("Timed out waiting for tagged metrics to populate on the ATE") + } + for _, sourceAtePort := range []*attrs.Attributes{atePort2, atePort3} { for dscpValue := 48; dscpValue < 64; dscpValue++ { etPath := gnmi.OTG().Flow(fmt.Sprintf("dscp-%d-%s", dscpValue, sourceAtePort.Name)).TaggedMetricAny() From 88d36c77b7fd3eb1a700768bd5f2a77b07423c6a Mon Sep 17 00:00:00 2001 From: AmrNJ <155722765+AmrNJ@users.noreply.github.com> Date: Fri, 22 May 2026 04:54:15 +0000 Subject: [PATCH 2/2] gofmt --- .../otg_tests/dscp_transparency_test/dscp_transparency_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go b/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go index 1d1563dc009..beeccbec160 100644 --- a/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go +++ b/feature/qos/ecn/otg_tests/dscp_transparency_test/dscp_transparency_test.go @@ -706,7 +706,7 @@ func testCongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *onda if !metricsPopulated { t.Fatalf("Timed out waiting for tagged metrics to populate on the ATE") } - + // These should have the majority of flows have ecn set. for _, sourceAtePort := range []*attrs.Attributes{atePort2, atePort3} { for dscpValue := 0; dscpValue < 48; dscpValue++ {