aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-09-26 16:20:19 +0000
committerDamjan Marion <dmarion@me.com>2019-11-08 20:06:56 +0000
commit12989b538881f9681f078cf1485c51df1251877a (patch)
tree874156e3898e76fd5e966d3a87f0306dba8b742d /test
parentf1653e62fe41e3df429aadaaab22d0cc8aaa227a (diff)
ipsec: remove dedicated IPSec tunnels
APIs for dedicated IPSec tunnels will remain in this release and are used to programme the IPIP tunnel protect. APIs will be removed in a future release. see: https://wiki.fd.io/view/VPP/IPSec Type: feature Change-Id: I0f01f597946fdd15dfa5cae3643104d5a9c83089 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/template_ipsec.py17
-rw-r--r--test/test_ipsec_ah.py1
-rw-r--r--test/test_ipsec_esp.py3
-rw-r--r--test/test_ipsec_tun_if_esp.py146
-rw-r--r--test/test_punt.py20
-rw-r--r--test/vpp_gre_interface.py8
-rw-r--r--test/vpp_ipip_tun_interface.py8
-rw-r--r--test/vpp_ipsec_tun_interface.py5
-rw-r--r--test/vpp_papi_provider.py2
9 files changed, 131 insertions, 79 deletions
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index 2f1b2dcd3d0..a59a213506b 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -84,7 +84,7 @@ class IPsecIPv6Params(object):
self.nat_header = None
-def mk_scapy_crpyt_key(p):
+def mk_scapy_crypt_key(p):
if p.crypt_algo == "AES-GCM":
return p.crypt_key + struct.pack("!I", p.salt)
else:
@@ -95,7 +95,7 @@ def config_tun_params(p, encryption_type, tun_if):
ip_class_by_addr_type = {socket.AF_INET: IP, socket.AF_INET6: IPv6}
use_esn = bool(p.flags & (VppEnum.vl_api_ipsec_sad_flags_t.
IPSEC_API_SAD_FLAG_USE_ESN))
- crypt_key = mk_scapy_crpyt_key(p)
+ crypt_key = mk_scapy_crypt_key(p)
p.scapy_tun_sa = SecurityAssociation(
encryption_type, spi=p.vpp_tun_spi,
crypt_algo=p.crypt_algo,
@@ -121,7 +121,7 @@ def config_tun_params(p, encryption_type, tun_if):
def config_tra_params(p, encryption_type):
use_esn = bool(p.flags & (VppEnum.vl_api_ipsec_sad_flags_t.
IPSEC_API_SAD_FLAG_USE_ESN))
- crypt_key = mk_scapy_crpyt_key(p)
+ crypt_key = mk_scapy_crypt_key(p)
p.scapy_tra_sa = SecurityAssociation(
encryption_type,
spi=p.vpp_tra_spi,
@@ -250,7 +250,6 @@ class IpsecTcp(object):
def verify_tcp_checksum(self):
self.vapi.cli("test http server")
p = self.params[socket.AF_INET]
- config_tun_params(p, self.encryption_type, self.tun_if)
send = (Ether(src=self.tun_if.remote_mac, dst=self.tun_if.local_mac) /
p.scapy_tun_sa.encrypt(IP(src=p.remote_tun_if_host,
dst=self.tun_if.local_ip4) /
@@ -362,7 +361,7 @@ class IpsecTra4(object):
bogus_sa = SecurityAssociation(self.encryption_type,
p.vpp_tra_spi,
crypt_algo=p.crypt_algo,
- crypt_key=mk_scapy_crpyt_key(p)[::-1],
+ crypt_key=mk_scapy_crypt_key(p)[::-1],
auth_algo=p.auth_algo,
auth_key=p.auth_key[::-1])
pkt = (Ether(src=self.tra_if.remote_mac,
@@ -718,7 +717,6 @@ class IpsecTun4(object):
if not n_rx:
n_rx = count
try:
- config_tun_params(p, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts(p.scapy_tun_sa, self.tun_if,
src=p.remote_tun_if_host,
dst=self.pg1.remote_ip4,
@@ -745,7 +743,6 @@ class IpsecTun4(object):
sw_if_index=self.tun_if.sw_if_index, enable_ip4=True)
try:
- config_tun_params(p, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts(p.scapy_tun_sa, self.tun_if,
src=p.remote_tun_if_host,
dst=self.pg1.remote_ip4,
@@ -773,7 +770,6 @@ class IpsecTun4(object):
def verify_tun_64(self, p, count=1):
self.vapi.cli("clear errors")
try:
- config_tun_params(p, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts6(p.scapy_tun_sa, self.tun_if,
src=p.remote_tun_if_host6,
dst=self.pg1.remote_ip6,
@@ -887,7 +883,6 @@ class IpsecTun6(object):
self.vapi.cli("clear errors")
self.vapi.cli("clear ipsec sa")
- config_tun_params(p_in, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts6(p_in.scapy_tun_sa, self.tun_if,
src=p_in.remote_tun_if_host,
dst=self.pg1.remote_ip6,
@@ -901,8 +896,6 @@ class IpsecTun6(object):
if not p_out:
p_out = p_in
try:
- config_tun_params(p_in, self.encryption_type, self.tun_if)
- config_tun_params(p_out, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts6(p_in.scapy_tun_sa, self.tun_if,
src=p_in.remote_tun_if_host,
dst=self.pg1.remote_ip6,
@@ -929,7 +922,6 @@ class IpsecTun6(object):
sw_if_index=self.tun_if.sw_if_index, enable_ip6=True)
try:
- config_tun_params(p, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts6(p.scapy_tun_sa, self.tun_if,
src=p.remote_tun_if_host,
dst=self.pg1.remote_ip6,
@@ -958,7 +950,6 @@ class IpsecTun6(object):
""" ipsec 4o6 tunnel basic test """
self.vapi.cli("clear errors")
try:
- config_tun_params(p, self.encryption_type, self.tun_if)
send_pkts = self.gen_encrypt_pkts(p.scapy_tun_sa, self.tun_if,
src=p.remote_tun_if_host4,
dst=self.pg1.remote_ip4,
diff --git a/test/test_ipsec_ah.py b/test/test_ipsec_ah.py
index 94c7ffc634e..73577cd2197 100644
--- a/test/test_ipsec_ah.py
+++ b/test/test_ipsec_ah.py
@@ -88,6 +88,7 @@ class ConfigIpsecAH(TemplateIpsec):
config_tra_params(p, self.encryption_type)
for p in params:
self.config_ah_tun(p)
+ config_tun_params(p, self.encryption_type, self.tun_if)
for p in params:
d = DpoProto.DPO_PROTO_IP6 if p.is_ipv6 else DpoProto.DPO_PROTO_IP4
r = VppIpRoute(self, p.remote_tun_if_host, p.addr_len,
diff --git a/test/test_ipsec_esp.py b/test/test_ipsec_esp.py
index b72b7e1fe48..69b48ae8e13 100644
--- a/test/test_ipsec_esp.py
+++ b/test/test_ipsec_esp.py
@@ -7,7 +7,7 @@ from parameterized import parameterized
from framework import VppTestRunner
from template_ipsec import IpsecTra46Tests, IpsecTun46Tests, TemplateIpsec, \
IpsecTcpTests, IpsecTun4Tests, IpsecTra4Tests, config_tra_params, \
- IPsecIPv4Params, IPsecIPv6Params, \
+ config_tun_params, IPsecIPv4Params, IPsecIPv6Params, \
IpsecTra4, IpsecTun4, IpsecTra6, IpsecTun6
from vpp_ipsec import VppIpsecSpd, VppIpsecSpdEntry, VppIpsecSA,\
VppIpsecSpdItfBinding
@@ -71,6 +71,7 @@ class ConfigIpsecESP(TemplateIpsec):
config_tra_params(p, self.encryption_type)
for p in params:
self.config_esp_tun(p)
+ config_tun_params(p, self.encryption_type, self.tun_if)
for p in params:
d = DpoProto.DPO_PROTO_IP6 if p.is_ipv6 else DpoProto.DPO_PROTO_IP4
diff --git a/test/test_ipsec_tun_if_esp.py b/test/test_ipsec_tun_if_esp.py
index b61e0ef5a62..dee4af472c1 100644
--- a/test/test_ipsec_tun_if_esp.py
+++ b/test/test_ipsec_tun_if_esp.py
@@ -2,13 +2,13 @@ import unittest
import socket
import copy
-from scapy.layers.ipsec import ESP
+from scapy.layers.ipsec import SecurityAssociation, ESP
from scapy.layers.l2 import Ether, Raw, GRE
from scapy.layers.inet import IP, UDP
from scapy.layers.inet6 import IPv6
from framework import VppTestRunner
from template_ipsec import TemplateIpsec, IpsecTun4Tests, IpsecTun6Tests, \
- IpsecTun4, IpsecTun6, IpsecTcpTests, config_tun_params
+ IpsecTun4, IpsecTun6, IpsecTcpTests, mk_scapy_crypt_key
from vpp_ipsec_tun_interface import VppIpsecTunInterface
from vpp_gre_interface import VppGreInterface
from vpp_ipip_tun_interface import VppIpIpTunInterface
@@ -19,6 +19,33 @@ from util import ppp
from vpp_papi import VppEnum
+def config_tun_params(p, encryption_type, tun_if):
+ ip_class_by_addr_type = {socket.AF_INET: IP, socket.AF_INET6: IPv6}
+ use_esn = bool(p.flags & (VppEnum.vl_api_ipsec_sad_flags_t.
+ IPSEC_API_SAD_FLAG_USE_ESN))
+ crypt_key = mk_scapy_crypt_key(p)
+ p.scapy_tun_sa = SecurityAssociation(
+ encryption_type, spi=p.vpp_tun_spi,
+ crypt_algo=p.crypt_algo,
+ crypt_key=crypt_key,
+ auth_algo=p.auth_algo, auth_key=p.auth_key,
+ tunnel_header=ip_class_by_addr_type[p.addr_type](
+ src=tun_if.remote_ip,
+ dst=tun_if.local_ip),
+ nat_t_header=p.nat_header,
+ use_esn=use_esn)
+ p.vpp_tun_sa = SecurityAssociation(
+ encryption_type, spi=p.scapy_tun_spi,
+ crypt_algo=p.crypt_algo,
+ crypt_key=crypt_key,
+ auth_algo=p.auth_algo, auth_key=p.auth_key,
+ tunnel_header=ip_class_by_addr_type[p.addr_type](
+ dst=tun_if.remote_ip,
+ src=tun_if.local_ip),
+ nat_t_header=p.nat_header,
+ use_esn=use_esn)
+
+
class TemplateIpsec4TunIfEsp(TemplateIpsec):
""" IPsec tunnel interface tests """
@@ -48,6 +75,7 @@ class TemplateIpsec4TunIfEsp(TemplateIpsec):
p.tun_if.admin_up()
p.tun_if.config_ip4()
p.tun_if.config_ip6()
+ config_tun_params(p, self.encryption_type, p.tun_if)
r = VppIpRoute(self, p.remote_tun_if_host, 32,
[VppRoutePath(p.tun_if.remote_ip4,
@@ -67,7 +95,7 @@ class TemplateIpsec4TunIfEspUdp(TemplateIpsec):
""" IPsec UDP tunnel interface tests """
tun4_encrypt_node_name = "esp4-encrypt-tun"
- tun4_decrypt_node_name = "esp4-decrypt"
+ tun4_decrypt_node_name = "esp4-decrypt-tun"
encryption_type = ESP
@classmethod
@@ -97,6 +125,7 @@ class TemplateIpsec4TunIfEspUdp(TemplateIpsec):
p.tun_if.admin_up()
p.tun_if.config_ip4()
p.tun_if.config_ip6()
+ config_tun_params(p, self.encryption_type, p.tun_if)
r = VppIpRoute(self, p.remote_tun_if_host, 32,
[VppRoutePath(p.tun_if.remote_ip4,
@@ -115,17 +144,17 @@ class TemplateIpsec4TunIfEspUdp(TemplateIpsec):
class TestIpsec4TunIfEsp1(TemplateIpsec4TunIfEsp, IpsecTun4Tests):
""" Ipsec ESP - TUN tests """
tun4_encrypt_node_name = "esp4-encrypt-tun"
- tun4_decrypt_node_name = "esp4-decrypt"
+ tun4_decrypt_node_name = "esp4-decrypt-tun"
def test_tun_basic64(self):
""" ipsec 6o4 tunnel basic test """
- self.tun4_encrypt_node_name = "esp6-encrypt-tun"
+ self.tun4_encrypt_node_name = "esp4-encrypt-tun"
self.verify_tun_64(self.params[socket.AF_INET], count=1)
def test_tun_burst64(self):
""" ipsec 6o4 tunnel basic test """
- self.tun4_encrypt_node_name = "esp6-encrypt-tun"
+ self.tun4_encrypt_node_name = "esp4-encrypt-tun"
self.verify_tun_64(self.params[socket.AF_INET], count=257)
@@ -146,7 +175,7 @@ class TestIpsec4TunIfEsp1(TemplateIpsec4TunIfEsp, IpsecTun4Tests):
class TestIpsec4TunIfEspUdp(TemplateIpsec4TunIfEspUdp, IpsecTun4Tests):
""" Ipsec ESP UDP tests """
- tun4_input_node = "ipsec4-if-input"
+ tun4_input_node = "ipsec4-tun-input"
def test_keepalive(self):
""" IPSEC NAT Keepalive """
@@ -169,23 +198,24 @@ class TemplateIpsec6TunIfEsp(TemplateIpsec):
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()
+ p.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)
+ p.tun_if.add_vpp_config()
+ p.tun_if.admin_up()
+ p.tun_if.config_ip6()
+ p.tun_if.config_ip4()
+ config_tun_params(p, self.encryption_type, p.tun_if)
r = VppIpRoute(self, p.remote_tun_if_host, 128,
- [VppRoutePath(tun_if.remote_ip6,
+ [VppRoutePath(p.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,
+ [VppRoutePath(p.tun_if.remote_ip4,
0xffffffff)])
r.add_vpp_config()
@@ -196,16 +226,16 @@ class TemplateIpsec6TunIfEsp(TemplateIpsec):
class TestIpsec6TunIfEsp1(TemplateIpsec6TunIfEsp, IpsecTun6Tests):
""" Ipsec ESP - TUN tests """
tun6_encrypt_node_name = "esp6-encrypt-tun"
- tun6_decrypt_node_name = "esp6-decrypt"
+ tun6_decrypt_node_name = "esp6-decrypt-tun"
def test_tun_basic46(self):
""" ipsec 4o6 tunnel basic test """
- self.tun6_encrypt_node_name = "esp4-encrypt-tun"
+ self.tun6_encrypt_node_name = "esp6-encrypt-tun"
self.verify_tun_46(self.params[socket.AF_INET6], count=1)
def test_tun_burst46(self):
""" ipsec 4o6 tunnel burst test """
- self.tun6_encrypt_node_name = "esp4-encrypt-tun"
+ self.tun6_encrypt_node_name = "esp6-encrypt-tun"
self.verify_tun_46(self.params[socket.AF_INET6], count=257)
@@ -214,7 +244,7 @@ class TestIpsec4MultiTunIfEsp(TemplateIpsec, IpsecTun4):
encryption_type = ESP
tun4_encrypt_node_name = "esp4-encrypt-tun"
- tun4_decrypt_node_name = "esp4-decrypt"
+ tun4_decrypt_node_name = "esp4-decrypt-tun"
def setUp(self):
super(TestIpsec4MultiTunIfEsp, self).setUp()
@@ -222,6 +252,8 @@ class TestIpsec4MultiTunIfEsp(TemplateIpsec, IpsecTun4):
self.tun_if = self.pg0
self.multi_params = []
+ self.pg0.generate_remote_hosts(10)
+ self.pg0.configure_ipv4_neighbors()
for ii in range(10):
p = copy.copy(self.ipv4_params)
@@ -237,18 +269,18 @@ class TestIpsec4MultiTunIfEsp(TemplateIpsec, IpsecTun4):
p.vpp_tra_sa_id = p.vpp_tra_sa_id + ii
p.vpp_tra_spi = p.vpp_tra_spi + ii
- config_tun_params(p, self.encryption_type, self.tun_if)
- self.multi_params.append(p)
-
p.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)
+ p.auth_key,
+ dst=self.pg0.remote_hosts[ii].ip4)
p.tun_if.add_vpp_config()
p.tun_if.admin_up()
p.tun_if.config_ip4()
+ config_tun_params(p, self.encryption_type, p.tun_if)
+ self.multi_params.append(p)
VppIpRoute(self, p.remote_tun_if_host, 32,
[VppRoutePath(p.tun_if.remote_ip4,
@@ -272,10 +304,9 @@ class TestIpsec4TunIfEspAll(TemplateIpsec, IpsecTun4):
encryption_type = ESP
tun4_encrypt_node_name = "esp4-encrypt-tun"
- tun4_decrypt_node_name = "esp4-decrypt"
+ tun4_decrypt_node_name = "esp4-decrypt-tun"
def config_network(self, p):
- config_tun_params(p, self.encryption_type, self.tun_if)
p.tun_if = VppIpsecTunInterface(self, self.pg0, p.vpp_tun_spi,
p.scapy_tun_spi,
@@ -287,6 +318,7 @@ class TestIpsec4TunIfEspAll(TemplateIpsec, IpsecTun4):
p.tun_if.add_vpp_config()
p.tun_if.admin_up()
p.tun_if.config_ip4()
+ config_tun_params(p, self.encryption_type, p.tun_if)
self.logger.info(self.vapi.cli("sh ipsec sa 0"))
self.logger.info(self.vapi.cli("sh ipsec sa 1"))
@@ -320,7 +352,7 @@ class TestIpsec4TunIfEspAll(TemplateIpsec, IpsecTun4):
p.tun_if.local_spi = p.vpp_tun_spi
p.tun_if.remote_spi = p.scapy_tun_spi
- config_tun_params(p, self.encryption_type, self.tun_if)
+ config_tun_params(p, self.encryption_type, p.tun_if)
p.tun_sa_in = VppIpsecSA(self,
p.scapy_tun_sa_id,
@@ -330,8 +362,6 @@ class TestIpsec4TunIfEspAll(TemplateIpsec, IpsecTun4):
p.crypt_algo_vpp_id,
p.crypt_key,
self.vpp_esp_protocol,
- self.tun_if.local_addr[p.addr_type],
- self.tun_if.remote_addr[p.addr_type],
flags=p.flags,
salt=p.salt)
p.tun_sa_out = VppIpsecSA(self,
@@ -342,8 +372,6 @@ class TestIpsec4TunIfEspAll(TemplateIpsec, IpsecTun4):
p.crypt_algo_vpp_id,
p.crypt_key,
self.vpp_esp_protocol,
- self.tun_if.remote_addr[p.addr_type],
- self.tun_if.local_addr[p.addr_type],
flags=p.flags,
salt=p.salt)
p.tun_sa_in.add_vpp_config()
@@ -462,7 +490,7 @@ class TestIpsec6MultiTunIfEsp(TemplateIpsec, IpsecTun6):
encryption_type = ESP
tun6_encrypt_node_name = "esp6-encrypt-tun"
- tun6_decrypt_node_name = "esp6-decrypt"
+ tun6_decrypt_node_name = "esp6-decrypt-tun"
def setUp(self):
super(TestIpsec6MultiTunIfEsp, self).setUp()
@@ -470,6 +498,8 @@ class TestIpsec6MultiTunIfEsp(TemplateIpsec, IpsecTun6):
self.tun_if = self.pg0
self.multi_params = []
+ self.pg0.generate_remote_hosts(10)
+ self.pg0.configure_ipv6_neighbors()
for ii in range(10):
p = copy.copy(self.ipv6_params)
@@ -485,18 +515,18 @@ class TestIpsec6MultiTunIfEsp(TemplateIpsec, IpsecTun6):
p.vpp_tra_sa_id = p.vpp_tra_sa_id + ii
p.vpp_tra_spi = p.vpp_tra_spi + ii
- config_tun_params(p, self.encryption_type, self.tun_if)
- self.multi_params.append(p)
-
p.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)
+ p.auth_key, is_ip6=True,
+ dst=self.pg0.remote_hosts[ii].ip6)
p.tun_if.add_vpp_config()
p.tun_if.admin_up()
p.tun_if.config_ip6()
+ config_tun_params(p, self.encryption_type, p.tun_if)
+ self.multi_params.append(p)
r = VppIpRoute(self, p.remote_tun_if_host, 128,
[VppRoutePath(p.tun_if.remote_ip6,
@@ -597,30 +627,32 @@ class TestIpsecGreTebIfEsp(TemplateIpsec,
self.pg0.local_ip4)
p.tun_sa_in.add_vpp_config()
- self.tun = VppGreInterface(self,
+ p.tun_if = VppGreInterface(self,
self.pg0.local_ip4,
self.pg0.remote_ip4,
type=(VppEnum.vl_api_gre_tunnel_type_t.
GRE_API_TUNNEL_TYPE_TEB))
- self.tun.add_vpp_config()
+ p.tun_if.add_vpp_config()
p.tun_protect = VppIpsecTunProtect(self,
- self.tun,
+ p.tun_if,
p.tun_sa_out,
[p.tun_sa_in])
p.tun_protect.add_vpp_config()
- self.tun.admin_up()
- self.tun.config_ip4()
+ p.tun_if.admin_up()
+ p.tun_if.config_ip4()
+ config_tun_params(p, self.encryption_type, p.tun_if)
- VppBridgeDomainPort(self, bd1, self.tun).add_vpp_config()
+ VppBridgeDomainPort(self, bd1, p.tun_if).add_vpp_config()
VppBridgeDomainPort(self, bd1, self.pg1).add_vpp_config()
self.vapi.cli("clear ipsec sa")
def tearDown(self):
- self.tun.unconfig_ip4()
+ p = self.ipv4_params
+ p.tun_if.unconfig_ip4()
super(TestIpsecGreTebIfEsp, self).tearDown()
@@ -702,26 +734,28 @@ class TestIpsecGreIfEsp(TemplateIpsec,
self.pg0.local_ip4)
p.tun_sa_in.add_vpp_config()
- self.tun = VppGreInterface(self,
+ p.tun_if = VppGreInterface(self,
self.pg0.local_ip4,
self.pg0.remote_ip4)
- self.tun.add_vpp_config()
+ p.tun_if.add_vpp_config()
p.tun_protect = VppIpsecTunProtect(self,
- self.tun,
+ p.tun_if,
p.tun_sa_out,
[p.tun_sa_in])
p.tun_protect.add_vpp_config()
- self.tun.admin_up()
- self.tun.config_ip4()
+ p.tun_if.admin_up()
+ p.tun_if.config_ip4()
+ config_tun_params(p, self.encryption_type, p.tun_if)
VppIpRoute(self, "1.1.1.2", 32,
- [VppRoutePath(self.tun.remote_ip4,
+ [VppRoutePath(p.tun_if.remote_ip4,
0xffffffff)]).add_vpp_config()
def tearDown(self):
- self.tun.unconfig_ip4()
+ p = self.ipv4_params
+ p.tun_if.unconfig_ip4()
super(TestIpsecGreIfEsp, self).tearDown()
@@ -734,7 +768,7 @@ class TemplateIpsec4TunProtect(object):
tun4_input_node = "ipsec4-tun-input"
def config_sa_tra(self, p):
- config_tun_params(p, self.encryption_type, self.tun_if)
+ config_tun_params(p, self.encryption_type, p.tun_if)
p.tun_sa_out = VppIpsecSA(self, p.scapy_tun_sa_id, p.scapy_tun_spi,
p.auth_algo_vpp_id, p.auth_key,
@@ -751,7 +785,7 @@ class TemplateIpsec4TunProtect(object):
p.tun_sa_in.add_vpp_config()
def config_sa_tun(self, p):
- config_tun_params(p, self.encryption_type, self.tun_if)
+ config_tun_params(p, self.encryption_type, p.tun_if)
p.tun_sa_out = VppIpsecSA(self, p.scapy_tun_sa_id, p.scapy_tun_spi,
p.auth_algo_vpp_id, p.auth_key,
@@ -1018,7 +1052,7 @@ class TemplateIpsec6TunProtect(object):
""" IPsec IPv6 Tunnel protect """
def config_sa_tra(self, p):
- config_tun_params(p, self.encryption_type, self.tun_if)
+ config_tun_params(p, self.encryption_type, p.tun_if)
p.tun_sa_out = VppIpsecSA(self, p.scapy_tun_sa_id, p.scapy_tun_spi,
p.auth_algo_vpp_id, p.auth_key,
@@ -1033,7 +1067,7 @@ class TemplateIpsec6TunProtect(object):
p.tun_sa_in.add_vpp_config()
def config_sa_tun(self, p):
- config_tun_params(p, self.encryption_type, self.tun_if)
+ config_tun_params(p, self.encryption_type, p.tun_if)
p.tun_sa_out = VppIpsecSA(self, p.scapy_tun_sa_id, p.scapy_tun_spi,
p.auth_algo_vpp_id, p.auth_key,
diff --git a/test/test_punt.py b/test/test_punt.py
index e9475296f69..c0c63507977 100644
--- a/test/test_punt.py
+++ b/test/test_punt.py
@@ -706,6 +706,7 @@ class TestExceptionPuntSocket(TestPuntSocket):
def setUp(self):
super(TestExceptionPuntSocket, self).setUp()
+ self.create_pg_interfaces(range(2))
for i in self.pg_interfaces:
i.config_ip4()
i.resolve_arp()
@@ -805,7 +806,7 @@ class TestExceptionPuntSocket(TestPuntSocket):
IPSEC_API_INTEG_ALG_SHA1_96),
b"0123456701234567",
b"0123456701234567").add_vpp_config()
- VppIpsecTunInterface(self, self.pg0, 1001, 1001,
+ VppIpsecTunInterface(self, self.pg1, 1000, 1000,
(VppEnum.vl_api_ipsec_crypto_alg_t.
IPSEC_API_CRYPTO_ALG_AES_CBC_128),
b"0123456701234567",
@@ -821,8 +822,12 @@ class TestExceptionPuntSocket(TestPuntSocket):
# adn SPI=0
#
cfgs = dict()
- cfgs['ipsec4-no-such-tunnel'] = {'spi': 99, 'udp': False}
- cfgs['ipsec4-spi-o-udp-0'] = {'spi': 0, 'udp': True}
+ cfgs['ipsec4-no-such-tunnel'] = {'spi': 99,
+ 'udp': False,
+ 'itf': self.pg0}
+ cfgs['ipsec4-spi-o-udp-0'] = {'spi': 0,
+ 'udp': True,
+ 'itf': self.pg1}
#
# find the VPP ID for these punt exception reasin
@@ -850,9 +855,10 @@ class TestExceptionPuntSocket(TestPuntSocket):
# create packet streams for 'no-such-tunnel' exception
#
for cfg in cfgs.values():
- pkt = (Ether(src=self.pg0.remote_mac,
- dst=self.pg0.local_mac) /
- IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4))
+ pkt = (Ether(src=cfg['itf'].remote_mac,
+ dst=cfg['itf'].local_mac) /
+ IP(src=cfg['itf'].remote_ip4,
+ dst=cfg['itf'].local_ip4))
if (cfg['udp']):
pkt = pkt / UDP(sport=666, dport=4500)
pkt = (pkt / ESP(spi=cfg['spi'], seq=3) /
@@ -863,7 +869,7 @@ class TestExceptionPuntSocket(TestPuntSocket):
# send packets for each SPI we expect to be punted
#
for cfg in cfgs.values():
- self.send_and_assert_no_replies(self.pg0, cfg['pkts'])
+ self.send_and_assert_no_replies(cfg['itf'], cfg['pkts'])
#
# verify the punted packets arrived on the associated socket
diff --git a/test/vpp_gre_interface.py b/test/vpp_gre_interface.py
index fca2c1f86c8..333fc0306ea 100644
--- a/test/vpp_gre_interface.py
+++ b/test/vpp_gre_interface.py
@@ -48,3 +48,11 @@ class VppGreInterface(VppInterface):
def query_vpp_config(self):
return (self.test.vapi.gre_tunnel_dump(
sw_if_index=self._sw_if_index))
+
+ @property
+ def remote_ip(self):
+ return self.t_dst
+
+ @property
+ def local_ip(self):
+ return self.t_src
diff --git a/test/vpp_ipip_tun_interface.py b/test/vpp_ipip_tun_interface.py
index 6e5ade6eb3d..3558523f61d 100644
--- a/test/vpp_ipip_tun_interface.py
+++ b/test/vpp_ipip_tun_interface.py
@@ -38,3 +38,11 @@ class VppIpIpTunInterface(VppTunnelInterface):
def object_id(self):
return "ipip-%d" % self._sw_if_index
+
+ @property
+ def remote_ip(self):
+ return self.dst
+
+ @property
+ def local_ip(self):
+ return self.src
diff --git a/test/vpp_ipsec_tun_interface.py b/test/vpp_ipsec_tun_interface.py
index c561a1fd11f..7f11b7ebb1a 100644
--- a/test/vpp_ipsec_tun_interface.py
+++ b/test/vpp_ipsec_tun_interface.py
@@ -10,7 +10,8 @@ class VppIpsecTunInterface(VppTunnelInterface):
remote_spi, crypto_alg, local_crypto_key, remote_crypto_key,
integ_alg, local_integ_key, remote_integ_key, salt=0,
udp_encap=False,
- is_ip6=False):
+ is_ip6=False,
+ dst=None):
super(VppIpsecTunInterface, self).__init__(test, parent_if)
self.local_spi = local_spi
self.remote_spi = remote_spi
@@ -27,6 +28,8 @@ class VppIpsecTunInterface(VppTunnelInterface):
else:
self.local_ip = self.parent_if.local_ip4
self.remote_ip = self.parent_if.remote_ip4
+ if dst:
+ self.remote_ip = dst
self.udp_encap = udp_encap
def add_vpp_config(self):
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 8da0811d770..cc7771e9c9e 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -1717,7 +1717,7 @@ class VppPapiProvider(object):
remote_crypto_key, integ_alg, local_integ_key,
remote_integ_key, is_add=1, esn=0, salt=0,
anti_replay=1, renumber=0,
- udp_encap=0, show_instance=0):
+ udp_encap=0, show_instance=0xffffffff):
return self.api(
self.papi.ipsec_tunnel_if_add_del,
{