@@ -553,6 +553,29 @@ func testNoCongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *on
553553 }
554554 }
555555
556+ // Wait for ALL tagged metrics to populate first
557+ deadline := time .Now ().Add (45 * time .Second )
558+ metricsPopulated := false
559+ for time .Now ().Before (deadline ) {
560+ allFound := true
561+ for dscpValue := 0 ; dscpValue < 64 ; dscpValue ++ {
562+ etPath := gnmi .OTG ().Flow (fmt .Sprintf ("dscp-%d-%s" , dscpValue , atePort2 .Name )).TaggedMetricAny ()
563+ vals := gnmi .LookupAll (t , ate .OTG (), etPath .State ())
564+ if len (vals ) == 0 || ! vals [0 ].IsPresent () {
565+ allFound = false
566+ break
567+ }
568+ }
569+ if allFound {
570+ metricsPopulated = true
571+ break
572+ }
573+ time .Sleep (2 * time .Second )
574+ }
575+ if ! metricsPopulated {
576+ t .Fatalf ("Timed out waiting for tagged metrics to populate on the ATE" )
577+ }
578+
556579 for dscpValue := 0 ; dscpValue < 64 ; dscpValue ++ {
557580 etPath := gnmi .OTG ().Flow (fmt .Sprintf ("dscp-%d-%s" , dscpValue , atePort2 .Name )).TaggedMetricAny ()
558581 ets := gnmi .GetAll (t , ate .OTG (), etPath .State ())
@@ -655,6 +678,35 @@ func testCongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *onda
655678
656679 var congestedFlowCount int
657680
681+ // Wait for ALL tagged metrics across both ports to populate first
682+ deadline := time .Now ().Add (45 * time .Second )
683+ metricsPopulated := false
684+ for time .Now ().Before (deadline ) {
685+ allFound := true
686+ for _ , sourceAtePort := range []* attrs.Attributes {atePort2 , atePort3 } {
687+ for dscpValue := 0 ; dscpValue < 64 ; dscpValue ++ {
688+ etPath := gnmi .OTG ().Flow (fmt .Sprintf ("dscp-%d-%s" , dscpValue , sourceAtePort .Name )).TaggedMetricAny ()
689+ vals := gnmi .LookupAll (t , ate .OTG (), etPath .State ())
690+ if len (vals ) == 0 || ! vals [0 ].IsPresent () {
691+ allFound = false
692+ break
693+ }
694+ }
695+ if ! allFound {
696+ break
697+ }
698+ }
699+ if allFound {
700+ metricsPopulated = true
701+ break
702+ }
703+ time .Sleep (2 * time .Second )
704+ }
705+
706+ if ! metricsPopulated {
707+ t .Fatalf ("Timed out waiting for tagged metrics to populate on the ATE" )
708+ }
709+
658710 // These should have the majority of flows have ecn set.
659711 for _ , sourceAtePort := range []* attrs.Attributes {atePort2 , atePort3 } {
660712 for dscpValue := 0 ; dscpValue < 48 ; dscpValue ++ {
@@ -789,6 +841,35 @@ func testNC1CongestionValidateFlows(t *testing.T, dut *ondatra.DUTDevice, ate *o
789841
790842 var congestedFlowCount int
791843
844+ // Wait for ALL 48-63 tagged metrics to populate first
845+ deadline := time .Now ().Add (45 * time .Second )
846+ metricsPopulated := false
847+ for time .Now ().Before (deadline ) {
848+ allFound := true
849+ for _ , sourceAtePort := range []* attrs.Attributes {atePort2 , atePort3 } {
850+ for dscpValue := 48 ; dscpValue < 64 ; dscpValue ++ {
851+ etPath := gnmi .OTG ().Flow (fmt .Sprintf ("dscp-%d-%s" , dscpValue , sourceAtePort .Name )).TaggedMetricAny ()
852+ vals := gnmi .LookupAll (t , ate .OTG (), etPath .State ())
853+ if len (vals ) == 0 || ! vals [0 ].IsPresent () {
854+ allFound = false
855+ break
856+ }
857+ }
858+ if ! allFound {
859+ break
860+ }
861+ }
862+ if allFound {
863+ metricsPopulated = true
864+ break
865+ }
866+ time .Sleep (2 * time .Second )
867+ }
868+
869+ if ! metricsPopulated {
870+ t .Fatalf ("Timed out waiting for tagged metrics to populate on the ATE" )
871+ }
872+
792873 for _ , sourceAtePort := range []* attrs.Attributes {atePort2 , atePort3 } {
793874 for dscpValue := 48 ; dscpValue < 64 ; dscpValue ++ {
794875 etPath := gnmi .OTG ().Flow (fmt .Sprintf ("dscp-%d-%s" , dscpValue , sourceAtePort .Name )).TaggedMetricAny ()
0 commit comments