Skip to content

Commit 10f0fc8

Browse files
tcustoTom Custodio
and
Tom Custodio
authored
[voq] Test plan and testcase updates for multiasic (#3463)
What is the motivation for this PR? To run the init, neighbor and IP forwarding tests on chassis with multiasic linecards. How did you do it? Scripts in tests/voq were enhanced to handle multiasic cards: All test cases were changed so that ASICs with no neighbors or router interfaces will be skipped. The HIDE_INTERNAL route map is let in place and tests in ipfwd script that are affected by it are removed. CLI and database checks where enhanced to look in the correct namespace on multiasic cards. Other enhancements: Neighbor script cleanup was enhanced be more robust when restoring configuration. PTF port selection was centralized and now uses minigraph. TTL checks were made optional for running ipfwd script on VS testbed. Test plan was updated with these changes. How did you verify/test it? Ran test suite on VoQ chassis. Co-authored-by: Tom Custodio <[email protected]>
1 parent e39d50c commit 10f0fc8

File tree

8 files changed

+757
-577
lines changed

8 files changed

+757
-577
lines changed

ansible/roles/test/files/ptftests/voq.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def runTest(self):
257257
print("Found %s ICMP ttl expired packets on ports: %s" % (result, str(src_rx_ports)))
258258
logger.info("Found %s ICMP ttl expired packets on ports: %s" % (result, str(src_rx_ports)))
259259
print("port: %s" % result.port)
260-
if str(result.port) not in src_rx_ports:
260+
if result.port not in src_rx_ports:
261261
self.fail("Port %s not in %s" % (result.port, src_rx_ports))
262262

263263
verify_no_packet_any(self, send_pkt, dst_rx_ports)
@@ -289,6 +289,7 @@ def setUp(self):
289289
self.src_ptf_port_list = self.test_params.get('src_ptf_port_list')
290290
self.dst_ptf_port_list = self.test_params.get('dst_ptf_port_list')
291291
self.version = self.test_params.get('version')
292+
self.ignore_ttl = self.test_params.get('ignore_ttl')
292293

293294
def check_icmp_mtu(self):
294295
"""Check ICMP/Ping to DUT works for MAX MTU. """
@@ -386,6 +387,9 @@ def check_ip_mtu(self):
386387

387388
masked_exp_pkt = Mask(exp_pkt)
388389
masked_exp_pkt.set_do_not_care_scapy(scapy.Ether, "dst")
390+
if self.ignore_ttl:
391+
masked_exp_pkt.set_do_not_care_scapy(scapy.IP, "ttl")
392+
masked_exp_pkt.set_do_not_care_scapy(scapy.IP, "chksum")
389393

390394
else:
391395
pkt = simple_ipv6ip_packet(pktlen=self.pktlen,
@@ -403,12 +407,15 @@ def check_ip_mtu(self):
403407

404408
masked_exp_pkt = Mask(exp_pkt)
405409
masked_exp_pkt.set_do_not_care_scapy(scapy.Ether, "dst")
410+
if self.ignore_ttl:
411+
masked_exp_pkt.set_do_not_care_scapy(scapy.IPv6, "hlim")
412+
masked_exp_pkt.set_do_not_care_scapy(scapy.IPv6, "chksum")
406413

407414
src_port = self.src_ptf_port_list[0]
408415
send_packet(self, src_port, pkt)
409-
logging.info("Sending packet from port " + str(src_port) + " to " + ip_dst)
410416

411417
dst_port_list = self.dst_ptf_port_list
418+
logging.info("Sending packet from port " + str(src_port) + " to " + ip_dst + " expected ports " + str(dst_port_list))
412419
(matched_index, received) = verify_packet_any_port(self, masked_exp_pkt, dst_port_list)
413420

414421
assert received

docs/testplan/Distributed-VoQ-Arch-test-plan.md

+15-90
Original file line numberDiff line numberDiff line change
@@ -378,40 +378,7 @@ will allow the tests to validate the various table deletes before the entries ar
378378

379379
### Test cases
380380

381-
#### Test Case 1. Neighbor established from a remote card.
382-
383-
##### Test Objective
384-
Verify local neighbor behavior is correct when ARP/NDP request is triggered by a packet from a remote line card.
385-
386-
##### Test Steps
387-
* Send ping to from linecard 1 to a VM attached to linecard 2. This will establish a local neighbor on linecard 2 and a remote neighbor on linecard 1.
388-
389-
* On linecard 2:
390-
* Verify ASIC DB entries on local linecard.
391-
* MAC address matches MAC of neighbor VM.
392-
* Router interface OID matches back to the correct interface and port the neighbor was learned on.
393-
* Verify on local linecard CLI, show arp/ndp, ip neigh commands.
394-
* MAC address matches MAC of neighbor VM.
395-
* Verify neighbor table in linecard appDB.
396-
* MAC address matches MAC of neighbor VM.
397-
398-
* On supervisor card:
399-
* Verify SYSTEM_NEIGH table in Chassis AppDB (redis-dump -h <ip> -p 6380 -d 12 on supervisor).
400-
* Verify encap index and MAC address match between ASICDB the Chassis AppDB
401-
402-
* On linecard 1:
403-
* Verify ASIC DB entries as a remote neighbor.
404-
* Verify impose index=True in ASIC DB.
405-
* Verify MAC address in ASIC DB is the remote neighbor mac.
406-
* Verify encap index for ASIC DB entry matches Chassis App DB.
407-
* Verify router interface OID matches the interface the neighbor was learned on.
408-
* Verify on linecard CLI, show arp/ndp, ip neigh commands.
409-
* For inband port, MAC should be inband port mac in kernel table and LC appDb.
410-
* For inband vlan mode, MAC will be remote ASIC mac in kernel table and LC appdb.
411-
* Verify neighbor table in linecard appdb.
412-
* Verify static route in kernel with /32 for entry.
413-
414-
#### Test Case 2. Clear ARP, single address.
381+
#### Test Case 1. Clear ARP, single address.
415382
##### Test Objective
416383
Verify tables, databases, and kernel routes are correctly deleted when a single neighbor adjacency is cleared.
417384
##### Test Steps
@@ -428,7 +395,7 @@ Verify tables, databases, and kernel routes are correctly deleted when a single
428395
* Repeat with IPv4, IPv6, dual-stack.
429396

430397

431-
#### Test Case 3. Clear ARP table via sonic command.
398+
#### Test Case 2. Clear ARP table via sonic command.
432399
##### Test Objective
433400
Verify tables, databases, and kernel routes are correctly deleted when the entire neighbor table is cleared.
434401
##### Test Steps
@@ -446,41 +413,24 @@ Verify tables, databases, and kernel routes are correctly deleted when the entir
446413
* Repeat with IPv4, IPv6, dual-stack.
447414

448415

449-
#### Test Case 4. Front panel port link flap
416+
#### Test Case 3. Front panel port link flap
450417
##### Test Objective
451-
Verify tables, databases, and kernel routes are correctly deleted when the front panel port flaps.
418+
Verify tables, databases, and kernel routes are unaffected when the front panel port flaps and restores.
452419
##### Test Steps
453420
* Admin down interface on fanout to cause LOS on DUT.
454421
* On local linecard:
455-
* Verify ARP/NDP entries are removed from CLI for neighbors on down port.
456-
* Verify table entries in ASIC, AppDb are removed for addresses on down port.
422+
* Verify local interface is down, verify ARP is still present in local database.
457423
* On Supervisor card:
458-
* Verify Chassis App DB entry are removed for only the cleared address. Entries for addresses on other line cards
459-
should still be present.
424+
* Verify Chassis App DB entry are still present.
460425
* On remote linecards:
461-
* Verify table entries in ASICDB, APPDB, and host ARP table are removed for cleared addresses.
462-
* Verify kernel routes for cleared address are deleted.
426+
* Verify table entries in ASICDB, APPDB, and host ARP table are present for affected addresses.
427+
* Verify kernel routes are present for affected addresses.
463428
* Admin interface up, verify recreation after restarting traffic.
429+
* Verify ARP entries on linecards and supervisors are still correct.
464430
* Repeat with IPv4, IPv6, dual-stack.
465431

466432

467-
#### Test Case 5. Gratuitous ARP - Previously Known IP
468-
##### Test Objective
469-
Verify tables, databases, and kernel routes are correctly updated when receiving a unsolicited ARP packet for a previously known IP address..
470-
##### Test Steps
471-
* Clear ARP table on a line card.
472-
* Send unsolicited ARP packet into linecard for an IP that was known on that card and is now stale.
473-
* On local linecard:
474-
* Verify table entries in local ASIC, APP, host arp table are recreated.
475-
* On supervisor card:
476-
* Verify Chassis App DB entry is correct for the relearned address.
477-
* On remote linecards:
478-
* Verify table entries in remote hosts/ASICs in ASICDB, APPDB, and host ARP table are recreated.
479-
* Verify kernel routes in remote hosts are still present.
480-
* Verify that packets can be sent from local and remote linecards to learned address.
481-
* Repeat with IPv4, IPv6, dual-stack.
482-
483-
#### Test Case 6. Gratuitous ARP - Known IP - Mac change
433+
#### Test Case 4. Gratuitous ARP - Known IP - Mac change
484434
##### Test Objective
485435
Verify tables, databases, and kernel routes are correctly updated when a unsolicited ARP packet changes the MAC address of learned neighbor.
486436
##### Test Steps
@@ -497,7 +447,7 @@ Verify tables, databases, and kernel routes are correctly updated when a unsolic
497447
* Verify that packets can be sent from local and remote linecards to learned address.
498448
* Repeat with IPv4, IPv6, dual-stack.
499449

500-
#### Test Case 7. ARP Request/Reply - Mac change
450+
#### Test Case 5. ARP Request/Reply - Mac change
501451
##### Test Objective
502452
Verify tables, databases, and kernel routes are correctly updated when the MAC address of a neighbor changes and is updated via request/reply exchange.
503453
##### Test Steps
@@ -514,7 +464,7 @@ Verify tables, databases, and kernel routes are correctly updated when the MAC a
514464
* Verify that packets can be sent from local and remote linecards to the learned address.
515465
* Repeat with IPv4, IPv6, dual-stack.
516466

517-
#### Test Case 8. Disruptive Events
467+
#### Test Case 6. Disruptive Events
518468
##### Test Objective
519469
Verify port, router interface, and neighbor recovery after disruptive events.
520470
##### Test Steps
@@ -570,6 +520,9 @@ Please reference the [T2 topology](https://github.com/Azure/sonic-mgmt/pull/2638
570520

571521
VMs attached to line card 1 and line card 2 will be used for this test.
572522
DUT Port A&B are on line card 1, D is on line card 2.
523+
524+
The HIDE_INTERNAL route policy will prevent inband and interface address from being advertised to EBGP peers. Looback addresses will be used to test traffic flows across cards and VMs.
525+
573526
```
574527
---------- DUT ----------
575528
|--- LC1 ---|--- LC2 ---|
@@ -637,7 +590,6 @@ Verify the kernel route table is correct based on the topology.
637590
* Verify routes for local inband interfaces are directly connected.
638591
* Verify BGP established between line cards.
639592
* Verify routes of remote linecard inband interfaces are connected via local linecard inband interface.
640-
* Verify IP interface addresses on remote network ports have a next hop of their inband IP. On linecard 1, route 10.0.0.64/31 next hop is 133.133.133.5.
641593
* Verify all learned prefixes from neighbors have their neighbors as next hop.
642594
* Repeat for IPv4 only, IPv6 only, dual-stack.
643595

@@ -647,9 +599,6 @@ Verify Host IP forwarding for IPv4 and IPv6 for various packet sizes and ttls to
647599
##### Test Steps
648600
* On linecard 1, send ping from:
649601
* DUT IP interface A to DUT IP Interface B. (10.0.0.0 to 10.0.0.2)
650-
* DUT IP interface A to DUT IP Interface D. (10.0.0.0 to 10.0.0.64)
651-
* On linecard 2, send ping from:
652-
* DUT IP interface D to DUT IP Interface A.
653602
* Repeat for TTL 0,1,2,255
654603
* Repeat for 64, 1500, 9100B packets
655604
* Repeat for IPv6
@@ -660,13 +609,8 @@ Verify Host IP forwarding for IPv4 and IPv6 for various packet sizes and ttls to
660609
##### Test Steps
661610
* On linecard 1, send ping from:
662611
* DUT IP Interface on port A to directly connected neighbor address. (10.0.0.0 to 10.0.0.1)
663-
* DUT IP Interface A to neighbor address on port B. (10.0.0.0 to 10.0.0.3)
664-
* DUT IP Interface A to neighbor address on port D. (10.0.0.0 to 10.0.0.65)
665-
* On linecard 2, send ping from:
666-
* DUT IP interface D to neighbor address on port A. (10.0.0.64 to 10.0.0.1)
667612
* On Router 01T3, send ping from:
668613
* Router IP interface to DUT address on port A. (10.0.0.1 to 10.0.0.0)
669-
* Router IP interface to DUT address on port D. (10.0.0.1 to 10.0.0.64)
670614
* Repeat for TTL 0,1,2,255
671615
* Repeat for 64, 1500, 9100B packets
672616
* Repeat for IPv6
@@ -677,13 +621,8 @@ Verify Host IP forwarding for IPv4 and IPv6 for various packet sizes and ttls to
677621
##### Test Steps
678622
* On linecard 1, send ping from:
679623
* DUT IP Interface A to routed loopback address from router 01T3. (10.0.0.0 to 100.1.0.1)
680-
* DUT IP Interface A to routed loopback address from router 02T3. (10.0.0.0 to 100.1.0.2)
681-
* DUT IP Interface A to routed loopback address from router 01T1. (10.0.0.0 to 100.1.0.33)
682-
* On linecard 2, send ping from:
683-
* DUT IP interface D to routed loopback address from router 01T3. (200.0.0.1 to 100.1.0.1)
684624
* On Router 01T3, send ping from:
685625
* Router loopback interface to DUT address on port A. (100.1.0.1 to 10.0.0.0)
686-
* Router loopback interface to DUT address on port D. (100.1.0.1 to 10.0.0.64)
687626
* Repeat for TTL 0,1,2,255
688627
* Repeat for 64, 1500, 9100B packets
689628
* Repeat for IPv6
@@ -694,21 +633,7 @@ Verify IP connectivity over inband interfaces.
694633
##### Test Steps
695634
* On linecard 1 send ping from:
696635
* Inband interface F0 to inband interface F1 (133.133.133.1 to 133.133.133.5)
697-
* Inband interface F0 to interface D (133.133.133.1 to 10.0.0.64)
698636
* Inband interface F0 to neighbor on port A (133.133.133.1 to 10.0.0.1)
699-
* Inband interface F0 to neighbor on port D (133.133.133.1 to 10.0.0.65)
700-
* Inband interface F0 to routed loopback from router 01T3 (133.133.133.1 to 100.1.0.1)
701-
* Inband interface F0 to routed loopback from router 01T1 (133.133.133.1 to 100.1.0.33)
702-
* On linecard 2, send ping from:
703-
* Inband interface F1 to inband interface F0 (133.133.133.5 to 133.133.133.1)
704-
* Inband interface F1 to interface D (133.133.133.5 to 10.0.0.64)
705-
* Inband interface F1 to neighbor on port A (133.133.133.5 to 10.0.0.1)
706-
* Inband interface F1 to neighbor on port D (133.133.133.5 to 10.0.0.65)
707-
* Inband interface F1 to routed loopback from router 01T3 (133.133.133.5 to 100.1.0.1)
708-
* Inband interface F1 to routed loopback from router 01T1 (133.133.133.5 to 100.1.0.33)
709-
* On Router 01T3, send ping from:
710-
* Router loopback interface to DUT inband address on linecard 1. (100.1.0.1 to 133.133.133.1)
711-
* Router loopback interface to DUT inband address on linecard 2. (100.1.0.1 to 133.133.133.5)
712637
* Repeat for TTL 0,1,2,255
713638
* Repeat for 64, 1500, 9100B packets
714639
* Repeat for IPv6

tests/common/helpers/redis.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def __init__(self, host):
227227
self.hostif_table = []
228228
self.system_port_key_list = []
229229
self.port_key_list = []
230+
self.lagid_key_list = []
230231

231232
def get_switch_key(self):
232233
"""Returns a list of keys in the switch table"""
@@ -257,8 +258,11 @@ def get_hostif_list(self):
257258
cmd = self._cli_prefix() + "KEYS %s:*" % AsicDbCli.ASIC_HOSTIF_TABLE
258259
return self._run_and_raise(cmd)["stdout_lines"]
259260

260-
def get_asic_db_lag_list(self):
261+
def get_asic_db_lag_list(self, refresh=False):
261262
"""Returns a list of keys in the lag table"""
263+
if self.lagid_key_list != [] and refresh is False:
264+
return self.lagid_key_list
265+
262266
cmd = self._cli_prefix() + "KEYS %s:*" % AsicDbCli.ASIC_LAG_TABLE
263267
return self._run_and_raise(cmd)["stdout_lines"]
264268

@@ -309,9 +313,10 @@ def get_neighbor_value(self, neighbor_key, field):
309313
"""
310314
cmd = ["/usr/bin/redis-cli", "-n", "1", "HGET", neighbor_key, field]
311315
if self.host.namespace is not None:
312-
cmd = ["sudo", "ip", "netns", "exec"] + cmd
316+
cmd = ["/usr/bin/redis-cli", "-h", str(self.ip), "-n", "1", "HGET", neighbor_key, field]
317+
cmd = ["sudo", "ip", "netns", "exec"] + [self.host.namespace] + cmd
318+
313319
result = self.host.sonichost.shell(argv=cmd)
314-
logger.debug("neigh result: %s", result['stdout'])
315320
return result['stdout']
316321

317322
def get_hostif_table(self, refresh=False):
@@ -390,21 +395,26 @@ def get_rif_porttype(self, portid, refresh=False):
390395
Returns:
391396
"hostif" if the port ID has a host interface
392397
"sysport" if it is a system port.
393-
"port" if the port ID is in local port table but has no hostif
398+
"port" if the port ID is in local port table but has no hostif (inband)
399+
"lag" if the portid is a portchannel.
394400
"other" if it is not found in any port table
395401
"""
396-
# could be a localport
397402

398403
port_key_list = self.get_port_key_list(refresh=refresh)
399404
system_port_keylist = self.get_system_port_key_list(refresh=refresh)
405+
lag_keylist = self.get_asic_db_lag_list(refresh=refresh)
400406

407+
# could be a frontpanel port
401408
if "%s:%s" % (
402409
AsicDbCli.ASIC_PORT_TABLE,
403410
portid) in port_key_list and portid in self.get_hostif_portid_oidlist():
404411
return "hostif"
405412
# could be a system port
406413
elif "%s:%s" % (AsicDbCli.ASIC_SYSPORT_TABLE, portid) in system_port_keylist:
407414
return "sysport"
415+
# could be a lag
416+
elif "%s:%s" % (AsicDbCli.ASIC_LAG_TABLE, portid) in lag_keylist:
417+
return "lag"
408418
# could be something else
409419
elif "%s:%s" % (AsicDbCli.ASIC_PORT_TABLE, portid) in port_key_list:
410420
return "port"

tests/voq/conftest.py

-18
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@ def all_cfg_facts(duthosts):
3838
return results
3939

4040

41-
@pytest.fixture(scope="module", autouse=True)
42-
def bgp_redistribute_route_lo(duthosts, all_cfg_facts):
43-
for a_host in duthosts.frontend_nodes:
44-
for a_asic in a_host.asics:
45-
asic_asn = all_cfg_facts[a_host.hostname][a_asic.asic_index]['ansible_facts']['DEVICE_METADATA']['localhost']['bgp_asn']
46-
47-
send_command = a_asic.get_docker_cmd(
48-
"vtysh -c 'configure terminal' -c 'router bgp " + asic_asn + "' -c 'address-family ipv4 unicast' -c 'no redistribute connected route-map HIDE_INTERNAL' -c 'redistribute connected'",
49-
"bgp")
50-
51-
send_command_ipv6 = a_asic.get_docker_cmd(
52-
"vtysh -c 'configure terminal' -c 'router bgp " + asic_asn + "' -c 'address-family ipv6 unicast' -c 'no redistribute connected route-map HIDE_INTERNAL' -c 'redistribute connected'",
53-
"bgp")
54-
55-
a_host.command(send_command)
56-
a_host.command(send_command_ipv6)
57-
58-
5941
@reset_ansible_local_tmp
6042
def _get_nbr_macs(nbrhosts, node=None, results=None):
6143
vm = nbrhosts[node]

0 commit comments

Comments
 (0)