From f5fa5ae2b021f946fbb8ec56e692459cd34bc7fb Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 26 Sep 2018 05:07:25 -0700 Subject: MPLS tunnel dump: use sw_if_index not tunnel_index Change-Id: I6c0d5aec6ee96a0d40358f0e09a0901b22265063 Signed-off-by: Neale Ranns --- test/test_mpls.py | 13 +++++++++++++ test/vpp_mpls_tunnel_interface.py | 7 +++++-- test/vpp_papi_provider.py | 5 +++-- 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_mpls.py b/test/test_mpls.py index 1a4dad18e30..2595b039760 100644 --- a/test/test_mpls.py +++ b/test/test_mpls.py @@ -950,6 +950,19 @@ class TestMPLS(VppTestCase): VppMplsLabel(46, ttl=47), VppMplsLabel(33, ttl=47)]) + def test_mpls_tunnel_many(self): + """ Multiple Tunnels """ + + for ii in range(10): + mpls_tun = VppMPLSTunnelInterface( + self, + [VppRoutePath(self.pg0.remote_ip4, + self.pg0.sw_if_index, + labels=[VppMplsLabel(44, ttl=32), + VppMplsLabel(46, MplsLspMode.UNIFORM)])]) + mpls_tun.add_vpp_config() + mpls_tun.admin_up() + def test_v4_exp_null(self): """ MPLS V4 Explicit NULL test """ diff --git a/test/vpp_mpls_tunnel_interface.py b/test/vpp_mpls_tunnel_interface.py index 3cbf856dfc5..a2ab1bf27cb 100644 --- a/test/vpp_mpls_tunnel_interface.py +++ b/test/vpp_mpls_tunnel_interface.py @@ -32,6 +32,7 @@ class VppMPLSTunnelInterface(VppInterface): is_multicast=self.is_multicast, l2_only=self.is_l2) sw_if_index = reply.sw_if_index + self.tunnel_index = reply.tunnel_index self.set_sw_if_index(sw_if_index) self._test.registry.register(self, self._test.logger) @@ -54,7 +55,8 @@ class VppMPLSTunnelInterface(VppInterface): def query_vpp_config(self): dump = self._test.vapi.mpls_tunnel_dump() for t in dump: - if self.sw_if_index == t.mt_sw_if_index: + if self.sw_if_index == t.mt_sw_if_index and \ + self.tunnel_index == t.mt_tunnel_index: return True return False @@ -62,4 +64,5 @@ class VppMPLSTunnelInterface(VppInterface): return self.object_id() def object_id(self): - return ("mpls-tunnel%d" % self.sw_if_index) + return ("mpls-tunnel%d-%d" % (self.tunnel_index, + self.sw_if_index)) diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index ee45a5fb4cd..b814da27b33 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -1361,8 +1361,9 @@ class VppPapiProvider(object): 'mt_next_hop_via_label': next_hop_via_label, 'mt_next_hop_out_label_stack': next_hop_out_label_stack}) - def mpls_tunnel_dump(self): - return self.api(self.papi.mpls_tunnel_dump, {}) + def mpls_tunnel_dump(self, sw_if_index=0xffffffff): + return self.api(self.papi.mpls_tunnel_dump, + {'sw_if_index': sw_if_index}) def nat44_interface_add_del_feature( self, -- cgit 1.2.3-korg