blob: 58a68290c60285c3af3beb81a764908d72614a39 [file] [log] [blame]
Neale Ranns177bbdc2016-11-15 09:46:51 +00001
2from vpp_interface import VppInterface
3import socket
4
5
6class VppGreInterface(VppInterface):
7 """
8 VPP GRE interface
9 """
10
11 def __init__(self, test, src_ip, dst_ip, outer_fib_id=0, is_teb=0):
12 """ Create VPP loopback interface """
Neale Ranns39f99732016-11-28 16:10:59 +000013 self._sw_if_index = 0
14 super(VppGreInterface, self).__init__(test)
Neale Ranns177bbdc2016-11-15 09:46:51 +000015 self._test = test
16 self.t_src = src_ip
17 self.t_dst = dst_ip
18 self.t_outer_fib = outer_fib_id
19 self.t_is_teb = is_teb
20
21 def add_vpp_config(self):
22 s = socket.inet_pton(socket.AF_INET, self.t_src)
23 d = socket.inet_pton(socket.AF_INET, self.t_dst)
24 r = self.test.vapi.gre_tunnel_add_del(s, d,
25 outer_fib_id=self.t_outer_fib,
26 is_teb=self.t_is_teb)
27 self._sw_if_index = r.sw_if_index
Neale Ranns39f99732016-11-28 16:10:59 +000028 self.generate_remote_hosts()
Neale Ranns177bbdc2016-11-15 09:46:51 +000029
30 def remove_vpp_config(self):
31 s = socket.inet_pton(socket.AF_INET, self.t_src)
32 d = socket.inet_pton(socket.AF_INET, self.t_dst)
33 self.unconfig()
34 r = self.test.vapi.gre_tunnel_add_del(s, d,
35 outer_fib_id=self.t_outer_fib,
36 is_add=0)