Skip to content

DHCP relay test fails for particular length of option-82  #1033

@ArunSaravananBalachandran

Description

Description

DHCP relay test fails , when the expected BOOTP packet length is 299 bytes without the padding bytes. The script fails during the masking of the expected relayed discover packet.

Topology: T0

Steps to reproduce the issue:

  1. The combined length of the hostname and interface alias used should be 31 bytes [ in my case hostname = sonic-s5232f-9364 (length : 17), client_iface_alias = hundredGigE1/2 (length: 14) ]
  2. run dhcp_relay test

Note: When i reduce the length of the hostname used to fewer bytes, the issue is not seen
Describe the results you received:

Failure log:

TASK [test : PTF Test - DHCP Relay Test] ***************************************
task path: /var/johnar/sonic-mgmt/ansible/roles/test/tasks/ptf_runner.yml:42
Wednesday 17 July 2019  11:27:06 +0000 (0:00:00.126)       0:00:25.161 ******** 
ok: [sonic-s5232f-9364] => {
    "msg": "ptf --test-dir ptftests dhcp_relay_test.DHCPTest   --platform-dir ptftests  --platform remote  -t \"hostname=\\\"sonic-s5232f-9364\\\";client_port_index=\\\"1\\\";client_iface_alias=\\\"hundredGigE1/2\\\";leaf_port_indices=\\\"[31, 30, 29, 28]\\\";num_dhcp_servers=\\\"4\\\";server_ip=\\\"192.0.0.1\\\";relay_iface_ip=\\\"192.168.0.1\\\";relay_iface_mac=\\\"3c:2c:30:6d:80:00\\\";relay_iface_netmask=\\\"255.255.248.0\\\"\"  --relax 2>&1"
}

