aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_srv6.py45
-rw-r--r--test/vpp_papi_provider.py15
-rw-r--r--test/vpp_srv6.py35
3 files changed, 50 insertions, 45 deletions
diff --git a/test/test_srv6.py b/test/test_srv6.py
index b64d3bc8367..3e5f856316d 100644
--- a/test/test_srv6.py
+++ b/test/test_srv6.py
@@ -514,9 +514,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End without PSP behavior
localsid = VppSRv6LocalSID(
- self, localsid_addr='A3::0',
+ self, localsid={'addr': 'A3::0'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_END,
- nh_addr='::',
+ nh_addr4='0.0.0.0',
+ nh_addr6='::',
end_psp=0,
sw_if_index=0,
vlan_index=0,
@@ -585,9 +586,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End with PSP behavior
localsid = VppSRv6LocalSID(
- self, localsid_addr='A3::0',
+ self, localsid={'addr': 'A3::0'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_END,
- nh_addr='::',
+ nh_addr4='0.0.0.0',
+ nh_addr6='::',
end_psp=1,
sw_if_index=0,
vlan_index=0,
@@ -660,9 +662,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End.X without PSP behavior
# End.X points to interface pg1
localsid = VppSRv6LocalSID(
- self, localsid_addr='A3::C4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_X,
- nh_addr=self.pg1.remote_ip6,
+ nh_addr4='0.0.0.0',
+ nh_addr6=self.pg1.remote_ip6,
end_psp=0,
sw_if_index=self.pg1.sw_if_index,
vlan_index=0,
@@ -737,9 +740,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End with PSP behavior
localsid = VppSRv6LocalSID(
- self, localsid_addr='A3::C4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_X,
- nh_addr=self.pg1.remote_ip6,
+ nh_addr4='0.0.0.0',
+ nh_addr6=self.pg1.remote_ip6,
end_psp=1,
sw_if_index=self.pg1.sw_if_index,
vlan_index=0,
@@ -802,9 +806,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End.DX6 behavior
localsid = VppSRv6LocalSID(
- self, localsid_addr='a3::c4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_DX6,
- nh_addr=self.pg1.remote_ip6,
+ nh_addr4='0.0.0.0',
+ nh_addr6=self.pg1.remote_ip6,
end_psp=0,
sw_if_index=self.pg1.sw_if_index,
vlan_index=0,
@@ -890,9 +895,10 @@ class TestSRv6(VppTestCase):
# fib_table: where the localsid is installed
# sw_if_index: in T-variants of localsid this is the vrf table_id
localsid = VppSRv6LocalSID(
- self, localsid_addr='a3::c4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_DT6,
- nh_addr='::',
+ nh_addr4='0.0.0.0',
+ nh_addr6='::',
end_psp=0,
sw_if_index=vrf_1,
vlan_index=0,
@@ -955,9 +961,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End.DX4 behavior
localsid = VppSRv6LocalSID(
- self, localsid_addr='a3::c4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_DX4,
- nh_addr=self.pg1.remote_ip4,
+ nh_addr4=self.pg1.remote_ip4,
+ nh_addr6='::',
end_psp=0,
sw_if_index=self.pg1.sw_if_index,
vlan_index=0,
@@ -1043,9 +1050,10 @@ class TestSRv6(VppTestCase):
# fib_table: where the localsid is installed
# sw_if_index: in T-variants of localsid: vrf table_id
localsid = VppSRv6LocalSID(
- self, localsid_addr='a3::c4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_DT4,
- nh_addr='::',
+ nh_addr4='0.0.0.0',
+ nh_addr6='::',
end_psp=0,
sw_if_index=vrf_1,
vlan_index=0,
@@ -1107,9 +1115,10 @@ class TestSRv6(VppTestCase):
# configure SRv6 localSID End.DX2 behavior
localsid = VppSRv6LocalSID(
- self, localsid_addr='a3::c4',
+ self, localsid={'addr': 'A3::C4'},
behavior=SRv6LocalSIDBehaviors.SR_BEHAVIOR_DX2,
- nh_addr='::',
+ nh_addr4='0.0.0.0',
+ nh_addr6='::',
end_psp=0,
sw_if_index=self.pg1.sw_if_index,
vlan_index=0,
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 34010125e3a..b0b452e8c9c 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -2667,9 +2667,10 @@ class VppPapiProvider(object):
'client_mac': client_mac})
def sr_localsid_add_del(self,
- localsid_addr,
+ localsid,
behavior,
- nh_addr,
+ nh_addr4,
+ nh_addr6,
is_del=0,
end_psp=0,
sw_if_index=0xFFFFFFFF,
@@ -2678,10 +2679,11 @@ class VppPapiProvider(object):
):
""" Add/del IPv6 SR local-SID.
- :param localsid_addr:
+ :param localsid:
:param behavior: END=1; END.X=2; END.DX2=4; END.DX6=5;
:param behavior: END.DX4=6; END.DT6=7; END.DT4=8
- :param nh_addr:
+ :param nh_addr4:
+ :param nh_addr6:
:param is_del: (Default value = 0)
:param end_psp: (Default value = 0)
:param sw_if_index: (Default value = 0xFFFFFFFF)
@@ -2691,13 +2693,14 @@ class VppPapiProvider(object):
return self.api(
self.papi.sr_localsid_add_del,
{'is_del': is_del,
- 'localsid_addr': localsid_addr,
+ 'localsid': localsid,
'end_psp': end_psp,
'behavior': behavior,
'sw_if_index': sw_if_index,
'vlan_index': vlan_index,
'fib_table': fib_table,
- 'nh_addr': nh_addr
+ 'nh_addr4': nh_addr4,
+ 'nh_addr6': nh_addr6
}
)
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))