Skip to content

Commit 9e33957

Browse files
Add TelemetryCheck for static_arp_test (#5227)
* Add TelemetryCheck for static_arp_test * Address Gemini Comments * Fix Import * Address Comments
1 parent 9c2f87e commit 9e33957

File tree

5 files changed

+68
-5
lines changed

5 files changed

+68
-5
lines changed

feature/interface/staticarp/otg_tests/static_arp_test/metadata.textproto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ platform_exceptions: {
1111
}
1212
deviations: {
1313
ipv4_missing_enabled: true
14+
arp_ft: "ciscoxr-arp-ft"
1415
}
1516
}
1617
platform_exceptions: {

feature/interface/staticarp/otg_tests/static_arp_test/static_arp_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/openconfig/ondatra"
3030
"github.com/openconfig/ondatra/gnmi"
3131
"github.com/openconfig/ondatra/gnmi/oc"
32+
"github.com/openconfig/ygnmi/ygnmi"
3233
)
3334

3435
func TestMain(m *testing.M) {
@@ -292,6 +293,38 @@ func testFlow(
292293
}
293294
}
294295

296+
func verifyNeighborMAC(t *testing.T, dut *ondatra.DUTDevice, expectedMAC string) {
297+
t.Helper()
298+
port1 := dut.Port(t, "port1")
299+
opts := fptest.GetOptsForFunctionalTranslator(t, deviations.ArpFT(dut))
300+
301+
cases := []struct {
302+
desc string
303+
ip string
304+
telemetry ygnmi.SingletonQuery[string]
305+
}{
306+
{
307+
desc: "IPv4",
308+
ip: ateSrc.IPv4,
309+
telemetry: gnmi.OC().Interface(port1.Name()).Subinterface(0).Ipv4().Neighbor(ateSrc.IPv4).LinkLayerAddress().State(),
310+
},
311+
{
312+
desc: "IPv6",
313+
ip: ateSrc.IPv6,
314+
telemetry: gnmi.OC().Interface(port1.Name()).Subinterface(0).Ipv6().Neighbor(ateSrc.IPv6).LinkLayerAddress().State(),
315+
},
316+
}
317+
318+
for _, tc := range cases {
319+
t.Run(tc.desc, func(t *testing.T) {
320+
actualMAC := gnmi.Get(t, dut.GNMIOpts().WithYGNMIOpts(opts...), tc.telemetry)
321+
if !strings.EqualFold(actualMAC, expectedMAC) {
322+
t.Errorf("Actual MAC for %s got %q, want %q", tc.ip, actualMAC, expectedMAC)
323+
}
324+
})
325+
}
326+
}
327+
295328
func TestStaticARP(t *testing.T) {
296329
// Configure the DUT with dynamic ARP.
297330
configureDUT(t, noStaticMAC)
@@ -304,6 +337,10 @@ func TestStaticARP(t *testing.T) {
304337
dstMac := gnmi.Get(t, ate.OTG(), gnmi.OTG().Interface(ateSrc.Name+".Eth").Ipv4Neighbor(dutSrc.IPv4).LinkLayerAddress().State())
305338

306339
t.Run("NotPoisoned", func(t *testing.T) {
340+
t.Run("TelemetryCheck", func(t *testing.T) {
341+
dut := ondatra.DUT(t, "dut")
342+
verifyNeighborMAC(t, dut, ateSrc.MAC)
343+
})
307344
t.Run("IPv4", func(t *testing.T) {
308345
testFlow(t, ate, config, "IPv4", dstMac, false)
309346
})
@@ -316,6 +353,10 @@ func TestStaticARP(t *testing.T) {
316353
configureDUT(t, poisonedMAC)
317354

318355
t.Run("Poisoned", func(t *testing.T) {
356+
t.Run("TelemetryCheck", func(t *testing.T) {
357+
dut := ondatra.DUT(t, "dut")
358+
verifyNeighborMAC(t, dut, poisonedMAC)
359+
})
319360
t.Run("IPv4", func(t *testing.T) {
320361
testFlow(t, ate, config, "IPv4", dstMac, true)
321362
})

internal/deviations/deviations.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,3 +1999,9 @@ func QosFt(dut *ondatra.DUTDevice) string {
19991999
func SystemMountPointStateFt(dut *ondatra.DUTDevice) string {
20002000
return lookupDUTDeviations(dut).GetSystemMountPointStateFt()
20012001
}
2002+
2003+
// ArpFT returns the functional translator name for devices with neighbor link-layer-address paths unsupported.
2004+
// Cisco: https://partnerissuetracker.corp.google.com/issues/429137958
2005+
func ArpFT(dut *ondatra.DUTDevice) string {
2006+
return lookupDUTDeviations(dut).GetArpFt()
2007+
}

proto/metadata.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,10 @@ message Metadata {
12001200
// Functional Translator name for devices with mount point state paths unsupported.
12011201
string system_mount_point_state_ft = 391;
12021202

1203+
// Cisco: https://partnerissuetracker.corp.google.com/issues/429137958
1204+
// Functional Translator name for devices with neighbor link-layer-address paths unsupported.
1205+
string arp_ft = 392;
1206+
12031207
// Reserved field numbers and identifiers.
12041208
reserved 84, 9, 28, 20, 38, 43, 90, 97, 55, 89, 19, 36, 35, 40, 113, 131, 141, 173, 234, 254, 231, 300, 241;
12051209
}

proto/metadata_go_proto/metadata.pb.go

Lines changed: 16 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)