Skip to content

Commit b8bdf2b

Browse files
authored
Merge branch 'main' into certz4
2 parents 5fbacb6 + 7bef42c commit b8bdf2b

11 files changed

Lines changed: 191 additions & 48 deletions

File tree

feature/container/containerz/tests/container_lifecycle/containerz_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ func TestDeployAndStartContainer(t *testing.T) {
134134
func TestRetrieveLogs(t *testing.T) {
135135
ctx := context.Background()
136136
dut := ondatra.DUT(t, "dut")
137+
if deviations.ContainerzRetrieveLogsUnsupported(dut) {
138+
t.Skip("Skipping test due to deviation containerz_retrieve_logs_unsupported")
139+
}
137140
baseCli := containerztest.Client(t, dut)
138141

139142
// Positive Test: Retrieve logs from a running container

feature/container/containerz/tests/container_lifecycle/metadata.textproto

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@ platform_exceptions: {
2222
deviations: {
2323
containerz_plugin_rpc_unsupported: true
2424
}
25-
}
25+
}
26+
27+
platform_exceptions: {
28+
platform: {
29+
vendor: JUNIPER
30+
}
31+
deviations: {
32+
containerz_retrieve_logs_unsupported: true
33+
}
34+
}

feature/isis/otg_tests/isis_metric_style_wide_not_enabled_test/isis_metric_style_wide_not_enabled_test.go

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) {
9999
globalISIS.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true)
100100
globalISIS.LevelCapability = oc.Isis_LevelType_LEVEL_2
101101
globalISIS.AuthenticationCheck = ygot.Bool(true)
102+
if deviations.ISISGlobalAuthenticationNotRequired(ts.DUT) {
103+
globalISIS.AuthenticationCheck = nil
104+
}
105+
globalISIS.HelloPadding = oc.Isis_HelloPaddingType_ADAPTIVE
102106

103107
// Level configs.
104108
level := isis.GetOrCreateLevel(2)
@@ -111,6 +115,11 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) {
111115
auth.AuthMode = oc.IsisTypes_AUTH_MODE_MD5
112116
auth.AuthType = oc.KeychainTypes_AUTH_TYPE_SIMPLE_KEY
113117
auth.AuthPassword = ygot.String(password)
118+
if deviations.ISISExplicitLevelAuthenticationConfig(ts.DUT) {
119+
auth.DisableCsnp = ygot.Bool(false)
120+
auth.DisableLsp = ygot.Bool(false)
121+
auth.DisablePsnp = ygot.Bool(false)
122+
}
114123

115124
// Interface configs.
116125
intfName := ts.DUTPort1.Name()
@@ -145,6 +154,10 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) {
145154
isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Metric = ygot.Uint32(dutV4Metric)
146155
isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true)
147156
isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Metric = ygot.Uint32(dutV6Metric)
157+
if deviations.MissingIsisInterfaceAfiSafiEnable(ts.DUT) {
158+
isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = nil
159+
isisIntfLevel.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = nil
160+
}
148161
}
149162

