Skip to content

[test_wr_arp.py] Failed: Empty DIP returned #2330

@stephengzh

Description

@stephengzh

Description

Run wr_arp test on t0 topo, and failed in empty DIP.

Steps to reproduce the issue:

  1. Run test_wr_arp.py on T0 topo

Describe the results you received:
________________________________________ ERROR at setup of TestWrArp.testWrArp ________________________________________

self = <tests.arp.test_wr_arp.TestWrArp instance at 0x7f01a06f91b8>
duthost = <tests.common.devices.SonicHost object at 0x7f01a071ac10>
ptfhost = <tests.common.devices.PTFHost object at 0x7f01a071ab10>

@pytest.fixture(scope='class', autouse=True)
def setupFerret(self, duthost, ptfhost):
    '''
        Sets Ferret service on PTF host. This class-scope fixture runs once before test start

        Args:
            duthost (AnsibleHost): Device Under Test (DUT)
            ptfhost (AnsibleHost): Packet Test Framework (PTF)

        Returns:
            None
    '''
    ptfhost.copy(src="arp/files/ferret.py", dest="/opt")

    '''
        Get the IP which will be used by ferret script from the "ip route show type unicast"
        command output. The output looks as follows:

        default proto 186 src 10.1.0.32 metric 20
            nexthop via 10.0.0.57  dev PortChannel0001 weight 1
            nexthop via 10.0.0.59  dev PortChannel0002 weight 1
            nexthop via 10.0.0.61  dev PortChannel0003 weight 1
            nexthop via 10.0.0.63  dev PortChannel0004 weight 1
        10.0.0.56/31 dev PortChannel0001 proto kernel scope link src 10.0.0.56
        10.232.24.0/23 dev eth0 proto kernel scope link src 10.232.24.122
        100.1.0.29 via 10.0.0.57 dev PortChannel0001 proto 186 src 10.1.0.32 metric 20
        192.168.0.0/21 dev Vlan1000 proto kernel scope link src 192.168.0.1
        192.168.8.0/25 proto 186 src 10.1.0.32 metric 20
            nexthop via 10.0.0.57  dev PortChannel0001 weight 1
            nexthop via 10.0.0.59  dev PortChannel0002 weight 1
            nexthop via 10.0.0.61  dev PortChannel0003 weight 1
            nexthop via 10.0.0.63  dev PortChannel0004 weight 1
        192.168.16.0/25 proto 186 src 10.1.0.32 metric 20
        ...

        We'll use the first subnet IP taken from zebra protocol as the base for the host IP.
        As in the new SONiC image the proto will look as '186'(201911) or bgp (master)
        instead of 'zebra' (like it looks in 201811)the filtering output command below will pick
        the first line containing either 'proto zebra' (or 'proto 186' or 'proto bgp')
        (except the one for the deafult route) and take host IP from the subnet IP. For the output
        above 192.168.8.0/25 subnet will be taken and host IP given to ferret script will be 192.168.8.1
    '''
    result = duthost.shell(
        cmd='''ip route show type unicast |
        sed -e '/proto 186\|proto zebra\|proto bgp/!d' -e '/default/d' -ne '/0\//p' |
        head -n 1 |
        sed -ne 's/0\/.*$/1/p'
        '''
    )
    assert len(result['stderr_lines']) == 0, 'Could not obtain DIP'
  pytest_assert(len(result['stdout'].strip()) > 0, 'Empty DIP returned')

E Failed: Empty DIP returned

duthost = <tests.common.devices.SonicHost object at 0x7f01a071ac10>
ptfhost = <tests.common.devices.PTFHost object at 0x7f01a071ab10>
result = {'stderr_lines': [], u'cmd': u"ip route show type unicast |\n sed -...tdin_add_newline': True, u'stdin': None}}, 'stdout_lines': [], 'failed': False}
self = <tests.arp.test_wr_arp.TestWrArp instance at 0x7f01a06f91b8>

arp/test_wr_arp.py:103: Failed

Describe the results you expected:
Pass

Additional information you deem important:

**Output of `show version`:**

201911 and master, both reproduced

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

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions