From dc22c839f09f45899b955484dc6488569b94862f Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Sun, 25 Apr 2021 21:50:38 -0400 Subject: tests: clean up gbp calls from vpp_papi_provider Move info from vpp_papi_provider to .api/vpp_objects Change-Id: Iaf46483fda2840dfec8d37e0b9262e1c9912be59 Type: test Signed-off-by: Paul Vinciguerra --- src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py | 40 ++++++++++++----------------- 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'src/vnet') 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, -- cgit 1.2.3-korg