X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_dhcp.py;h=bdc5df7a26731144d035a92b4025bb4383f752d4;hb=ef1ae3ad01ab2a02c085dbbe5473d8109f5f1aea;hp=d1af9fd9e7debdababa475f473cfffeacc62de8f;hpb=f6e9b014cbd0ba5a757565a6a0179065d7236463;p=vpp.git diff --git a/test/test_dhcp.py b/test/test_dhcp.py index d1af9fd9e7d..bdc5df7a267 100644 --- a/test/test_dhcp.py +++ b/test/test_dhcp.py @@ -8,6 +8,7 @@ from framework import VppTestCase, VppTestRunner, running_extended_tests from vpp_neighbor import VppNeighbor from vpp_ip_route import find_route, VppIpTable from util import mk_ll_addr +import scapy.compat from scapy.layers.l2 import Ether, getmacbyip, ARP from scapy.layers.inet import IP, UDP, ICMP from scapy.layers.inet6 import IPv6, in6_getnsmac @@ -30,6 +31,14 @@ DHCP6_SERVER_PORT = 546 class TestDHCP(VppTestCase): """ DHCP Test Case """ + @classmethod + def setUpClass(cls): + super(TestDHCP, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + super(TestDHCP, cls).tearDownClass() + def setUp(self): super(TestDHCP, self).setUp() @@ -490,7 +499,7 @@ class TestDHCP(VppTestCase): # # 1. not our IP address = not checked by VPP? so offer is replayed # to client - bad_ip = option_82[0:8] + chr(33) + option_82[9:] + bad_ip = option_82[0:8] + scapy.compat.chb(33) + option_82[9:] p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) / IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) / @@ -504,7 +513,7 @@ class TestDHCP(VppTestCase): "DHCP offer option 82 bad address") # 2. Not a sw_if_index VPP knows - bad_if_index = option_82[0:2] + chr(33) + option_82[3:] + bad_if_index = option_82[0:2] + scapy.compat.chb(33) + option_82[3:] p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) / IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) / @@ -1213,7 +1222,7 @@ class TestDHCP(VppTestCase): # # Configure DHCP client on PG3 and capture the discover sent # - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname) rx = self.pg3.get_capture(1) @@ -1283,7 +1292,7 @@ class TestDHCP(VppTestCase): # # remove the DHCP config # - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname, is_add=0) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname, is_add=0) # # and now the route should be gone @@ -1297,8 +1306,8 @@ class TestDHCP(VppTestCase): self.pg3.admin_down() self.sleep(1) self.pg3.admin_up() - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname, - client_id=self.pg3.local_mac) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname, + client_id=self.pg3.local_mac) rx = self.pg3.get_capture(1) @@ -1355,7 +1364,7 @@ class TestDHCP(VppTestCase): # # remove the DHCP config # - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname, is_add=0) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname, is_add=0) self.assertFalse(find_route(self, self.pg3.local_ip4, 32)) self.assertFalse(find_route(self, self.pg3.local_ip4, 24)) @@ -1367,8 +1376,8 @@ class TestDHCP(VppTestCase): # # Configure DHCP client on PG3 and capture the discover sent # - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname, - set_broadcast_flag=0) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname, + set_broadcast_flag=0) rx = self.pg3.get_capture(1) @@ -1462,7 +1471,7 @@ class TestDHCP(VppTestCase): # # remove the DHCP config # - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname, is_add=0) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname, is_add=0) # # and now the route should be gone @@ -1476,7 +1485,7 @@ class TestDHCP(VppTestCase): self.pg3.admin_down() self.sleep(1) self.pg3.admin_up() - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname) rx = self.pg3.get_capture(1) @@ -1553,7 +1562,7 @@ class TestDHCP(VppTestCase): # # remove the DHCP config # - self.vapi.dhcp_client(self.pg3.sw_if_index, hostname, is_add=0) + self.vapi.dhcp_client_config(self.pg3.sw_if_index, hostname, is_add=0) if __name__ == '__main__':