summaryrefslogtreecommitdiffstats
path: root/test/test_ip6.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_ip6.py')
-rw-r--r--test/test_ip6.py54
1 files changed, 42 insertions, 12 deletions
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 33194ebc5b2..1d7fa766d14 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -10,7 +10,7 @@ from vpp_pg_interface import is_ipv6_misc
from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, find_route, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
- VppMplsRoute, VppMplsTable, VppIpTable
+ VppMplsRoute, VppMplsTable, VppIpTable, VppIpAddress
from vpp_neighbor import find_nbr, VppNeighbor
from scapy.packet import Raw
@@ -1867,7 +1867,7 @@ class TestIP6Punt(VppTestCase):
def setUp(self):
super(TestIP6Punt, self).setUp()
- self.create_pg_interfaces(range(2))
+ self.create_pg_interfaces(range(4))
for i in self.pg_interfaces:
i.admin_up()
@@ -1894,12 +1894,10 @@ class TestIP6Punt(VppTestCase):
#
# Configure a punt redirect via pg1.
#
- nh_addr = inet_pton(AF_INET6,
- self.pg1.remote_ip6)
+ nh_addr = VppIpAddress(self.pg1.remote_ip6).encode()
self.vapi.ip_punt_redirect(self.pg0.sw_if_index,
self.pg1.sw_if_index,
- nh_addr,
- is_ip6=1)
+ nh_addr)
self.send_and_expect(self.pg0, pkts, self.pg1)
@@ -1937,8 +1935,7 @@ class TestIP6Punt(VppTestCase):
self.vapi.ip_punt_redirect(self.pg0.sw_if_index,
self.pg1.sw_if_index,
nh_addr,
- is_add=0,
- is_ip6=1)
+ is_add=0)
self.send_and_assert_no_replies(self.pg0, pkts,
"IP no punt config")
@@ -1947,15 +1944,48 @@ class TestIP6Punt(VppTestCase):
#
self.vapi.ip_punt_redirect(0xffffffff,
self.pg1.sw_if_index,
- nh_addr,
- is_ip6=1)
+ nh_addr)
self.send_and_expect(self.pg0, pkts, self.pg1)
self.vapi.ip_punt_redirect(0xffffffff,
self.pg1.sw_if_index,
nh_addr,
- is_add=0,
- is_ip6=1)
+ is_add=0)
+
+ def test_ip_punt_dump(self):
+ """ IP6 punt redirect dump"""
+
+ #
+ # Configure a punt redirects
+ #
+ nh_addr = VppIpAddress(self.pg3.remote_ip6).encode()
+ self.vapi.ip_punt_redirect(self.pg0.sw_if_index,
+ self.pg3.sw_if_index,
+ nh_addr)
+ self.vapi.ip_punt_redirect(self.pg1.sw_if_index,
+ self.pg3.sw_if_index,
+ nh_addr)
+ self.vapi.ip_punt_redirect(self.pg2.sw_if_index,
+ self.pg3.sw_if_index,
+ VppIpAddress('0::0').encode())
+
+ #
+ # Dump pg0 punt redirects
+ #
+ punts = self.vapi.ip_punt_redirect_dump(self.pg0.sw_if_index,
+ is_ipv6=1)
+ for p in punts:
+ self.assertEqual(p.punt.rx_sw_if_index, self.pg0.sw_if_index)
+
+ #
+ # Dump punt redirects for all interfaces
+ #
+ punts = self.vapi.ip_punt_redirect_dump(0xffffffff, is_ipv6=1)
+ self.assertEqual(len(punts), 3)
+ for p in punts:
+ self.assertEqual(p.punt.tx_sw_if_index, self.pg3.sw_if_index)
+ self.assertNotEqual(punts[1].punt.nh.un.ip6, self.pg3.remote_ip6)
+ self.assertEqual(punts[2].punt.nh.un.ip6.address, '\x00'*16)
class TestIPDeag(VppTestCase):