aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_gre_interface.py
blob: 1c71875f73a5f4b6b52b2e301e211b8a1000522b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from vpp_interface import VppInterface
import socket


class VppGreInterface(VppInterface):
    """
    VPP GRE interface
    """

    def __init__(self, test, src_ip, dst_ip, outer_fib_id=0, is_teb=0):
        """ Create VPP loopback interface """
        self._sw_if_index = 0
        super(VppGreInterface, self).__init__(test)
        self._test = test
        self.t_src = src_ip
        self.t_dst = dst_ip
        self.t_outer_fib = outer_fib_id
        self.t_is_teb = is_teb

    def add_vpp_config(self):
        s = socket.inet_pton(socket.AF_INET, self.t_src)
        d = socket.inet_pton(socket.AF_INET, self.t_dst)
        r = self.test.vapi.gre_tunnel_add_del(s, d,
                                              outer_fib_id=self.t_outer_fib,
                                              is_teb=self.t_is_teb)
        self._sw_if_index = r.sw_if_index
        self.generate_remote_hosts()

    def remove_vpp_config(self):
        s = socket.inet_pton(socket.AF_INET, self.t_src)
        d = socket.inet_pton(socket.AF_INET, self.t_dst)
        self.unconfig()
        r = self.test.vapi.gre_tunnel_add_del(s, d,
                                              outer_fib_id=self.t_outer_fib,
                                              is_add=0)


class VppGre6Interface(VppInterface):
    """
    VPP GRE IPv6 interface
    """

    def __init__(self, test, src_ip, dst_ip, outer_fib_id=0, is_teb=0):
        """ Create VPP loopback interface """
        self._sw_if_index = 0
        super(VppGre6Interface, self).__init__(test)
        self._test = test
        self.t_src = src_ip
        self.t_dst = dst_ip
        self.t_outer_fib = outer_fib_id
        self.t_is_teb = is_teb

    def add_vpp_config(self):
        s = socket.inet_pton(socket.AF_INET6, self.t_src)
        d = socket.inet_pton(socket.AF_INET6, self.t_dst)
        r = self.test.vapi.gre_tunnel_add_del(s, d,
                                              outer_fib_id=self.t_outer_fib,
                                              is_teb=self.t_is_teb,
                                              is_ip6=1)
        self._sw_if_index = r.sw_if_index
        self.generate_remote_hosts()

    def remove_vpp_config(self):
        s = socket.inet_pton(socket.AF_INET6, self.t_src)
        d = socket.inet_pton(socket.AF_INET6, self.t_dst)
        self.unconfig()
        r = self.test.vapi.gre_tunnel_add_del(s, d,
                                              outer_fib_id=self.t_outer_fib,
                                              is_add=0,
                                              is_ip6=1)
SP) ip_protocol (51, IPSEC_AH) ip_protocol (52, I_NLSP) ip_protocol (53, SWIPE) ip_protocol (54, NARP) ip_protocol (55, MOBILE) ip_protocol (56, TLSP) ip_protocol (57, SKIP) ip_protocol (58, ICMP6) ip_protocol (59, IP6_NONXT) ip_protocol (60, IP6_DESTINATION_OPTIONS) ip_protocol (62, CFTP) ip_protocol (64, SAT_EXPAK) ip_protocol (65, KRYPTOLAN) ip_protocol (66, RVD) ip_protocol (67, IPPC) ip_protocol (69, SAT_MON) ip_protocol (70, VISA) ip_protocol (71, IPCV) ip_protocol (72, CPNX) ip_protocol (73, CPHB) ip_protocol (74, WSN) ip_protocol (75, PVP) ip_protocol (76, BR_SAT_MON) ip_protocol (77, SUN_ND) ip_protocol (78, WB_MON) ip_protocol (79, WB_EXPAK) ip_protocol (80, ISO_IP) ip_protocol (81, VMTP) ip_protocol (82, SECURE_VMTP) ip_protocol (83, VINES) ip_protocol (84, TTP) ip_protocol (85, NSFNET_IGP) ip_protocol (86, DGP) ip_protocol (87, TCF) ip_protocol (88, EIGRP) ip_protocol (89, OSPF) ip_protocol (90, SPRITE_RPC) ip_protocol (91, LARP) ip_protocol (92, MTP) ip_protocol (93, AX) ip_protocol (94, IPIP) ip_protocol (95, MICP) ip_protocol (96, SCC_SP) ip_protocol (97, ETHERIP) ip_protocol (98, ENCAP) ip_protocol (100, GMTP) ip_protocol (101, IFMP) ip_protocol (102, PNNI) ip_protocol (103, PIM) ip_protocol (104, ARIS) ip_protocol (105, SCPS) ip_protocol (106, QNX) ip_protocol (107, A) ip_protocol (108, IPCOMP) ip_protocol (109, SNP) ip_protocol (110, COMPAQ_PEER) ip_protocol (111, IPX_IN_IP) ip_protocol (112, VRRP) ip_protocol (113, PGM) ip_protocol (115, L2TP) ip_protocol (116, DDX) ip_protocol (117, IATP) ip_protocol (118, STP) ip_protocol (119, SRP) ip_protocol (120, UTI) ip_protocol (121, SMP) ip_protocol (122, SM) ip_protocol (123, PTP) ip_protocol (124, ISIS) ip_protocol (125, FIRE) ip_protocol (126, CRTP) ip_protocol (127, CRUDP) ip_protocol (128, SSCOPMCE) ip_protocol (129, IPLT) ip_protocol (130, SPS) ip_protocol (131, PIPE) ip_protocol (132, SCTP) ip_protocol (133, FC) ip_protocol (134, RSVP_E2E_IGNORE) ip_protocol (135, MOBILITY) ip_protocol (136, UDP_LITE) ip_protocol (137, MPLS_IN_IP) /* * VPPs way of dealing with fragments is to mark them as 0xfe, to be picked * by the corresponding nodes based on this protocol */ ip_protocol (0xfe, VPP_FRAGMENTATION) ip_protocol (255, RESERVED)