summaryrefslogtreecommitdiffstats
path: root/src/plugins/dhcp/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dhcp/test')
-rw-r--r--src/plugins/dhcp/test/test_dhcp6.py80
1 files changed, 38 insertions, 42 deletions
diff --git a/src/plugins/dhcp/test/test_dhcp6.py b/src/plugins/dhcp/test/test_dhcp6.py
index 02f420243cb..9beff5a60e5 100644
--- a/src/plugins/dhcp/test/test_dhcp6.py
+++ b/src/plugins/dhcp/test/test_dhcp6.py
@@ -641,15 +641,13 @@ class TestDHCPv6PDControlPlane(VppTestCase):
def test_prefixes(self):
""" Test handling of prefixes """
- address_bin_1 = None
- address_bin_2 = None
+ address1 = '::2:0:0:0:405/60'
+ address2 = '::76:0:0:0:406/62'
try:
- address_bin_1 = '\x00' * 6 + '\x00\x02' + '\x00' * 6 + '\x04\x05'
- address_prefix_length_1 = 60
- self.vapi.ip6_add_del_address_using_prefix(self.pg1.sw_if_index,
- address_bin_1,
- address_prefix_length_1,
- self.prefix_group)
+ self.vapi.ip6_add_del_address_using_prefix(
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address1,
+ prefix_group=self.prefix_group)
ia_pd_opts = DHCP6OptIAPrefix(prefix='7:8::', plen=56, preflft=2,
validlft=3)
@@ -668,12 +666,10 @@ class TestDHCPv6PDControlPlane(VppTestCase):
self.sleep(1)
- address_bin_2 = '\x00' * 6 + '\x00\x76' + '\x00' * 6 + '\x04\x06'
- address_prefix_length_2 = 62
- self.vapi.ip6_add_del_address_using_prefix(self.pg1.sw_if_index,
- address_bin_2,
- address_prefix_length_2,
- self.prefix_group)
+ self.vapi.ip6_add_del_address_using_prefix(
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address2,
+ prefix_group=self.prefix_group)
self.sleep(1)
@@ -698,14 +694,16 @@ class TestDHCPv6PDControlPlane(VppTestCase):
self.assertEqual(len(new_addresses), 0)
finally:
- if address_bin_1 is not None:
+ if address1 is not None:
self.vapi.ip6_add_del_address_using_prefix(
- self.pg1.sw_if_index, address_bin_1,
- address_prefix_length_1, self.prefix_group, is_add=0)
- if address_bin_2 is not None:
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address1,
+ prefix_group=self.prefix_group, is_add=0)
+ if address2 is not None:
self.vapi.ip6_add_del_address_using_prefix(
- self.pg1.sw_if_index, address_bin_2,
- address_prefix_length_2, self.prefix_group, is_add=0)
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address2,
+ prefix_group=self.prefix_group, is_add=0)
def test_sending_client_messages_solicit(self):
""" VPP receives messages from DHCPv6 client """
@@ -742,13 +740,12 @@ class TestDHCPv6PDControlPlane(VppTestCase):
def test_preferred_greater_than_valid_lifetime(self):
""" Preferred lifetime is greater than valid lifetime """
+ address1 = '::2:0:0:0:405/60'
try:
- address_bin = '\x00' * 6 + '\x00\x02' + '\x00' * 6 + '\x04\x05'
- address_prefix_length = 60
- self.vapi.ip6_add_del_address_using_prefix(self.pg1.sw_if_index,
- address_bin,
- address_prefix_length,
- self.prefix_group)
+ self.vapi.ip6_add_del_address_using_prefix(
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address1,
+ prefix_group=self.prefix_group)
self.wait_for_solicit()
self.send_advertise()
@@ -766,22 +763,21 @@ class TestDHCPv6PDControlPlane(VppTestCase):
self.assertEqual(len(new_addresses), 0)
finally:
- self.vapi.ip6_add_del_address_using_prefix(self.pg1.sw_if_index,
- address_bin,
- address_prefix_length,
- self.prefix_group,
- is_add=0)
+ self.vapi.ip6_add_del_address_using_prefix(
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address1,
+ prefix_group=self.prefix_group,
+ is_add=0)
def test_T1_greater_than_T2(self):
""" T1 is greater than T2 """
+ address1 = '::2:0:0:0:405/60'
try:
- address_bin = '\x00' * 6 + '\x00\x02' + '\x00' * 6 + '\x04\x05'
- address_prefix_length = 60
- self.vapi.ip6_add_del_address_using_prefix(self.pg1.sw_if_index,
- address_bin,
- address_prefix_length,
- self.prefix_group)
+ self.vapi.ip6_add_del_address_using_prefix(
+ sw_if_index=self.pg1.sw_if_index,
+ address_with_prefix=address1,
+ prefix_group=self.prefix_group)
self.wait_for_solicit()
self.send_advertise()
@@ -799,8 +795,8 @@ class TestDHCPv6PDControlPlane(VppTestCase):
self.assertEqual(len(new_addresses), 0)
finally:
- self.vapi.ip6_add_del_address_using_prefix(self.pg1.sw_if_index,
- address_bin,
- address_prefix_length,
- self.prefix_group,
- is_add=0)
+ self.vapi.ip6_add_del_address_using_prefix(
+ sw_if_index=self.pg1.sw_if_index,
+ prefix_group=self.prefix_group,
+ address_with_prefix=address1,
+ is_add=False)