TASK [test : command] **********************************************************
task path: /var/johnar/sonic-mgmt/ansible/roles/test/tasks/ptf_runner.yml:45
Wednesday 17 July 2019  11:27:06 +0000 (0:00:00.177)       0:00:25.339 ******** 
<10.16.210.140> ESTABLISH SSH CONNECTION FOR USER: root
<10.16.210.140> SSH: EXEC sshpass -d15 ssh -C -q -o ControlMaster=auto -o ControlPersist=120s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.16.210.140 'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python'
changed: [sonic-s5232f-9364 -> 10.16.210.140] => {"changed": true, "cmd": "ptf --test-dir ptftests dhcp_relay_test.DHCPTest   --platform-dir ptftests  --platform remote  -t \"hostname=\\\"sonic-s5232f-9364\\\";client_port_index=\\\"1\\\";client_iface_alias=\\\"hundredGigE1/2\\\";leaf_port_indices=\\\"[31, 30, 29, 28]\\\";num_dhcp_servers=\\\"4\\\";server_ip=\\\"192.0.0.1\\\";relay_iface_ip=\\\"192.168.0.1\\\";relay_iface_mac=\\\"3c:2c:30:6d:80:00\\\";relay_iface_netmask=\\\"255.255.248.0\\\"\"  --relax 2>&1", "delta": "0:00:21.362556", "end": "2019-07-17 11:27:27.858803", "failed": false, "failed_when_result": false, "invocation": {"module_args": {"_raw_params": "ptf --test-dir ptftests dhcp_relay_test.DHCPTest   --platform-dir ptftests  --platform remote  -t \"hostname=\\\"sonic-s5232f-9364\\\";client_port_index=\\\"1\\\";client_iface_alias=\\\"hundredGigE1/2\\\";leaf_port_indices=\\\"[31, 30, 29, 28]\\\";num_dhcp_servers=\\\"4\\\";server_ip=\\\"192.0.0.1\\\";relay_iface_ip=\\\"192.168.0.1\\\";relay_iface_mac=\\\"3c:2c:30:6d:80:00\\\";relay_iface_netmask=\\\"255.255.248.0\\\"\"  --relax 2>&1", "_uses_shell": true, "chdir": "/root", "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 1, "start": "2019-07-17 11:27:06.496247", "stderr": "", "stdout": "WARNING: No route found for IPv6 destination :: (no default route?)\ndhcp_relay_test.DHCPTest ... ERROR\n\n======================================================================\nERROR: dhcp_relay_test.DHCPTest\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File \"ptftests/dhcp_relay_test.py\", line 524, in runTest\n    self.verify_relayed_discover()\n  File \"ptftests/dhcp_relay_test.py\", line 399, in verify_relayed_discover\n    masked_discover.set_do_not_care_scapy(scapy.PADDING, \"load\")\n  File \"/usr/lib/python2.7/dist-packages/ptf/mask.py\", line 41, in set_do_not_care_scapy\n    self.set_do_not_care(hdr_offset * 8 + offset, bitwidth)\n  File \"/usr/lib/python2.7/dist-packages/ptf/mask.py\", line 16, in set_do_not_care\n    self.mask[offsetB] = self.mask[offsetB] & (~(1 << (7 - offsetb)))\nIndexError: list index out of range\n\n----------------------------------------------------------------------\nRan 1 test in 20.027s\n\nFAILED (errors=1)", "stdout_lines": ["WARNING: No route found for IPv6 destination :: (no default route?)", "dhcp_relay_test.DHCPTest ... ERROR", "", "======================================================================", "ERROR: dhcp_relay_test.DHCPTest", "----------------------------------------------------------------------", "Traceback (most recent call last):", "  File \"ptftests/dhcp_relay_test.py\", line 524, in runTest", "    self.verify_relayed_discover()", "  File \"ptftests/dhcp_relay_test.py\", line 399, in verify_relayed_discover", "    masked_discover.set_do_not_care_scapy(scapy.PADDING, \"load\")", "  File \"/usr/lib/python2.7/dist-packages/ptf/mask.py\", line 41, in set_do_not_care_scapy", "    self.set_do_not_care(hdr_offset * 8 + offset, bitwidth)", "  File \"/usr/lib/python2.7/dist-packages/ptf/mask.py\", line 16, in set_do_not_care", "    self.mask[offsetB] = self.mask[offsetB] & (~(1 << (7 - offsetb)))", "IndexError: list index out of range", "", "----------------------------------------------------------------------", "Ran 1 test in 20.027s", "", "FAILED (errors=1)"], "warnings": []}

TASK [test : debug] ************************************************************
task path: /var/johnar/sonic-mgmt/ansible/roles/test/tasks/ptf_runner.yml:52
Wednesday 17 July 2019  11:27:27 +0000 (0:00:21.633)       0:00:46.972 ******** 
ok: [sonic-s5232f-9364] => {
    "out.stdout_lines": [
        "WARNING: No route found for IPv6 destination :: (no default route?)", 
        "dhcp_relay_test.DHCPTest ... ERROR", 
        "", 
        "======================================================================", 
        "ERROR: dhcp_relay_test.DHCPTest", 
        "----------------------------------------------------------------------", 
        "Traceback (most recent call last):", 
        "  File \"ptftests/dhcp_relay_test.py\", line 524, in runTest", 
        "    self.verify_relayed_discover()", 
        "  File \"ptftests/dhcp_relay_test.py\", line 399, in verify_relayed_discover", 
        "    masked_discover.set_do_not_care_scapy(scapy.PADDING, \"load\")", 
        "  File \"/usr/lib/python2.7/dist-packages/ptf/mask.py\", line 41, in set_do_not_care_scapy", 
        "    self.set_do_not_care(hdr_offset * 8 + offset, bitwidth)", 
        "  File \"/usr/lib/python2.7/dist-packages/ptf/mask.py\", line 16, in set_do_not_care", 
        "    self.mask[offsetB] = self.mask[offsetB] & (~(1 << (7 - offsetb)))", 
        "IndexError: list index out of range", 
        "", 
        "----------------------------------------------------------------------", 
        "Ran 1 test in 20.027s", 
        "", 
        "FAILED (errors=1)"
    ]
}

Describe the results you expected:

Additional information you deem important:

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