sonic-mgmt icon indicating copy to clipboard operation
sonic-mgmt copied to clipboard

【tests/ip/test_ip_packet.py Failed: Received 0 packets in rx】

Open Wlyy0314 opened this issue 2 years ago • 1 comments

Description ./run_tests.sh -n vms-kvm-t0 -d vlab-01 -c ip/test_ip_packet.py -f vtestbed.csv -i veos_vtb

Steps to reproduce the issue: 1. 2. 3.

Describe the results you received:

Failed: Received 0 packets in rx, not in expected range Describe the results you expected:

self = <tests.ip.test_ip_packet.TestIPPacket object at 0x7f407004e690> duthost = <MultiAsicSonicHost vlab-01> ptfadapter = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest> common_param = ([(u'10.0.0.61', [u'Ethernet120']), (u'10.0.0.63', [u'Ethernet124'])], u'PortChannel103', True, 30, {u'PortChannel101'..., u'PortChannel104': [u'Ethernet124']}, {'Ethernet0': 0, 'Ethernet100': 25, 'Ethernet104': 26, 'Ethernet108': 27, ...})

def test_forward_ip_packet_with_0x0000_chksum(self, duthost, ptfadapter, common_param):
    # GIVEN a ip packet with checksum 0x0000(compute from scratch)
    # WHEN send the packet to DUT
    # THEN DUT should forward it as normal ip packet

    (peer_ip_ifaces_pair, rif_rx_ifaces, rif_support, ptf_port_idx, pc_ports_map, ptf_indices) = common_param
    pkt = testutils.simple_ip_packet(
        eth_dst=duthost.facts["router_mac"],
        eth_src=ptfadapter.dataplane.get_mac(0, ptf_port_idx),
        pktlen=1246,
        ip_src="10.250.136.195",
        ip_dst="10.156.94.34",
        ip_proto=47,
        ip_tos=0x84,
        ip_id=0,
        ip_ihl=5,
        ip_ttl=121,
    )
    pkt.payload.flags = 2
    exp_pkt = pkt.copy()
    exp_pkt.payload.ttl = 120
    exp_pkt.payload.chksum = 0x0100
    exp_pkt = mask.Mask(exp_pkt)
    exp_pkt.set_do_not_care_scapy(packet.Ether, 'dst')
    exp_pkt.set_do_not_care_scapy(packet.Ether, 'src')

    out_rif_ifaces, out_ifaces = TestIPPacket.parse_interfaces(duthost.command("show ip route 10.156.94.34")["stdout_lines"],
                                               pc_ports_map)
    logger.info("out_rif_ifaces: {}, out_ifaces: {}".format(out_rif_ifaces, out_ifaces))
    out_ptf_indices = map(lambda iface: ptf_indices[iface], out_ifaces)

    duthost.command("portstat -c")
    if rif_support:
        duthost.command("sonic-clear rifcounters")
    ptfadapter.dataplane.flush()

    testutils.send(ptfadapter, ptf_port_idx, pkt, self.PKT_NUM)
    time.sleep(5)
    match_cnt = testutils.count_matched_packets_all_ports(ptfadapter, exp_pkt, ports=out_ptf_indices)

    portstat_out = parse_portstat(duthost.command("portstat")["stdout_lines"])
    if rif_support:
        rif_counter_out = TestIPPacket.parse_rif_counters(duthost.command("show interfaces counters rif")["stdout_lines"])

    # In different platforms, IP packets with specific checksum will be dropped in different layer
    # We use both layer 2 counter and layer 3 counter to check where packet are dropped
    rx_ok = int(portstat_out[peer_ip_ifaces_pair[0][1][0]]["rx_ok"].replace(",", ""))
    rx_drp = int(portstat_out[peer_ip_ifaces_pair[0][1][0]]["rx_drp"].replace(",", ""))
    rx_err = int(rif_counter_out[rif_rx_ifaces]["rx_err"].replace(",", "")) if rif_support else 0
    tx_ok = TestIPPacket.sum_ifaces_counts(portstat_out, out_ifaces, "tx_ok")
    tx_drp = TestIPPacket.sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
    tx_err = TestIPPacket.sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0
  pytest_assert(rx_ok >= self.PKT_NUM_MIN, "Received {} packets in rx, not in expected range".format(rx_ok))

E Failed: Received 0 packets in rx, not in expected range

common_param = ([(u'10.0.0.61', [u'Ethernet120']), (u'10.0.0.63', [u'Ethernet124'])], u'PortChannel103', True, 30, {u'PortChannel101'..., u'PortChannel104': [u'Ethernet124']}, {'Ethernet0': 0, 'Ethernet100': 25, 'Ethernet104': 26, 'Ethernet108': 27, ...}) duthost = <MultiAsicSonicHost vlab-01> exp_pkt = <ptf.mask.Mask instance at 0x7f406e235d70> match_cnt = 682 out_ifaces = [u'Ethernet112', u'Ethernet116', u'Ethernet120', u'Ethernet124'] out_ptf_indices = [28, 29, 30, 31] out_rif_ifaces = ['PortChannel101', 'PortChannel102', 'PortChannel103', 'PortChannel104'] pc_ports_map = {u'PortChannel101': [u'Ethernet112'], u'PortChannel102': [u'Ethernet116'], u'PortChannel103': [u'Ethernet120'], u'PortChannel104': [u'Ethernet124']} peer_ip_ifaces_pair = [(u'10.0.0.61', [u'Ethernet120']), (u'10.0.0.63', [u'Ethernet124'])] pkt = <Ether dst=52:54:00:e8:45:75 src=aa:d7:77:94:65:1e type=IPv4 |<IP ihl=5 tos=...9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb' |>>> portstat_out = {'Ethernet0': {'rx_bps': '0.00 B/s', 'rx_drp': '0', 'rx_err': '0', 'rx_ok': '0', ...}, 'Ethernet100': {'rx_bps': '0.00...: '0', 'rx_ok': '0', ...}, 'Ethernet108': {'rx_bps': '0.00 B/s', 'rx_drp': '0', 'rx_err': '0', 'rx_ok': '0', ...}, ...} ptf_indices = {'Ethernet0': 0, 'Ethernet100': 25, 'Ethernet104': 26, 'Ethernet108': 27, ...} ptf_port_idx = 30 ptfadapter = <tests.common.plugins.ptfadapter.ptfadapter.PtfTestAdapter testMethod=runTest> rif_counter_out = {'PortChannel101': {'rx_bps': '0.00 B/s', 'rx_err': '0', 'rx_ok': '0', 'rx_pps': '0.00/s', ...}, 'PortChannel102': {'r...': '0.00/s', ...}, 'PortChannel104': {'rx_bps': '0.00 B/s', 'rx_err': '0', 'rx_ok': '0', 'rx_pps': '0.00/s', ...}, ...} rif_rx_ifaces = u'PortChannel103' rif_support = True rx_drp = 0 rx_err = 0 rx_ok = 0 self = <tests.ip.test_ip_packet.TestIPPacket object at 0x7f407004e690> tx_drp = 0 tx_err = 0 tx_ok = 0

ip/test_ip_packet.py:202: Failed

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```

Wlyy0314 avatar Nov 08 '22 08:11 Wlyy0314

@wangxin When running this test case, it always reports that the number of messages received is 0. What configuration should be done to run this test case?

Wlyy0314 avatar Nov 08 '22 08:11 Wlyy0314

Hi @Wlyy0314 Currently, ip/test_ip_packet.py can't be run on KVM testbed.

Sample: https://www.testbed-tools.org/scheduler/testplan/9890

yejianquan avatar Dec 02 '22 06:12 yejianquan