-
Notifications
You must be signed in to change notification settings - Fork 939
Open
Labels
Description
Is it platform specific
generic
Importance or Severity
High
Description of the bug
bgp/test_bgp_vnet.py::test_bgp_vnet_route_forwarding failed as ptf did not get packets on expected ports. Function to calculate PTF port index (def get_ptf_port_index) assumes port speed as 400g. In few platforms like TD4 , there is a mix of 100 & 400g interfaces. Hence PTF port index calculation should factor this.
Steps to Reproduce
Run OC testcase - bgp/test_bgp_vnet.py::test_bgp_vnet_route_forwarding
Actual Behavior and Expected Behavior
Packets should be received at expected ports.
Relevant log output
> testutils.verify_packet_any_port(ptfadapter, expected_pkt, expected_ports)
cfg_facts = {'AAA': {'accounting': {'login': 'tacacs+,local'}, 'authentication': {'login': 'tacacs+'}, 'authorization': {'login': ...m_threshold': '10.0', 'max_core_limit': '5.0', 'max_techsupport_limit': '10.0', 'min_available_mem': '200', ...}}, ...}
dst_ip = '193.11.248.129'
duthost = <MultiAsicSonicHost ixr-7220-d4-nysa>
duthosts = [<MultiAsicSonicHost ixr-7220-d4-nysa>]
expected_pkt = <ptf.mask.Mask object at 0x7ff065705af0>
expected_ports = [32, 34]
inner_pkt = <Ether dst=e8:f3:75:8d:90:50 src=b'72:59:dd:97:60:20' type=IPv4 |<IP ihl=None tos=0x0 id=1 flags= frag=0 ttl=64 prot...11.248.129 |<UDP sport=1234 dport=4321 |<Raw load=b'test_bgp_vnet test_bgp_vnet test_bgp_vnet test_bgp_vnet te' |>>>>
ptfadapter = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest>
rand_one_dut_hostname = 'ixr-7220-d4-nysa'
router_mac = 'e8:f3:75:8d:90:50'
send_port = 32
src_mac = b'72:59:dd:97:60:20'
unexpected_ports = [36, 38]
bgp/test_bgp_vnet.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/venv/lib/python3.12/site-packages/ptf/testutils.py:3441: in verify_packet_any_port
test.fail(
device_number = 0
n_timeout = 0.1
pkt = <ptf.mask.Mask object at 0x7ff065705af0>
ports = [32, 34]
result = PollFailure(device=None, port=None, packet=None, time=None)
test = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest>
timeout = 2
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest>
msg = 'Did not receive expected packet on any of ports [32, 34] for device 0.\n========== EXPECTED ==========\nMask:\n\npack... ....\n\n========== RECEIVED ==========\n0 total packets.\n==============================\n'
def fail(self, msg=None):
"""Fail immediately, with the given message."""
> raise self.failureException(msg)
E AssertionError: Did not receive expected packet on any of ports [32, 34] for device 0.
E ========== EXPECTED ==========
E Mask:
E
E packet status: OK
E packet:
E 0000 E8 F3 75 8D 90 50 72 59 DD 97 60 20 08 00 45 00 ..u..PrY..` ..E.
E 0010 00 56 00 01 00 00 40 11 98 F4 14 14 14 01 C1 0B .V....@.........
E 0020 F8 81 04 D2 10 E1 00 42 D1 0B 74 65 73 74 5F 62 .......B..test_b
E 0030 67 70 5F 76 6E 65 74 20 74 65 73 74 5F 62 67 70 gp_vnet test_bgp
E 0040 5F 76 6E 65 74 20 74 65 73 74 5F 62 67 70 5F 76 _vnet test_bgp_v
E 0050 6E 65 74 20 74 65 73 74 5F 62 67 70 5F 76 6E 65 net test_bgp_vne
E 0060 74 20 74 65 t te
E
E packet's mask:
E 0000 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF ................
E 0010 FF FF FF FF FF FF 00 FF 00 00 FF FF FF FF FF FF ................
E 0020 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
E 0030 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
E 0040 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
E 0050 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
E 0060 FF FF FF FF ....
E
E ========== RECEIVED ==========
E 0 total packets.
E ==============================
msg = 'Did not receive expected packet on any of ports [32, 34] for device 0.\n========== EXPECTED ==========\nMask:\n\npack... ....\n\n========== RECEIVED ==========\n0 total packets.\n==============================\n'
self = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest>
/usr/lib/python3.12/unittest/case.py:715: AssertionError
During handling of the above exception, another exception occurred:
ptfadapter = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest>
duthosts = [<MultiAsicSonicHost ixr-7220-d4-nysa>]
rand_one_dut_hostname = 'ixr-7220-d4-nysa'
cfg_facts = {'AAA': {'accounting': {'login': 'tacacs+,local'}, 'authentication': {'login': 'tacacs+'}, 'authorization': {'login': ...m_threshold': '10.0', 'max_core_limit': '5.0', 'max_techsupport_limit': '10.0', 'min_available_mem': '200', ...}}, ...}
def test_bgp_vnet_route_forwarding(ptfadapter, duthosts, rand_one_dut_hostname, cfg_facts):
'''
Verify that the traffic to the peer in Vnet1 is forwarded correctly.
Send a UDP packet to with the destination as one of the routes learned via bgp in Vnet1
and verify that it is received on the correct port in Vnet1.
Also verify that the packet is not received on the other ports which belong to Vnet2.
'''
try:
duthost = duthosts[rand_one_dut_hostname]
router_mac = duthost.facts["router_mac"]
# Destination IP is one of the routes learned via bgp in Vnet1
dst_ip = "193.11.248.129"
expected_ports, unexpected_ports = get_expected_unexpected_ptf_ports(cfg_facts, "Vnet1", "Vnet2")
send_port = expected_ports[0]
src_mac = ptfadapter.dataplane.get_mac(0, send_port)
inner_pkt = testutils.simple_udp_packet(
eth_dst=router_mac,
eth_src=src_mac,
ip_dst=dst_ip,
ip_src="20.20.20.1",
udp_sport=1234,
udp_dport=4321,
)
expected_pkt = Mask(inner_pkt)
expected_pkt.set_do_not_care_scapy(Ether, "dst")
expected_pkt.set_do_not_care_scapy(Ether, "src")
expected_pkt.set_do_not_care_scapy(IP, "ttl")
expected_pkt.set_do_not_care_scapy(IP, "chksum")
logger.info(f"Sending UDP packet on port {send_port}")
testutils.send(ptfadapter, send_port, inner_pkt)
logger.info(f"Expecting UDP packet on one of {expected_ports}")
testutils.verify_packet_any_port(ptfadapter, expected_pkt, expected_ports)
logger.info(f"Verifying packet is not received on ports {unexpected_ports}")
testutils.verify_no_packet_any(ptfadapter, expected_pkt, unexpected_ports)
except Exception as e:
logger.error("Exception raised in test_bgp_vnet_route_forwarding: {}".format(repr(e)))
> pytest.fail("Packet test for per vnet BGP failed")
E Failed: Packet test for per vnet BGP failed
cfg_facts = {'AAA': {'accounting': {'login': 'tacacs+,local'}, 'authentication': {'login': 'tacacs+'}, 'authorization': {'login': ...m_threshold': '10.0', 'max_core_limit': '5.0', 'max_techsupport_limit': '10.0', 'min_available_mem': '200', ...}}, ...}
dst_ip = '193.11.248.129'
duthost = <MultiAsicSonicHost ixr-7220-d4-nysa>
duthosts = [<MultiAsicSonicHost ixr-7220-d4-nysa>]
expected_pkt = <ptf.mask.Mask object at 0x7ff065705af0>
expected_ports = [32, 34]
inner_pkt = <Ether dst=e8:f3:75:8d:90:50 src=b'72:59:dd:97:60:20' type=IPv4 |<IP ihl=None tos=0x0 id=1 flags= frag=0 ttl=64 prot...11.248.129 |<UDP sport=1234 dport=4321 |<Raw load=b'test_bgp_vnet test_bgp_vnet test_bgp_vnet test_bgp_vnet te' |>>>>
ptfadapter = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest>
rand_one_dut_hostname = 'ixr-7220-d4-nysa'
router_mac = 'e8:f3:75:8d:90:50'
send_port = 32
src_mac = b'72:59:dd:97:60:20'
unexpected_ports = [36, 38]
bgp/test_bgp_vnet.py:482: FailedOutput of show version
HEAD.1306377-202511-dirty-20260127.140056Attach files (if any)
No response