1 from vpp_interface import VppInterface
4 class VppMPLSTunnelInterface(VppInterface):
6 VPP MPLS Tunnel interface
9 def __init__(self, test, paths, is_multicast=0, is_l2=0):
10 """Create MPLS Tunnel interface"""
11 super(VppMPLSTunnelInterface, self).__init__(test)
13 self.is_multicast = is_multicast
15 self.encoded_paths = []
16 for path in self.t_paths:
17 self.encoded_paths.append(path.encode())
19 def add_vpp_config(self):
20 reply = self.test.vapi.mpls_tunnel_add_del(
23 is_multicast=self.is_multicast,
26 self.set_sw_if_index(reply.sw_if_index)
27 self.tunnel_index = reply.tunnel_index
28 self._test.registry.register(self, self._test.logger)
30 def remove_vpp_config(self):
31 reply = self.test.vapi.mpls_tunnel_add_del(
32 self.sw_if_index, self.encoded_paths, is_add=0
35 def query_vpp_config(self):
36 dump = self._test.vapi.mpls_tunnel_dump()
39 self.sw_if_index == t.mt_tunnel.mt_sw_if_index
40 and self.tunnel_index == t.mt_tunnel.mt_tunnel_index
46 return "mpls-tunnel%d-%d" % (self.tunnel_index, self.sw_if_index)