from framework import VppTestCase, VppTestRunner
from vpp_neighbor import VppNeighbor
-from vpp_ip_route import find_route
+from vpp_ip_route import find_route, VppIpTable
from util import mk_ll_addr
from scapy.layers.l2 import Ether, getmacbyip, ARP
from socket import AF_INET, AF_INET6
from scapy.utils import inet_pton, inet_ntop
from scapy.utils6 import in6_ptop
+from util import mactobinary
DHCP4_CLIENT_PORT = 68
DHCP4_SERVER_PORT = 67
# create 3 pg interfaces
self.create_pg_interfaces(range(4))
+ self.tables = []
# pg0 and 1 are IP configured in VRF 0 and 1.
# pg2 and 3 are non IP-configured in VRF 0 and 1
+ table_id = 0
+ for table_id in range(1, 4):
+ tbl4 = VppIpTable(self, table_id)
+ tbl4.add_vpp_config()
+ self.tables.append(tbl4)
+ tbl6 = VppIpTable(self, table_id, is_ip6=1)
+ tbl6.add_vpp_config()
+ self.tables.append(tbl6)
+
table_id = 0
for i in self.pg_interfaces[:2]:
i.admin_up()
table_id += 1
def tearDown(self):
- super(TestDHCP, self).tearDown()
- for i in self.pg_interfaces:
+ for i in self.pg_interfaces[:2]:
i.unconfig_ip4()
i.unconfig_ip6()
+
+ for i in self.pg_interfaces:
+ i.set_table_ip4(0)
+ i.set_table_ip6(0)
i.admin_down()
+ super(TestDHCP, self).tearDown()
def send_and_assert_no_replies(self, intf, pkts, remark):
intf.add_stream(pkts)
"DHCP cleanup VRF 0")
self.send_and_assert_no_replies(self.pg3, pkts_disc_vrf1,
"DHCP cleanup VRF 1")
+ self.pg2.unconfig_ip4()
+ self.pg3.unconfig_ip4()
def test_dhcp6_proxy(self):
""" DHCPv6 Proxy"""
server_table_id=0,
is_ipv6=1,
is_add=0)
+ self.pg2.unconfig_ip6()
+ self.pg3.unconfig_ip6()
def test_dhcp_client(self):
""" DHCP Client"""
# remove the left over ARP entry
self.vapi.ip_neighbor_add_del(self.pg2.sw_if_index,
- self.pg2.remote_mac,
+ mactobinary(self.pg2.remote_mac),
self.pg2.remote_ip4,
is_add=0)
#