2 from vpp_interface import VppInterface
4 from vpp_papi import VppEnum
7 class VppGreInterface(VppInterface):
12 def __init__(self, test, src_ip, dst_ip, outer_table_id=0,
13 type=None, mode=None, flags=0,
15 """ Create VPP GRE interface """
16 super(VppGreInterface, self).__init__(test)
19 self.t_outer_table = outer_table_id
20 self.t_session = session
24 self.t_type = (VppEnum.vl_api_gre_tunnel_type_t.
25 GRE_API_TUNNEL_TYPE_L3)
28 self.t_mode = (VppEnum.vl_api_tunnel_mode_t.
31 def add_vpp_config(self):
32 r = self.test.vapi.gre_tunnel_add_del(
37 'outer_table_id': self.t_outer_table,
38 'instance': 0xffffffff,
41 'flags': self.t_flags,
42 'session_id': self.t_session})
43 self.set_sw_if_index(r.sw_if_index)
44 self.generate_remote_hosts()
45 self.test.registry.register(self, self.test.logger)
48 def remove_vpp_config(self):
50 self.test.vapi.gre_tunnel_add_del(
55 'outer_table_id': self.t_outer_table,
56 'instance': 0xffffffff,
59 'flags': self.t_flags,
60 'session_id': self.t_session})
63 return "gre-%d" % self.sw_if_index
65 def query_vpp_config(self):
66 return (self.test.vapi.gre_tunnel_dump(
67 sw_if_index=self._sw_if_index))