150163
// configureOTG configures isis and traffic on OTG.
@@ -213,13 +226,15 @@ func TestISISWideMetricNotEnabled(t *testing.T) {
213226
fptest.LogQuery(t, "Protocol ISIS", isissession.ProtocolPath(ts.DUT).Config(), pcl)
214227

215228
ts.PushAndStart(t)
229+
time.Sleep(time.Minute * 2)
216230

217231
statePath := isissession.ISISPath(ts.DUT)
218232
intfName := ts.DUTPort1.Name()
219233
if deviations.ExplicitInterfaceInDefaultVRF(ts.DUT) || deviations.InterfaceRefInterfaceIDFormat(ts.DUT) {
220234
intfName += ".0"
221235
}
222236
t.Run("Isis telemetry", func(t *testing.T) {
237+
223238
// Checking adjacency
224239
ateSysID, err := ts.AwaitAdjacency()
225240
if err != nil {
@@ -265,8 +280,10 @@ func TestISISWideMetricNotEnabled(t *testing.T) {
265280
if got := gnmi.Get(t, ts.DUT, adjPath.LocalExtendedCircuitId().State()); got == 0 {
266281
t.Errorf("FAIL- Expected local extended circuit id not found,expected non-zero value, got %d", got)
267282
}
268-
if got := gnmi.Get(t, ts.DUT, adjPath.MultiTopology().State()); got != false {
269-
t.Errorf("FAIL- Expected value for multi topology not found, got %t, want %t", got, false)
283+
if !deviations.ISISMultiTopologyUnsupported(ts.DUT) {
284+
if got := gnmi.Get(t, ts.DUT, adjPath.MultiTopology().State()); got != false {
285+
t.Errorf("FAIL- Expected value for multi topology not found, got %t, want %t", got, false)
286+
}
270287
}
271288
if got := gnmi.Get(t, ts.DUT, adjPath.NeighborCircuitType().State()); got != oc.Isis_LevelType_LEVEL_2 {
272289
t.Errorf("FAIL- Expected value for circuit type not found, got %s, want %s", got, oc.Isis_LevelType_LEVEL_2)
@@ -304,43 +321,66 @@ func TestISISWideMetricNotEnabled(t *testing.T) {
304321
}
305322
})
306323
t.Run("System level counter checks", func(t *testing.T) {
307-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().AuthFails().State()); got != 0 {
308-
t.Errorf("FAIL- Not expecting any authentication key failure, got %d, want %d", got, 0)
324+
if !deviations.MissingValueForDefaults(ts.DUT) {
325+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().AuthFails().State()); got != 0 {
326+
t.Errorf("FAIL- Not expecting any authentication key failure, got %d, want %d", got, 0)
327+
}
309328
}
310-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().AuthTypeFails().State()); got != 0 {
311-
t.Errorf("FAIL- Not expecting any authentication type mismatches, got %d, want %d", got, 0)
329+
if !deviations.MissingValueForDefaults(ts.DUT) {
330+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().AuthTypeFails().State()); got != 0 {
331+
t.Errorf("FAIL- Not expecting any authentication type mismatches, got %d, want %d", got, 0)
332+
}
312333
}
313-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().CorruptedLsps().State()); got != 0 {
314-
t.Errorf("FAIL- Not expecting any corrupted lsps, got %d, want %d", got, 0)
334+
if !deviations.MissingValueForDefaults(ts.DUT) {
335+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().CorruptedLsps().State()); got != 0 {
336+
t.Errorf("FAIL- Not expecting any corrupted lsps, got %d, want %d", got, 0)
337+
}
315338
}
316-
if !deviations.IsisDatabaseOverloadsUnsupported(ts.DUT) {
339+
340+
if !deviations.IsisDatabaseOverloadsUnsupported(ts.DUT) && !deviations.MissingValueForDefaults(ts.DUT) {
317341
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().DatabaseOverloads().State()); got != 0 {
318342
t.Errorf("FAIL- Not expecting pre isis config database_overloads value to change, got %d, want %d", got, 0)
319343
}
320344
}
321-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ExceedMaxSeqNums().State()); got != 0 {
322-
t.Errorf("FAIL- Not expecting non zero max_seqnum counter, got %d, want %d", got, 0)
345+
if !deviations.MissingValueForDefaults(ts.DUT) {
346+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ExceedMaxSeqNums().State()); got != 0 {
347+
t.Errorf("FAIL- Not expecting non zero max_seqnum counter, got %d, want %d", got, 0)
348+
}
323349
}
324-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().IdLenMismatch().State()); got != 0 {
325-
t.Errorf("FAIL- Not expecting non zero IdLen_Mismatch counter, got %d, want %d", got, 0)
350+
if !deviations.MissingValueForDefaults(ts.DUT) {
351+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().IdLenMismatch().State()); got != 0 {
352+
t.Errorf("FAIL- Not expecting non zero IdLen_Mismatch counter, got %d, want %d", got, 0)
353+
}
326354
}
327-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().LspErrors().State()); got != 0 {
328-
t.Errorf("FAIL- Not expecting any lsp errors, got %d, want %d", got, 0)
355+
if !deviations.MissingValueForDefaults(ts.DUT) {
356+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().LspErrors().State()); got != 0 {
357+
t.Errorf("FAIL- Not expecting any lsp errors, got %d, want %d", got, 0)
358+
}
329359
}
330-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().MaxAreaAddressMismatches().State()); got != 0 {
331-
t.Errorf("FAIL- Not expecting non zero MaxAreaAddressMismatches counter, got %d, want %d", got, 0)
360+
if !deviations.MissingValueForDefaults(ts.DUT) {
361+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().MaxAreaAddressMismatches().State()); got != 0 {
362+
t.Errorf("FAIL- Not expecting non zero MaxAreaAddressMismatches counter, got %d, want %d", got, 0)
363+
}
332364
}
333-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().OwnLspPurges().State()); got != 0 {
334-
t.Errorf("FAIL- Not expecting non zero OwnLspPurges counter, got %d, want %d", got, 0)
365+
if !deviations.MissingValueForDefaults(ts.DUT) {
366+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().OwnLspPurges().State()); got != 0 {
367+
t.Errorf("FAIL- Not expecting non zero OwnLspPurges counter, got %d, want %d", got, 0)
368+
}
335369
}
336-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().SeqNumSkips().State()); got != 0 {
337-
t.Errorf("FAIL- Not expecting non zero SeqNumber skips, got %d, want %d", got, 0)
370+
if !deviations.MissingValueForDefaults(ts.DUT) {
371+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().SeqNumSkips().State()); got != 0 {
372+
t.Errorf("FAIL- Not expecting non zero SeqNumber skips, got %d, want %d", got, 0)
373+
}
338374
}
339-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ManualAddressDropFromAreas().State()); got != 0 {
340-
t.Errorf("FAIL- Not expecting non zero ManualAddressDropFromAreas counter, got %d, want %d", got, 0)
375+
if !deviations.MissingValueForDefaults(ts.DUT) && !deviations.ISISCounterManualAddressDropFromAreasUnsupported(ts.DUT) {
376+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().ManualAddressDropFromAreas().State()); got != 0 {
377+
t.Errorf("FAIL- Not expecting non zero ManualAddressDropFromAreas counter, got %d, want %d", got, 0)
378+
}
341379
}
342-
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().PartChanges().State()); got != 0 {
343-
t.Errorf("FAIL- Not expecting partition changes, got %d, want %d", got, 0)
380+
if !deviations.MissingValueForDefaults(ts.DUT) && !deviations.ISISCounterPartChangesUnsupported(ts.DUT) {
381+
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().PartChanges().State()); got != 0 {
382+
t.Errorf("FAIL- Not expecting partition changes, got %d, want %d", got, 0)
383+
}
344384
}
345385
if got := gnmi.Get(t, ts.DUT, statePath.Level(2).SystemLevelCounters().SpfRuns().State()); got == 0 {
346386
t.Errorf("FAIL- Not expecting spf runs counter to be 0, got %d, want non zero", got)

feature/isis/otg_tests/isis_metric_style_wide_not_enabled_test/metadata.textproto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ platform_exceptions: {
1010
vendor: NOKIA
1111
}
1212
deviations: {
13+
isis_multi_topology_unsupported: true
14+
isis_dis_sysid_unsupported: true
15+
isis_global_authentication_not_required: true
16+
isis_explicit_level_authentication_config: true
1317
isis_interface_level1_disable_required: true
1418
missing_isis_interface_afi_safi_enable: true
1519
explicit_interface_in_default_vrf: true

feature/platform/tests/breakout_subscription_test/breakout_subscription_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,9 +1009,11 @@ func TestBreakoutSubscription(t *testing.T) {
10091009
}
10101010
expectedUpdatePaths := []string{
10111011
"/interfaces/interface/state/admin-status",
1012-
"/lacp/interfaces/interface/members/member/state/interface",
10131012
"/interfaces/interface/state/oper-status",
10141013
}
1014+
if !deviations.LACPInterfaceMemberStateInterfaceUnsupported(dut) {
1015+
expectedUpdatePaths = append(expectedUpdatePaths, "/lacp/interfaces/interface/members/member/state/interface")
1016+
}
10151017
verifyNotificationPaths(t, receivedNotifications, expectedUpdatePaths)
10161018
verifyUpdateValue(t, receivedNotifications, dut, "DOWN")
10171019

@@ -1049,9 +1051,11 @@ func TestBreakoutSubscription(t *testing.T) {
10491051
}
10501052
expectedUpdatePaths := []string{
10511053
"/interfaces/interface/state/admin-status",
1052-
"/lacp/interfaces/interface/members/member/state/interface",
10531054
"/interfaces/interface/state/oper-status",
10541055
}
1056+
if !deviations.LACPInterfaceMemberStateInterfaceUnsupported(dut) {
1057+
expectedUpdatePaths = append(expectedUpdatePaths, "/lacp/interfaces/interface/members/member/state/interface")
1058+
}
10551059
verifyNotificationPaths(t, receivedNotifications, expectedUpdatePaths)
10561060
})
10571061

