Skip to content

DHCP Relay Agent Test Plan

mbrar edited this page Dec 5, 2016 · 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 client acquiring an a lease
  • aquire_address tests new client coming online and acquiring an ip address via dhcp relay agent
  • verify_discover_count ensures dhcp relay agent forwarding works for up to 32 configured dhcp servers
  • verify_option82 ensures that option 82 headers are inserted into dhcp packets
  • release_address simulates client releasing ip address and verifies successful release

acquire_address()

  • broadcasts dhcp discover
  • relay agent forwards to all X number of dhcp servers configured
  • current implementation tests with 32 dhcp servers, 1 real server is configured, 31 servers are simulated by setting route to forward all x.x.x.x/24 ips to the one real dhcp server
  • packet count is verified on the actual dhcp server, as well as packet contents
  • dhcp offer, request, and ack are forwarded in similar fashion

verify_discover_count()

  • analyzes the pcap file which records all packets transmitted and received
  • ensure that X (in our case 32) number of packets were recorded

verify_option82()

  • ensure that /var/lib/dhcp/dhcp.leases file contains Option 82 for each lease issued
  • parse_leasefile helper function is used to create a list of leases from reading /var/lib/dhcp/dhcp.leases

release_address()

  • send dhcp release packet from client
  • verify that /var/lib/dhcp/dhcp.leases file is updated with lease released

How to Test

  • ansible-playbook -i str --limit [switch running relay agent] test.yml -vvvv --tags=relay -e "ptf_host=[ip of ptf container]" --vault-password-file [path to vault]
Clone this wiki locally