Skip to content

DHCP Relay Agent Test Plan

Joe LeVeque edited this page Feb 22, 2017 · 26 revisions

Overview

This test is aimed at confirming some of the features in the isc-dhcp-relay implementation. We must insure the basic objective the dhcp relay agent is met. This involves validating that DHCP discover, offer, request, and ack packets are successfully relayed from client to server(s). We must also insure that features such as attaching an Option 82 header are supported by this agent.

PTF Test

  • Basic DHCP packet construction functions have been added to p4/ptf/testutils (dhcp discover, offer, request, ack)
  • PTF test simulates a DHCP client acquiring a lease
    • We simulate a DHCP client (a server under the ToR) booting up by manually creating DHCP packets and sending them on an interface that is part of the ToR's VLAN.
  1. Create a DHCPDISCOVER packet and send it to the ToR on an interface that is part of the ToR's VLAN. The DHCP relay should receive this packet, add and Option 82 header and forward the packet to all known DHCP servers via it's uplinks.
  2. Listen to all packets on the ToR's uplinks and count the number of forwarded DHCPDISCOVER packets to ensure one is sent to every known DHCP server.
  3. Create a DHCPOFFER packet and send it to the ToR via one of its uplinks. The DHCP relay should forward this packet to the "client" on its VLAN
  4. Listen for the DHCPOFFER on the "client's" interface to ensure it would be received
  5. Create a DHCPREQUEST packet and send it to the ToR on an interface that is part of the ToR's VLAN. The DHCP relay should receive this packet, add and Option 82 header and forward the packet to all known DHCP servers via it's uplinks.
  6. Listen to all packets on the ToR's uplinks and count the number of forwarded DHCPREQUEST packets to ensure one is sent to every known DHCP server.
  7. Create a DHCPACK packet and send it to the ToR via one of its uplinks. The DHCP relay should forward this packet to the "client" on its VLAN
  8. Listen for the DHCPACK on the "client's" interface to ensure it would be received

Related Files

  • sonic-mgmt/ansible/roles/test/files/ptftests/dhcp_relay_test.py
    • Main PTF testing script
  • sonic-mgmt/ansible/roles/test/tasks/dhcp_relay.yml
    • Ansible playbook for deploying/running test on switch
  • sonic-mgmt/ansible/roles/sonic-common/templates/dhcp_relay.yml.j2
    • Jinja2 template used to dynamically populate DHCP server IP addresses into sonic-mgmt/ansible/roles/test/tasks/dhcp_relay.yml.

DHCP servers should be defined in sonic-mgmt/ansible/group_vars/ as an attribute of your test environment, similar to the following:

# DHCP servers
dhcp_servers: ["192.0.0.1", "192.0.0.2", "192.0.0.3", "192.0.0.4"]

How to Run Test

  • ansible-playbook -i str --limit <switch-running-relay-agent> test.yml -e "ptf_host=<IP-address-of-PTF-container>" --tags=dhcp_relay --vault-password-file <path-to-vault-password-file> -vvvv
Clone this wiki locally