Example #1
0
    def setUp(self):
        super(TemplateIpsec6TunIfEsp, self).setUp()

        self.tun_if = self.pg0

        p = self.ipv6_params
        tun_if = VppIpsecTunInterface(self,
                                      self.pg0,
                                      p.vpp_tun_spi,
                                      p.scapy_tun_spi,
                                      p.crypt_algo_vpp_id,
                                      p.crypt_key,
                                      p.crypt_key,
                                      p.auth_algo_vpp_id,
                                      p.auth_key,
                                      p.auth_key,
                                      is_ip6=True)
        tun_if.add_vpp_config()
        tun_if.admin_up()
        tun_if.config_ip6()
        tun_if.config_ip4()

        r = VppIpRoute(self, p.remote_tun_if_host, 128, [
            VppRoutePath(
                tun_if.remote_ip6, 0xffffffff, proto=DpoProto.DPO_PROTO_IP6)
        ])
        r.add_vpp_config()
        r = VppIpRoute(self, p.remote_tun_if_host4, 32,
                       [VppRoutePath(tun_if.remote_ip4, 0xffffffff)])
        r.add_vpp_config()
Example #2
0
class TemplateIpsecTunIfEsp(TemplateIpsec):
    """ IPsec tunnel interface tests """

    encryption_type = ESP

    @classmethod
    def setUpClass(cls):
        super(TemplateIpsecTunIfEsp, cls).setUpClass()
        cls.tun_if = cls.pg0

    def setUp(self):
        self.ipsec_tun_if = VppIpsecTunInterface(
            self, self.pg0, self.vpp_tun_spi, self.scapy_tun_spi,
            self.crypt_algo_vpp_id, self.crypt_key, self.crypt_key,
            self.auth_algo_vpp_id, self.auth_key, self.auth_key)
        self.ipsec_tun_if.add_vpp_config()
        self.ipsec_tun_if.admin_up()
        self.ipsec_tun_if.config_ip4()
        src4 = socket.inet_pton(socket.AF_INET, self.remote_tun_if_host)
        self.vapi.ip_add_del_route(src4, 32, self.ipsec_tun_if.remote_ip4n)

    def tearDown(self):
        if not self.vpp_dead:
            self.vapi.cli("show hardware")
        super(TemplateIpsecTunIfEsp, self).tearDown()
Example #3
0
 def setUp(self):
     p = self.ipv4_params
     tun_if = VppIpsecTunInterface(self, self.pg0, p.vpp_tun_spi,
                                   p.scapy_tun_spi, p.crypt_algo_vpp_id,
                                   p.crypt_key, p.crypt_key,
                                   p.auth_algo_vpp_id, p.auth_key,
                                   p.auth_key)
     tun_if.add_vpp_config()
     tun_if.admin_up()
     tun_if.config_ip4()
     src4 = socket.inet_pton(socket.AF_INET, p.remote_tun_if_host)
     self.vapi.ip_add_del_route(src4, 32, tun_if.remote_ip4n)
Example #4
0
    def setUp(self):
        super(TemplateIpsec4TunIfEsp, self).setUp()

        self.tun_if = self.pg0

        p = self.ipv4_params
        tun_if = VppIpsecTunInterface(self, self.pg0, p.vpp_tun_spi,
                                      p.scapy_tun_spi, p.crypt_algo_vpp_id,
                                      p.crypt_key, p.crypt_key,
                                      p.auth_algo_vpp_id, p.auth_key,
                                      p.auth_key)
        tun_if.add_vpp_config()
        tun_if.admin_up()
        tun_if.config_ip4()

        VppIpRoute(self,  p.remote_tun_if_host, 32,
                   [VppRoutePath(tun_if.remote_ip4,
                                 0xffffffff)]).add_vpp_config()
Example #5
0
    def setUp(self):
        super(TemplateIpsecTunIfEsp, self).setUp()

        self.tun_if = self.pg0

        p = self.ipv4_params
        tun_if = VppIpsecTunInterface(self, self.pg0, p.vpp_tun_spi,
                                      p.scapy_tun_spi, p.crypt_algo_vpp_id,
                                      p.crypt_key, p.crypt_key,
                                      p.auth_algo_vpp_id, p.auth_key,
                                      p.auth_key)
        tun_if.add_vpp_config()
        tun_if.admin_up()
        tun_if.config_ip4()

        VppIpRoute(
            self, p.remote_tun_if_host, 32,
            [VppRoutePath(tun_if.remote_ip4, 0xffffffff)]).add_vpp_config()
Example #6
0
    def setUp(self):
        super(TemplateIpsec6TunIfEsp, self).setUp()

        self.tun_if = self.pg0

        p = self.ipv6_params
        tun_if = VppIpsecTunInterface(self, self.pg0, p.vpp_tun_spi,
                                      p.scapy_tun_spi, p.crypt_algo_vpp_id,
                                      p.crypt_key, p.crypt_key,
                                      p.auth_algo_vpp_id, p.auth_key,
                                      p.auth_key, is_ip6=True)
        tun_if.add_vpp_config()
        tun_if.admin_up()
        tun_if.config_ip6()

        VppIpRoute(self,  p.remote_tun_if_host, 128,
                   [VppRoutePath(tun_if.remote_ip6,
                                 0xffffffff,
                                 proto=DpoProto.DPO_PROTO_IP6)],
                   is_ip6=1).add_vpp_config()