summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-07-18 09:26:53 -0700
committerNeale Ranns <nranns@cisco.com>2017-07-18 19:05:03 +0000
commit51822bf07a3f0fe72834ea94659faf6e262475ba (patch)
tree55acdc249df261a92d0ec09bb7c05a2d4fa7ca44 /test
parenta2fbf6ba0e2553687f56d9a9fb63e2972bdb26c6 (diff)
DHCP client option 61 "client_id"
the existing seeting of client_id to a VPP version number was unused and so overridden Change-Id: If9ebea936336f1fcca8d07e67186c95f8f8f0ccd Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_dhcp.py34
-rw-r--r--test/vpp_papi_provider.py2
2 files changed, 34 insertions, 2 deletions
diff --git a/test/test_dhcp.py b/test/test_dhcp.py
index 1700f6bab67..4e8ed4cedb7 100644
--- a/test/test_dhcp.py
+++ b/test/test_dhcp.py
@@ -9,7 +9,7 @@ from vpp_neighbor import VppNeighbor
from vpp_ip_route import find_route
from util import mk_ll_addr
-from scapy.layers.l2 import Ether, getmacbyip
+from scapy.layers.l2 import Ether, getmacbyip, ARP
from scapy.layers.inet import IP, UDP, ICMP
from scapy.layers.inet6 import IPv6, in6_getnsmac, in6_mactoifaceid
from scapy.layers.dhcp import DHCP, BOOTP, DHCPTypes
@@ -189,11 +189,13 @@ class TestDHCP(VppTestCase):
self.assertEqual(udp.dport, DHCP4_SERVER_PORT)
self.assertEqual(udp.sport, DHCP4_CLIENT_PORT)
- def verify_orig_dhcp_discover(self, pkt, intf, hostname):
+ def verify_orig_dhcp_discover(self, pkt, intf, hostname, client_id=None):
self.verify_orig_dhcp_pkt(pkt, intf)
self.verify_dhcp_msg_type(pkt, "discover")
self.verify_dhcp_has_option(pkt, "hostname", hostname)
+ if client_id:
+ self.verify_dhcp_has_option(pkt, "client_id", client_id)
def verify_orig_dhcp_request(self, pkt, intf, hostname, ip):
self.verify_orig_dhcp_pkt(pkt, intf)
@@ -1090,11 +1092,24 @@ class TestDHCP(VppTestCase):
self.pg_start()
#
+ # We'll get an ARP request for the router address
+ #
+ rx = self.pg2.get_capture(1)
+
+ self.assertEqual(rx[0][ARP].pdst, self.pg2.remote_ip4)
+ self.pg_enable_capture(self.pg_interfaces)
+
+ #
# At the end of this procedure there should be a connected route
# in the FIB
#
self.assertTrue(find_route(self, self.pg2.local_ip4, 32))
+ # remove the left over ARP entry
+ self.vapi.ip_neighbor_add_del(self.pg2.sw_if_index,
+ self.pg2.remote_mac,
+ self.pg2.remote_ip4,
+ is_add=0)
#
# remove the DHCP config
#
@@ -1105,6 +1120,21 @@ class TestDHCP(VppTestCase):
#
self.assertFalse(find_route(self, self.pg2.local_ip4, 32))
+ #
+ # Start the procedure again. this time have VPP send the clientiid
+ #
+ self.vapi.dhcp_client(self.pg2.sw_if_index, hostname,
+ client_id=self.pg2.local_mac)
+
+ rx = self.pg2.get_capture(1)
+
+ self.verify_orig_dhcp_discover(rx[0], self.pg2, hostname,
+ self.pg2.local_mac)
+
+ #
+ # remove the DHCP config
+ #
+ self.vapi.dhcp_client(self.pg2.sw_if_index, hostname, is_add=0)
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 31eadad87a9..2814ef97b9e 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -1758,6 +1758,7 @@ class VppPapiProvider(object):
def dhcp_client(self,
sw_if_index,
hostname,
+ client_id='',
is_add=1,
want_dhcp_events=0):
return self.api(
@@ -1765,6 +1766,7 @@ class VppPapiProvider(object):
{
'sw_if_index': sw_if_index,
'hostname': hostname,
+ 'client_id': client_id,
'is_add': is_add,
'want_dhcp_event': want_dhcp_events,
'pid': os.getpid(),