Fix SmartSwitch ARP test BGP filter for VLAN-based DPC dataplane - #1
Fix SmartSwitch ARP test BGP filter for VLAN-based DPC dataplane#1nnelluri-cisco wants to merge 5 commits into
Conversation
|
@rameshraghupathi and @prabhataravind Please review and approve the PR |
|
@nnelluri-cisco Do we need to append both iface.ip and iface.network.network_address; otherwise the VLAN gateway /32 connected route may remain unfiltered ? |
|
@rameshraghupathy grep -E 'custom filter|back plane port IPs' test_neighbor_mac_noptf.log |
332da0f to
0cf62dc
Compare
|
@nnelluri-cisco This still does not fully address the For example, if the VLAN interface is 20.0.200.0 # subnet route
20.0.200.254 # local /32 routePlease append both: back_plane_port_ips.append(str(iface.ip))
back_plane_port_ips.append(str(iface.network.network_address))Otherwise, Also, please verify the actual |
|
The latest commit already filters both the subnet prefix (20.0.200.0) and the local /32 host route (20.0.200.254) by appending both iface.ip and iface.network.network_address to the BGP route filter list. Verified on DUT sonic-ucs-m6-19 (MtFuji / Cisco-8102): logs show back plane port IPs: ['20.0.200.0', '20.0.200.254'], filtered 2, and BGP shutdown completes within 120s. test cases already passed in latest run |
|
@nnelluri-cisco could you raise the PR against sonic-net/sonic-mgmt master ? |
|
@prabhataravind |
3de7b7f to
2b20366
Compare
After VLAN-based DPC config moved dataplane IPs to Vlan55, the ARP neighbor MAC test failed to exclude connected routes because it queried per-port addresses. Read VLAN interface IPs from config_db instead. Signed-off-by: nnelluri <nnelluri@cisco.com>
Filter the VLAN network prefix (20.0.200.0) in addition to reading the gateway from config_db, so both connected routes (subnet and /32 host) are excluded during BGP shutdown wait. Signed-off-by: nnelluri <nnelluri@cisco.com>
Redis KEYS glob on dest does not match 20.0.200.254/32 when filtering only 20.0.200.0; add both network and host addresses to the exclude list. Signed-off-by: nnelluri <nnelluri@cisco.com>
…ute (20.0.200.254) Signed-off-by: nnelluri <nnelluri@cisco.com>
addressed copilot comments Signed-off-by: nnelluri <nnelluri@cisco.com>
2b20366 to
d85d572
Compare
…net#24994) ### Description of PR Summary: The `snappi_api` fixture previously had the IxNetwork API username/password hardcoded behind a commented-out TODO, so any site whose IxNetwork uses non-default credentials had to edit the fixture locally. This change reads those credentials from the DUT's ansible inventory variable `snappi_api_server.user` / `snappi_api_server.password` — the same inventory source already used to read `rest_port` (`snappi_api_serv_port`). Credentials now live in the testbed inventory instead of in test code. When those keys are absent, the values stay `None` and the snappi library defaults apply, so behavior is unchanged for testbeds that don't define them. ### Type of change - [ ] Bug fix - [x] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [ ] 202512 - [ ] 202605 ### Approach #### What is the motivation for this PR? IxNetwork API credentials were hardcoded (commented out) in the `snappi_api` fixture. Sites whose IxNetwork uses non-default credentials had to patch the fixture in place. Reading them from the ansible inventory keeps credentials out of the test code and is consistent with how `snappi_api_serv_port` already reads `rest_port` from the same `snappi_api_server` inventory variable. #### How did you do it? In the `snappi_api` fixture, added the `duthosts` and `rand_one_dut_hostname` fixtures, looked up the `snappi_api_server` host var for the selected DUT, and set `api._username` / `api._password` from its `user` / `password` keys when present. Absent keys leave the snappi library defaults in place, preserving existing behavior. #### How did you verify/test it? ``` INFO tests.snappi_tests.ecn.test_red_accuracy_with_snappi:test_red_accuracy_with_snappi.py:113 Running ECN red accuracy test with ECN params: {'kmin': 500000, 'kmax': 900000, 'pmax': 5} INFO tests.snappi_tests.ecn.test_red_accuracy_with_snappi:test_red_accuracy_with_snappi.py:114 Running ECN red accuracy test for 1 iterations INFO tests.snappi_tests.ecn.files.helper:helper.py:346 Stopping PFC watchdog INFO tests.snappi_tests.ecn.files.helper:helper.py:349 Disabling packet aging if necessary INFO tests.snappi_tests.ecn.files.helper:helper.py:352 Enabling WRED queue counters INFO tests.snappi_tests.ecn.files.helper:helper.py:357 Configuring WRED and ECN thresholds INFO tests.snappi_tests.ecn.files.helper:helper.py:372 Enabling ECN markings INFO tests.snappi_tests.ecn.files.helper:helper.py:401 Generating base flow config INFO tests.snappi_tests.ecn.files.helper:helper.py:406 Setting test flow config params INFO tests.snappi_tests.ecn.files.helper:helper.py:414 Setting pause flow config params INFO tests.snappi_tests.ecn.files.helper:helper.py:428 Generating test flows INFO tests.snappi_tests.ecn.files.helper:helper.py:435 Generating pause flows INFO tests.snappi_tests.ecn.files.helper:helper.py:446 Setting packet capture port to Port 0 INFO tests.snappi_tests.ecn.files.helper:helper.py:450 Running 1 iteration(s) INFO tests.snappi_tests.ecn.files.helper:helper.py:452 Running iteration 0 INFO tests.snappi_tests.ecn.files.helper:helper.py:454 Packet capture file: ECN_cap-0.pcapng INFO tests.snappi_tests.ecn.files.helper:helper.py:462 Clearing DUT counters before iter 0 traffic INFO tests.snappi_tests.ecn.files.helper:helper.py:466 Running traffic INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:616 Wait for Arp to Resolve ... INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:627 Starting packet capture ... INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:639 Starting transmit on all flows ... INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:685 Polling TGEN for in-flight traffic statistics... INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:693 Checking if all flows have stopped. Attempt #1 INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:693 Checking if all flows have stopped. Attempt sonic-net#2 INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:700 All test and background traffic flows stopped INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:711 Stopping packet capture ... INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:717 Retrieving and saving packet capture to ECN_cap-0.pcapng WARNING root:snappi_api.py:1518 Capture was not stopped for this port Port 0 INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:723 Dumping per-flow statistics INFO tests.common.snappi_tests.traffic_generation:traffic_generation.py:725 Stopping transmit on all remaining flows INFO tests.snappi_tests.ecn.files.helper:helper.py:500 Queue counters after iter 0 (prio 3): ``` #### Any platform specific information? None — this affects only the snappi/IxNetwork API session setup. #### Supported testbed topology if it's a new test case? N/A — not a new test case; applies to snappi tgen testbeds. ### Documentation N/A — no documentation/wiki changes required. Signed-off-by: atul-nexthop <atul@nexthop.ai>
After VLAN-based DPC config moved dataplane IPs to Vlan55, the ARP neighbor MAC test failed to exclude connected routes because it queried per-port addresses. Read VLAN interface IPs from config_db instead.
Description of PR
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
PR sonic-net#22902 moved SmartSwitch DPC dataplane connectivity to a VLAN-based model: DPC ports (Ethernet224/232/240/248) are untagged members of Vlan55, and the gateway IP (20.0.200.254/24) is assigned to Vlan55 instead of individual DPC ports.
test_neighbor_mac_noptf.py shuts down BGP in setup and waits until no BGP routes remain in ASIC_DB. For SmartSwitch, it excludes local connected routes by filtering IPs returned from _get_back_plane_port_ips(). That function still used ip addr show on each DPC port, which returns empty after the VLAN change. Without those filter IPs, connected routes (20.0.200.0/24 and 20.0.200.254/32) are not excluded and the test times out waiting for BGP shutdown.
How did you do it?
Updated _get_back_plane_port_ips() to:
Read DPC ports from config_facts (PORT table, role == "dpc").
Find VLANs those ports belong to via VLAN_MEMBER.
Extract IPv4 addresses from VLAN_INTERFACE for those VLANs (e.g. 20.0.200.254 on Vlan55).
Keep a fallback to the legacy ip addr show per-port lookup for older configs where DPC ports still have addresses directly assigned.
How did you verify/test it?
Code review against the VLAN dataplane config in ansible/module_utils/smartswitch_utils.py and generate_golden_config_db.py to confirm Vlan55 IP placement matches what the test now reads from config_db.
Verified the filter logic in _get_bgp_routes_asic() uses the returned IPs as route-prefix filters, which correctly excludes both the /24 subnet and /32 host routes when 20.0.200.254 is present.
Pre-commit hooks (flake8, etc.) pass on the changed file.
Any platform specific information?
Affects SmartSwitch platforms only (is_smartswitch == True). The change is scoped to _get_back_plane_port_ips(), which is only called from _check_no_bgp_routes() when the DUT is a SmartSwitch. Non-SmartSwitch platforms are unchanged.
Supported testbed topology if it's a new test case?
Relevant SmartSwitch SKUs: Cisco-8102-* and Mellanox-SN4280-* with DPC role ports.
N/A — this is a bug fix to an existing test case (arp/test_neighbor_mac_noptf.py), not a new test. The test already runs on any topology and applies the SmartSwitch-specific logic only when is_smartswitch is set.
Documentation
Pass Logs:
grep 'testNeighborMacNoPtf' test_neighbor_mac_noptf.log | grep 'SectionStartLogger'
INFO SectionStartLogger:init.py:170 ==================== tests/arp/test_neighbor_mac_noptf.py::TestNeighborMacNoPtf::testNeighborMacNoPtf[4-MtFuji-dut-None] setup ====================
INFO SectionStartLogger:init.py:170 ==================== tests/arp/test_neighbor_mac_noptf.py::TestNeighborMacNoPtf::testNeighborMacNoPtf[4-MtFuji-dut-None] call ====================
INFO SectionStartLogger:init.py:170 ==================== tests/arp/test_neighbor_mac_noptf.py::TestNeighborMacNoPtf::testNeighborMacNoPtf[4-MtFuji-dut-None] teardown ====================
INFO SectionStartLogger:init.py:170 ==================== tests/arp/test_neighbor_mac_noptf.py::TestNeighborMacNoPtf::testNeighborMacNoPtf[6-MtFuji-dut-None] setup ====================
INFO SectionStartLogger:init.py:170 ==================== tests/arp/test_neighbor_mac_noptf.py::TestNeighborMacNoPtf::testNeighborMacNoPtf[6-MtFuji-dut-None] call ====================
INFO SectionStartLogger:init.py:170 ==================== tests/arp/test_neighbor_mac_noptf.py::TestNeighborMacNoPtf::testNeighborMacNoPtf[6-MtFuji-dut-None] teardown ====================