aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/vxlan
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/vxlan')
-rw-r--r--src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py40
1 files changed, 16 insertions, 24 deletions
diff --git a/src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py b/src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py
index 22555858d12..0898bd9f810 100644
--- a/src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py
+++ b/src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py
@@ -38,39 +38,31 @@ class VppVxlanGbpTunnel(VppInterface):
else:
self.mode = mode
+ def encode(self):
+ return {
+ 'src': self.src,
+ 'dst': self.dst,
+ 'mode': self.mode,
+ 'vni': self.vni,
+ 'mcast_sw_if_index': self.mcast_itf.sw_if_index
+ if self.mcast_itf else INDEX_INVALID,
+ 'encap_table_id': self.encap_table_id,
+ 'instance': self.instance,
+ }
+
def add_vpp_config(self):
- mcast_sw_if_index = INDEX_INVALID
- if (self.mcast_itf):
- mcast_sw_if_index = self.mcast_itf.sw_if_index
reply = self.test.vapi.vxlan_gbp_tunnel_add_del(
is_add=1,
- tunnel={
- 'src': self.src,
- 'dst': self.dst,
- 'mode': self.mode,
- 'vni': self.vni,
- 'mcast_sw_if_index': mcast_sw_if_index,
- 'encap_table_id': self.encap_table_id,
- 'instance': self.instance
- })
+ tunnel=self.encode(),
+ )
self.set_sw_if_index(reply.sw_if_index)
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
- mcast_sw_if_index = INDEX_INVALID
- if (self.mcast_itf):
- mcast_sw_if_index = self.mcast_itf.sw_if_index
self.test.vapi.vxlan_gbp_tunnel_add_del(
is_add=0,
- tunnel={
- 'src': self.src,
- 'dst': self.dst,
- 'mode': self.mode,
- 'vni': self.vni,
- 'mcast_sw_if_index': mcast_sw_if_index,
- 'encap_table_id': self.encap_table_id,
- 'instance': self.instance,
- })
+ tunnel=self.encode(),
+ )
def query_vpp_config(self):
return (INDEX_INVALID != find_vxlan_gbp_tunnel(self._test,