summaryrefslogtreecommitdiffstats
path: root/test/vpp_srv6.py
diff options
context:
space:
mode:
authorPablo Camarillo <pcamaril@cisco.com>2018-06-19 15:49:02 +0200
committerDamjan Marion <dmarion@me.com>2018-06-19 16:32:11 +0000
commit3337bd22002e9b78459082c34f7b78370b177eb0 (patch)
tree3e0c8d4c5547a57cce74be05236c2c134fe15026 /test/vpp_srv6.py
parent2b9838ac60395c8c79cd1010025732aa9d7e9fac (diff)
Fixed bugs in SRv6 API
Jira ticket VPP-1196 Jira ticket VPP-1081 Jira ticket VPP-1078 Jira ticket VPP-1217 Change-Id: Id7e85229cae1017acb0aa4ca63ced334e6dafb8d Signed-off-by: pcamaril <pcamaril@cisco.com> Signed-off-by: Pablo Camarillo <pcamaril@cisco.com> Signed-off-by: pcamaril <pcamaril@cisco.com> Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'test/vpp_srv6.py')
-rw-r--r--test/vpp_srv6.py35
1 files changed, 14 insertions, 21 deletions
diff --git a/test/vpp_srv6.py b/test/vpp_srv6.py
index 28ff4b85991..7701cf35bc3 100644
--- a/test/vpp_srv6.py
+++ b/test/vpp_srv6.py
@@ -40,24 +40,15 @@ class VppSRv6LocalSID(VppObject):
SRv6 LocalSID
"""
- def __init__(self, test, localsid_addr, behavior, nh_addr, end_psp,
- sw_if_index, vlan_index, fib_table):
+ def __init__(self, test, localsid, behavior, nh_addr4, nh_addr6,
+ end_psp, sw_if_index, vlan_index, fib_table):
self._test = test
- self.localsid_addr = localsid_addr
- # keep binary format in _localsid_addr
- self._localsid_addr = inet_pton(AF_INET6, self.localsid_addr)
+ self.localsid = localsid
+ # keep binary format in _localsid
+ self.localsid["addr"] = inet_pton(AF_INET6, self.localsid["addr"])
self.behavior = behavior
- self.nh_addr = nh_addr
- # keep binary format in _nh_addr
- if ':' in nh_addr:
- # IPv6
- self._nh_addr = inet_pton(AF_INET6, nh_addr)
- else:
- # IPv4
- # API expects 16 octets (128 bits)
- # last 4 octets are used for IPv4
- # --> prepend 12 octets
- self._nh_addr = ('\x00' * 12) + inet_pton(AF_INET, nh_addr)
+ self.nh_addr4 = inet_pton(AF_INET, nh_addr4)
+ self.nh_addr6 = inet_pton(AF_INET6, nh_addr6)
self.end_psp = end_psp
self.sw_if_index = sw_if_index
self.vlan_index = vlan_index
@@ -66,9 +57,10 @@ class VppSRv6LocalSID(VppObject):
def add_vpp_config(self):
self._test.vapi.sr_localsid_add_del(
- self._localsid_addr,
+ self.localsid,
self.behavior,
- self._nh_addr,
+ self.nh_addr4,
+ self.nh_addr6,
is_del=0,
end_psp=self.end_psp,
sw_if_index=self.sw_if_index,
@@ -78,9 +70,10 @@ class VppSRv6LocalSID(VppObject):
def remove_vpp_config(self):
self._test.vapi.sr_localsid_add_del(
- self._localsid_addr,
+ self.localsid,
self.behavior,
- self._nh_addr,
+ self.nh_addr4,
+ self.nh_addr6,
is_del=1,
end_psp=self.end_psp,
sw_if_index=self.sw_if_index,
@@ -99,7 +92,7 @@ class VppSRv6LocalSID(VppObject):
def object_id(self):
return ("%d;%s,%d"
% (self.fib_table,
- self.localsid_addr,
+ self.localsid,
self.behavior))