feature/platform/tests/breakout_subscription_test/metadata.textproto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ platform_exceptions: {
2222
explicit_interface_in_default_vrf: true
2323
aggregate_atomic_update: true
2424
interface_enabled: true
25+
lacp_interface_member_state_interface_unsupported: true
2526
}
2627
}
2728
platform_exceptions: {

feature/system/logging/otg_tests/remote_syslog/metadata.textproto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@ platform_exceptions: {
2828
}
2929
}
3030

31+
platform_exceptions: {
32+
platform: {
33+
vendor: NOKIA
34+
}
35+
deviations: {
36+
static_protocol_name: "static"
37+
interface_enabled: true
38+
explicit_interface_in_default_vrf: true
39+
}
40+
}

feature/system/logging/otg_tests/remote_syslog/remote_syslog_test.go

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,22 @@ func TestMain(m *testing.M) {
106106

107107
func TestRemoteSyslog(t *testing.T) {
108108
dut := ondatra.DUT(t, "dut")
109+
109110
p1 := dut.Port(t, "port1")
110111
p2 := dut.Port(t, "port2")
111112
ate := ondatra.ATE(t, "ate")
112-
lb = netutil.LoopbackInterface(t, dut, 0)
113+
for i := 0; i < 10; i++ {
114+
tempLb := netutil.LoopbackInterface(t, dut, i)
115+
lo := gnmi.OC().Interface(tempLb).Subinterface(0)
116+
ipv4Addrs := gnmi.LookupAll(t, dut, lo.Ipv4().AddressAny().State())
117+
if len(ipv4Addrs) == 0 {
118+
lb = tempLb
119+
break
120+
}
121+
}
122+
if lb == "" {
123+
t.Fatalf("Failed to find a free loopback interface")
124+
}
113125

114126
top := configureATE(t, ate)
115127
createFlow(t, top, true)
@@ -136,11 +148,16 @@ func TestRemoteSyslog(t *testing.T) {
136148
if deviations.SyslogNonDefaultVrfUnsupported(dut) {
137149
t.Skipf("skipping the unsupported non-default VRF testcase")
138150
}
151+
// Delete interfaces from the default network instance before adding them to VRF.
152+
153+
for _, intf := range []string{p1.Name(), p2.Name(), lb} {
154+
gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Interface(intf+".0").Config())
155+
}
139156
createAndAddInterfacesToVRF(t, dut, tc.vrf, []string{p1.Name(), p2.Name(), lb}, []uint32{0, 0, 0})
140157
}
141158

142159
configureDUT(t, dut, &tc.vrf)
143-
configureDUTLoopback(t, dut)
160+
configureDUTLoopback(t, dut, &tc.vrf)
144161
configureStaticRoute(t, dut, tc.vrf)
145162
configureSyslog(t, dut, tc.vrf)
146163
ate.OTG().StartProtocols(t)
@@ -165,10 +182,17 @@ func TestRemoteSyslog(t *testing.T) {
165182
processCapture(t, ate, top)
166183

167184
t.Cleanup(func() {
185+
gnmi.Delete(t, dut, gnmi.OC().System().Logging().Config())
168186
gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(tc.vrf).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, "DEFAULT").Static(v4Route+"/30").Config())
169187
gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(tc.vrf).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, "DEFAULT").Static(v6Route+"/126").Config())
170188
if tc.vrf != deviations.DefaultNetworkInstance(dut) {
171189
gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(tc.vrf).Config())
190+
// Restore default network instance association
191+
if deviations.ExplicitInterfaceInDefaultVRF(dut) {
192+
fptest.AssignToNetworkInstance(t, dut, p1.Name(), deviations.DefaultNetworkInstance(dut), 0)
193+
fptest.AssignToNetworkInstance(t, dut, p2.Name(), deviations.DefaultNetworkInstance(dut), 0)
194+
fptest.AssignToNetworkInstance(t, dut, lb, deviations.DefaultNetworkInstance(dut), 0)
195+
}
172196
}
173197
flipATEPort(t, dut, ate, top, "port2", true)
174198
})
@@ -188,13 +212,12 @@ func configureDUT(t *testing.T, dut *ondatra.DUTDevice, vrfName *string) {
188212
fptest.SetPortSpeed(t, dp1)
189213
fptest.SetPortSpeed(t, dp2)
190214
}
191-
if deviations.ExplicitInterfaceInDefaultVRF(dut) {
192-
fptest.AssignToNetworkInstance(t, dut, dp1.Name(), deviations.DefaultNetworkInstance(dut), 0)
193-
fptest.AssignToNetworkInstance(t, dut, dp2.Name(), deviations.DefaultNetworkInstance(dut), 0)
194-
}
195-
196-
if vrfName == nil {
215+
if vrfName == nil || *vrfName == deviations.DefaultNetworkInstance(dut) {
197216
fptest.ConfigureDefaultNetworkInstance(t, dut)
217+
if deviations.ExplicitInterfaceInDefaultVRF(dut) {
218+
fptest.AssignToNetworkInstance(t, dut, dp1.Name(), deviations.DefaultNetworkInstance(dut), 0)
219+
fptest.AssignToNetworkInstance(t, dut, dp2.Name(), deviations.DefaultNetworkInstance(dut), 0)
220+
}
198221
}
199222
}
200223

@@ -212,9 +235,8 @@ func configureATE(t *testing.T, ate *ondatra.ATEDevice) gosnappi.Config {
212235
}
213236

214237
// configureDUTLoopback configures the loopback interface on the DUT
215-
func configureDUTLoopback(t *testing.T, dut *ondatra.DUTDevice) {
238+
func configureDUTLoopback(t *testing.T, dut *ondatra.DUTDevice, vrfName *string) {
216239
t.Helper()
217-
// lb = netutil.LoopbackInterface(t, dut, 0)
218240
lo0 := gnmi.OC().Interface(lb).Subinterface(0)
219241
ipv4Addrs := gnmi.LookupAll(t, dut, lo0.Ipv4().AddressAny().State())
220242
ipv6Addrs := gnmi.LookupAll(t, dut, lo0.Ipv6().AddressAny().State())
@@ -242,7 +264,9 @@ func configureDUTLoopback(t *testing.T, dut *ondatra.DUTDevice) {
242264
}
243265

244266
if deviations.ExplicitInterfaceInDefaultVRF(dut) {
245-
fptest.AssignToNetworkInstance(t, dut, lb, deviations.DefaultNetworkInstance(dut), 0)
267+
if vrfName == nil || *vrfName == deviations.DefaultNetworkInstance(dut) {
268+
fptest.AssignToNetworkInstance(t, dut, lb, deviations.DefaultNetworkInstance(dut), 0)
269+
}
246270
}
247271
}
248272

@@ -254,7 +278,7 @@ func createAndAddInterfacesToVRF(t *testing.T, dut *ondatra.DUTDevice, vrfname s
254278
i.Name = ygot.String(intfName)
255279
i.Type = oc.IETFInterfaces_InterfaceType_ethernetCsmacd
256280
i.Description = ygot.String(fmt.Sprintf("Port %s", strconv.Itoa(index+1)))
257-
if intfName == netutil.LoopbackInterface(t, dut, 0) {
281+
if intfName == lb {
258282
i.Type = oc.IETFInterfaces_InterfaceType_softwareLoopback
259283
i.Description = ygot.String(fmt.Sprintf("Port %s", intfName))
260284
}
@@ -464,6 +488,7 @@ func processCapture(t *testing.T, ate *ondatra.ATEDevice, config gosnappi.Config
464488
validatePackets(t, pcapFile.Name())
465489
}
466490

491+
// DUT Source IP targets alongside Loopback IPs for accurate routing validation.
467492
func validatePackets(t *testing.T, filename string) {
468493
handle, err := pcap.OpenOffline(filename)
469494
if err != nil {
@@ -473,25 +498,27 @@ func validatePackets(t *testing.T, filename string) {
473498

474499
loopbackV4 := net.ParseIP(dutLoopback.IPv4)
475500
loopbackV6 := net.ParseIP(dutLoopback.IPv6)
501+
dutSrcV4 := net.ParseIP(dutSrc.IPv4)
502+
dutSrcV6 := net.ParseIP(dutSrc.IPv6)
503+
476504
packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
477505

478506
foundV4 := false
479507
foundV6 := false
480508
for packet := range packetSource.Packets() {
481509
if ipLayer := packet.Layer(layers.LayerTypeIPv4); ipLayer != nil {
482510
ipv4, _ := ipLayer.(*layers.IPv4)
483-
if ipv4.SrcIP.Equal(loopbackV4) {
511+
if ipv4.SrcIP.Equal(loopbackV4) || ipv4.SrcIP.Equal(dutSrcV4) {
484512
foundV4 = true
485513
t.Logf("tos %d, payload %d, content %d, length %d", ipv4.TOS, len(ipv4.Payload), len(ipv4.Contents), ipv4.Length)
486514
}
487515
} else if ipLayer := packet.Layer(layers.LayerTypeIPv6); ipLayer != nil {
488516
ipv6, _ := ipLayer.(*layers.IPv6)
489-
if ipv6.SrcIP.Equal(loopbackV6) {
517+
if ipv6.SrcIP.Equal(loopbackV6) || ipv6.SrcIP.Equal(dutSrcV6) {
490518
foundV6 = true
491519
t.Logf("tos %d, payload %d, content %d, length %d", ipv6.TrafficClass, len(ipv6.Payload), len(ipv6.Contents), ipv6.Length)
492520
}
493521
}
494-
495522
}
496523

497524
if !foundV4 {

0 commit comments

Comments
 (0)