diff --git a/feature/gnoi/system/tests/ping_test/ping_test.go b/feature/gnoi/system/tests/ping_test/ping_test.go index 8feddae2b22..3be1b666930 100644 --- a/feature/gnoi/system/tests/ping_test/ping_test.go +++ b/feature/gnoi/system/tests/ping_test/ping_test.go @@ -43,7 +43,7 @@ const ( minimumMinTime = 1 minimumAvgTime = 1 minimumMaxTime = 1 - //StdDeviation would be 0 if we only send 1 ping. + // StdDeviation would be 0 if we only send 1 ping. minimumStdDev = 1 ) @@ -178,6 +178,7 @@ func TestGNOIPing(t *testing.T) { Destination: ipv4Addrs[0].GetIp(), Source: ipv4Addrs[0].GetIp(), L3Protocol: tpb.L3Protocol_IPV4, + Count: 10, }, expectedReply: commonExpectedIPv4Reply, expectedStats: commonExpectedReplyStats, @@ -469,7 +470,7 @@ func TestGNOIPing(t *testing.T) { t.Errorf("Ping MaxTime: got %v, want >= %v", summary.MaxTime, tc.expectedStats.MaxTime) } if summary.StdDev < tc.expectedStats.StdDev && !StdDevZero { - t.Errorf("Ping MaxTime: got %v, want >= %v", summary.StdDev, tc.expectedStats.StdDev) + t.Errorf("Ping Standard Deviation: got %v, want >= %v", summary.StdDev, tc.expectedStats.StdDev) } }) } diff --git a/feature/interface/aggregate/otg_tests/aggregate_forwarding_viable_test/aggregate_forwarding_viable_test.go b/feature/interface/aggregate/otg_tests/aggregate_forwarding_viable_test/aggregate_forwarding_viable_test.go index be892937519..afbb72322b5 100644 --- a/feature/interface/aggregate/otg_tests/aggregate_forwarding_viable_test/aggregate_forwarding_viable_test.go +++ b/feature/interface/aggregate/otg_tests/aggregate_forwarding_viable_test/aggregate_forwarding_viable_test.go @@ -49,6 +49,7 @@ import ( "github.com/openconfig/ondatra/gnmi" "github.com/openconfig/ondatra/gnmi/oc" "github.com/openconfig/ondatra/netutil" + "github.com/openconfig/ygnmi/ygnmi" "github.com/openconfig/ygot/ygot" ) @@ -342,8 +343,8 @@ func (tc *testArgs) configureATE(t *testing.T) { // Adding the rest of the ports to the configuration and to the LAG agg := tc.top.Lags().Add().SetName(ateDst.Name) if tc.lagType == lagTypeSTATIC { - lagId, _ := strconv.Atoi(tc.aggID) - agg.Protocol().Static().SetLagId(uint32(lagId)) + lagID, _ := strconv.Atoi(tc.aggID) + agg.Protocol().Static().SetLagId(uint32(lagID)) for i, p := range tc.atePorts[1:] { port := tc.top.Ports().Add().SetName(p.ID()) newMac, err := incrementMAC(ateDst.MAC, i+1) @@ -476,7 +477,7 @@ func debugATEFlows(t *testing.T, ate *ondatra.ATEDevice, flow gosnappi.Flow, lp func (tc *testArgs) verifyCounterDiff(t *testing.T, before, after []*oc.Interface_Counters, want []float64) { b := &strings.Builder{} w := tabwriter.NewWriter(b, 0, 0, 1, ' ', 0) - approxOpt := cmpopts.EquateApprox(0 /* frac */, 0.01 /* absolute */) + approxOpt := cmpopts.EquateApprox(0 /* frac */, 0.1 /* absolute */) fmt.Fprint(w, "Interface Counter Deltas\n\n") fmt.Fprint(w, "Name\tInPkts\tInOctets\tOutPkts\tOutOctets\n") allOutPkts := []uint64{} @@ -519,17 +520,18 @@ func (tc *testArgs) testAggregateForwardingFlow(t *testing.T, forwardingViable b t.Log("First port does not forward traffic because it is marked as not viable.") gnmi.Update(t, tc.dut, gnmi.OC().Interface(pName).ForwardingViable().Config(), forwardingViable) } - - v := gnmi.Lookup(t, tc.dut, gnmi.OC().Interface(pName).ForwardingViable().State()) - got, present := v.Val() - t.Logf("First port %s forwarding-viable: got %v, present %v, want %v", pName, got, present, forwardingViable) - switch { - case present && got != forwardingViable: - t.Errorf("First port %s forwarding-viable: got %t, want %t", pName, got, forwardingViable) - case !present && !deviations.MissingValueForDefaults(tc.dut): - t.Errorf("First port %s forwarding-viable value not found", pName) - case !present && deviations.MissingValueForDefaults(tc.dut) && !forwardingViable: - t.Errorf("First port %s forwarding-viable defaults true not equal to %t", pName, forwardingViable) + v, ok := gnmi.Watch(t, tc.dut, gnmi.OC().Interface(pName).ForwardingViable().State(), time.Minute, func(v *ygnmi.Value[bool]) bool { + val, ok := v.Val() + if !ok && !deviations.MissingValueForDefaults(tc.dut) { + return false + } + if !ok && deviations.MissingValueForDefaults(tc.dut) { + return forwardingViable + } + return val == forwardingViable + }).Await(t) + if !ok { + t.Errorf("First port %s forwarding-viable mismatch: got %v, want %v", pName, v, forwardingViable) } i1 := ateSrc.Name @@ -553,7 +555,7 @@ func (tc *testArgs) testAggregateForwardingFlow(t *testing.T, forwardingViable b beforeTrafficCounters := tc.getCounters(t, "before") tc.ate.OTG().StartTraffic(t) - time.Sleep(15 * time.Second) + time.Sleep(time.Minute) tc.ate.OTG().StopTraffic(t) otgutils.LogFlowMetrics(t, tc.ate.OTG(), tc.top)