aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_ip_route.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-01-13 07:57:46 -0800
committerNeale Ranns <nranns@cisco.com>2017-01-26 05:14:35 -0800
commitfca0c242e4edfdb05231ef18d60c14273067ff0a (patch)
tree440c9952bd79e9c58699eb787a619803c5fa49fa /test/vpp_ip_route.py
parentdc90d423a547f3f948953e427b681f2834c8a9d6 (diff)
DHCPv[46] proxy tests
Change-Id: I6aaf9c602cd515ed9d4416d286f9191d048c1a87 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_ip_route.py')
-rw-r--r--test/vpp_ip_route.py67
1 files changed, 49 insertions, 18 deletions
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index 975e3934f13..fc9133fbec6 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -19,12 +19,16 @@ class RoutePath:
nh_sw_if_index,
nh_table_id=0,
labels=[],
- nh_via_label=MPLS_LABEL_INVALID):
- self.nh_addr = socket.inet_pton(socket.AF_INET, nh_addr)
+ nh_via_label=MPLS_LABEL_INVALID,
+ is_ip6=0):
self.nh_itf = nh_sw_if_index
self.nh_table_id = nh_table_id
self.nh_via_label = nh_via_label
self.nh_labels = labels
+ if is_ip6:
+ self.nh_addr = socket.inet_pton(socket.AF_INET6, nh_addr)
+ else:
+ self.nh_addr = socket.inet_pton(socket.AF_INET, nh_addr)
class IpRoute:
@@ -33,34 +37,61 @@ class IpRoute:
"""
def __init__(self, test, dest_addr,
- dest_addr_len, paths, table_id=0):
+ dest_addr_len, paths, table_id=0, is_ip6=0, is_local=0):
self._test = test
self.paths = paths
- self.dest_addr = socket.inet_pton(socket.AF_INET, dest_addr)
self.dest_addr_len = dest_addr_len
self.table_id = table_id
+ self.is_ip6 = is_ip6
+ self.is_local = is_local
+ if is_ip6:
+ self.dest_addr = socket.inet_pton(socket.AF_INET6, dest_addr)
+ else:
+ self.dest_addr = socket.inet_pton(socket.AF_INET, dest_addr)
def add_vpp_config(self):
- for path in self.paths:
+ if self.is_local:
self._test.vapi.ip_add_del_route(
self.dest_addr,
self.dest_addr_len,
- path.nh_addr,
- path.nh_itf,
+ socket.inet_pton(socket.AF_INET6, "::"),
+ 0xffffffff,
+ is_local=1,
table_id=self.table_id,
- next_hop_out_label_stack=path.nh_labels,
- next_hop_n_out_labels=len(
- path.nh_labels),
- next_hop_via_label=path.nh_via_label)
+ is_ipv6=self.is_ip6)
+ else:
+ for path in self.paths:
+ self._test.vapi.ip_add_del_route(
+ self.dest_addr,
+ self.dest_addr_len,
+ path.nh_addr,
+ path.nh_itf,
+ table_id=self.table_id,
+ next_hop_out_label_stack=path.nh_labels,
+ next_hop_n_out_labels=len(
+ path.nh_labels),
+ next_hop_via_label=path.nh_via_label,
+ is_ipv6=self.is_ip6)
def remove_vpp_config(self):
- for path in self.paths:
- self._test.vapi.ip_add_del_route(self.dest_addr,
- self.dest_addr_len,
- path.nh_addr,
- path.nh_itf,
- table_id=self.table_id,
- is_add=0)
+ if self.is_local:
+ self._test.vapi.ip_add_del_route(
+ self.dest_addr,
+ self.dest_addr_len,
+ socket.inet_pton(socket.AF_INET6, "::"),
+ 0xffffffff,
+ is_local=1,
+ is_add=0,
+ table_id=self.table_id,
+ is_ipv6=self.is_ip6)
+ else:
+ for path in self.paths:
+ self._test.vapi.ip_add_del_route(self.dest_addr,
+ self.dest_addr_len,
+ path.nh_addr,
+ path.nh_itf,
+ table_id=self.table_id,
+ is_add=0)
class MplsIpBind: