Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
dutLAGNames []string
}

func (d *testData) waitInterface(t *testing.T) {

Check failure on line 144 in feature/mtu/largeippacket/otg_tests/large_ip_packet_transmission/large_ip_packet_transmission_test.go

View workflow job for this annotation

GitHub Actions / Static Analysis

func (*testData).waitInterface is unused (U1000)

Check failure on line 144 in feature/mtu/largeippacket/otg_tests/large_ip_packet_transmission/large_ip_packet_transmission_test.go

View workflow job for this annotation

GitHub Actions / Static Analysis

func (*testData).waitInterface is unused (U1000)
otgutils.WaitForARP(t, d.otg, d.otgConfig, d.flowProto)
}

Expand Down Expand Up @@ -172,26 +172,41 @@
return flow
}

func runTest(t *testing.T, tt testDefinition, td testData, waitF func(t *testing.T)) {
t.Logf("Name: %s, Description: %s", tt.name, tt.desc)
func addAllFlows(otgConfig gosnappi.Config) {
for _, tt := range testCases {
for _, flowProto := range []string{ipv4, ipv6} {
flowName := fmt.Sprintf("%s-%s", tt.name, flowProto)
flow := createFlow(flowName, tt.flowSize, flowProto)
otgConfig.Flows().Append(flow)
}
}
}

flowParams := createFlow(tt.name, tt.flowSize, td.flowProto)
td.otgConfig.Flows().Clear()
td.otgConfig.Flows().Append(flowParams)
td.otg.PushConfig(t, td.otgConfig)
time.Sleep(time.Second * 30)
td.otg.StartProtocols(t)
waitF(t)
func runTest(t *testing.T, tt testDefinition, td testData) {
t.Logf("Name: %s, Description: %s, Proto: %s", tt.name, tt.desc, td.flowProto)

flowName := fmt.Sprintf("%s-%s", tt.name, td.flowProto)

// Start traffic for this flow only
controlState := gosnappi.NewControlState()
controlState.Traffic().FlowTransmit().SetState(gosnappi.StateTrafficFlowTransmitState.START).SetFlowNames([]string{flowName})
td.otg.SetControlState(t, controlState)

td.otg.StartTraffic(t)
time.Sleep(trafficRunDuration)

td.otg.StopTraffic(t)
// Stop traffic for this flow
controlState = gosnappi.NewControlState()
controlState.Traffic().FlowTransmit().SetState(gosnappi.StateTrafficFlowTransmitState.STOP).SetFlowNames([]string{flowName})
td.otg.SetControlState(t, controlState)

time.Sleep(trafficStopWaitDuration)

otgutils.LogFlowMetrics(t, td.otg, td.otgConfig)
// Log metrics only for this flow to avoid spamming
logConfig := gosnappi.NewConfig()
logConfig.Flows().Append(gosnappi.NewFlow().SetName(flowName))
otgutils.LogFlowMetrics(t, td.otg, logConfig)

flow := gnmi.OTG().Flow(tt.name)
flow := gnmi.OTG().Flow(flowName)
flowCounters := flow.Counters()

outPkts := gnmi.Get(t, td.otg, flowCounters.OutPkts().State())
Expand Down Expand Up @@ -373,7 +388,18 @@

func testLargeIPPacketTransmission(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra.ATEDevice, otg *otg.OTG) {
configureDUT(t, dut)
t.Cleanup(func() {
cleanUpPhysical(t, dut)
})
otgConfig := configureATE(t, ate)
addAllFlows(otgConfig)

otg.PushConfig(t, otgConfig)
time.Sleep(time.Second * 30)
otg.StartProtocols(t)
Comment thread
RishabhAgarwal-2001 marked this conversation as resolved.

otgutils.WaitForARP(t, otg, otgConfig, ipv4)
otgutils.WaitForARP(t, otg, otgConfig, ipv6)

for _, tt := range testCases {
for _, flowProto := range []string{ipv4, ipv6} {
Expand All @@ -384,7 +410,7 @@
}

t.Run(fmt.Sprintf("MTU-1.3.1-%s-%s-physical", tt.name, flowProto), func(t *testing.T) {
runTest(t, tt, td, td.waitInterface)
runTest(t, tt, td)
})
}
}
Expand Down Expand Up @@ -594,7 +620,19 @@
lagOne := configureDUTBundle(t, dut, dutSrc, lagOneDutBundleMembers)
lagTwo := configureDUTBundle(t, dut, dutDst, lagTwoDutBundleMembers)

t.Cleanup(func() {
cleanUpBundle(t, dut, lagOne, lagTwo, allDutBundleMembers)
})

otgConfig := configureATEBundles(allAtePorts, bundleMemberCount)
addAllFlows(otgConfig)

otg.PushConfig(t, otgConfig)
time.Sleep(time.Second * 30)
otg.StartProtocols(t)
Comment thread
RishabhAgarwal-2001 marked this conversation as resolved.

otgutils.WaitForARP(t, otg, otgConfig, ipv4)
otgutils.WaitForARP(t, otg, otgConfig, ipv6)

for _, tt := range testCases {
for _, flowProto := range []string{ipv4, ipv6} {
Expand All @@ -607,14 +645,10 @@
}

t.Run(fmt.Sprintf("MTU-1.3.1-%s-%s-bundle", tt.name, flowProto), func(t *testing.T) {
runTest(t, tt, td, td.waitInterface)
runTest(t, tt, td)
})
}
}

t.Run("MTU-1.3.1-cleanup-bundle", func(t *testing.T) {
cleanUpBundle(t, dut, lagOne, lagTwo, allDutBundleMembers)
})
}

func TestLargeIPPacketTransmission(t *testing.T) {
Expand All @@ -623,8 +657,5 @@
otg := ate.OTG()

testLargeIPPacketTransmission(t, dut, ate, otg)
t.Run("MTU-1.3.1-cleanup-physical", func(t *testing.T) {
cleanUpPhysical(t, dut)
})
testLargeIPPacketTransmissionBundle(t, dut, ate, otg)
Comment thread
RishabhAgarwal-2001 marked this conversation as resolved.
Outdated
}
Loading