Skip to content

Commit

Permalink
GNMI-1.11: Adding tolerance for incoming/outgoing packet delta equiva…
Browse files Browse the repository at this point in the history
…lence check (openconfig#2401)

* GNMI-1.11: Removing incoming/outgoing packet delta equivalence check

When incoming and outgoing ports are in different linecards, the packet
counters for ongoing traffic in gnmi-subscription may have difference in
update duration.

Considering that gnmi-subscription update equivalence check
may not be valid on multiple linecard dut, thus removing it.

"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* Instead of removing the check, adding tolerance as per discussion in b/315929197
  • Loading branch information
trathod1 authored Dec 20, 2023
1 parent 08c9021 commit 438d3fd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,17 @@ func validateInAndOutPktsPerSecond(t *testing.T, dut *ondatra.DUTDevice, i1, i2
return pktCounterOK
}

var tolerance = uint64(70)
for i := 1; i < len(inPkts); i++ {
inValOld, _ := inPkts[i-1].Val()
outValOld, _ := outPkts[i-1].Val()
inValLatest, _ := inPkts[i].Val()
outValLatest, _ := outPkts[i].Val()
inValDelta := inValLatest - inValOld
outValDelta := outValLatest - outValOld
t.Logf("Incoming Packets: %d, Outgoing Packets: %d", inValLatest, outValLatest)
if inValLatest == inValOld || outValLatest == outValOld || (inValLatest-inValOld != outValLatest-outValOld) {
t.Logf("Comparison with previous iteration: Incoming Packets Delta : %d, Outgoing Packets Delta: %d", inValLatest-inValOld, outValLatest-outValOld)
if inValLatest == inValOld || outValLatest == outValOld || outValDelta <= inValDelta-tolerance || outValDelta >= inValDelta+tolerance {
t.Logf("Comparison with previous iteration: Incoming Packets Delta : %d, Outgoing Packets Delta: %d, Tolerance: %d", inValDelta, outValDelta, tolerance)
pktCounterOK = false
break
}
Expand Down

0 comments on commit 438d3fd

Please sign in to comment.