#
# change the key and the SPI
#
- p.crypt_key = 'X' + p.crypt_key[1:]
+ p.crypt_key = b'X' + p.crypt_key[1:]
p.scapy_tun_spi += 1
p.scapy_tun_sa_id += 1
p.vpp_tun_spi += 1
IPSEC_API_INTEG_ALG_NONE),
'scapy-crypto': "AES-GCM",
'scapy-integ': "NULL",
- 'key': "JPjyOWBeVEQiMe7h",
+ 'key': b"JPjyOWBeVEQiMe7h",
'salt': 3333},
{'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
IPSEC_API_CRYPTO_ALG_AES_GCM_192),
IPSEC_API_INTEG_ALG_NONE),
'scapy-crypto': "AES-GCM",
'scapy-integ': "NULL",
- 'key': "JPjyOWBeVEQiMe7hJPjyOWBe",
+ 'key': b"JPjyOWBeVEQiMe7hJPjyOWBe",
'salt': 0},
{'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
IPSEC_API_CRYPTO_ALG_AES_GCM_256),
IPSEC_API_INTEG_ALG_NONE),
'scapy-crypto': "AES-GCM",
'scapy-integ': "NULL",
- 'key': "JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h",
+ 'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h",
'salt': 9999},
{'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
IPSEC_API_CRYPTO_ALG_AES_CBC_128),
'scapy-crypto': "AES-CBC",
'scapy-integ': "HMAC-SHA1-96",
'salt': 0,
- 'key': "JPjyOWBeVEQiMe7h"},
+ 'key': b"JPjyOWBeVEQiMe7h"},
{'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
IPSEC_API_CRYPTO_ALG_AES_CBC_192),
'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
'scapy-crypto': "AES-CBC",
'scapy-integ': "HMAC-SHA1-96",
'salt': 0,
- 'key': "JPjyOWBeVEQiMe7hJPjyOWBe"},
+ 'key': b"JPjyOWBeVEQiMe7hJPjyOWBe"},
{'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
IPSEC_API_CRYPTO_ALG_AES_CBC_256),
'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
'scapy-crypto': "AES-CBC",
'scapy-integ': "HMAC-SHA1-96",
'salt': 0,
- 'key': "JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"}]
+ 'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"},
+ {'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
+ IPSEC_API_CRYPTO_ALG_NONE),
+ 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
+ IPSEC_API_INTEG_ALG_SHA1_96),
+ 'scapy-crypto': "NULL",
+ 'scapy-integ': "HMAC-SHA1-96",
+ 'salt': 0,
+ 'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"}]
for engine in engines:
self.vapi.cli("set crypto handler all %s" % engine)
p.tun_if.add_vpp_config()
p.tun_if.admin_up()
p.tun_if.config_ip4()
+ p.tun_if.config_ip6()
p.route = VppIpRoute(self, p.remote_tun_if_host, 32,
[VppRoutePath(p.tun_if.remote_ip4,
0xffffffff)])
p.route.add_vpp_config()
+ r = VppIpRoute(self, p.remote_tun_if_host6, 128,
+ [VppRoutePath(p.tun_if.remote_ip6,
+ 0xffffffff,
+ proto=DpoProto.DPO_PROTO_IP6)])
+ r.add_vpp_config()
def unconfig_network(self, p):
p.route.remove_vpp_config()
c = p.tun_if.get_tx_stats()
self.assertEqual(c['packets'], 127)
+ self.vapi.cli("clear ipsec sa")
+ self.verify_tun_64(p, count=127)
+ c = p.tun_if.get_rx_stats()
+ self.assertEqual(c['packets'], 254)
+ c = p.tun_if.get_tx_stats()
+ self.assertEqual(c['packets'], 254)
+
# rekey - create new SAs and update the tunnel protection
np = copy.copy(p)
- np.crypt_key = 'X' + p.crypt_key[1:]
+ np.crypt_key = b'X' + p.crypt_key[1:]
np.scapy_tun_spi += 100
np.scapy_tun_sa_id += 1
np.vpp_tun_spi += 100
self.verify_tun_44(np, count=127)
c = p.tun_if.get_rx_stats()
- self.assertEqual(c['packets'], 254)
+ self.assertEqual(c['packets'], 381)
c = p.tun_if.get_tx_stats()
- self.assertEqual(c['packets'], 254)
+ self.assertEqual(c['packets'], 381)
# teardown
self.unconfig_protect(np)
# rekey - create new SAs and update the tunnel protection
np = copy.copy(p)
- np.crypt_key = 'X' + p.crypt_key[1:]
+ np.crypt_key = b'X' + p.crypt_key[1:]
np.scapy_tun_spi += 100
np.scapy_tun_sa_id += 1
np.vpp_tun_spi += 100
p.tun_if.add_vpp_config()
p.tun_if.admin_up()
p.tun_if.config_ip6()
+ p.tun_if.config_ip4()
p.route = VppIpRoute(self, p.remote_tun_if_host, 128,
[VppRoutePath(p.tun_if.remote_ip6,
0xffffffff,
proto=DpoProto.DPO_PROTO_IP6)])
p.route.add_vpp_config()
+ r = VppIpRoute(self, p.remote_tun_if_host4, 32,
+ [VppRoutePath(p.tun_if.remote_ip4,
+ 0xffffffff)])
+ r.add_vpp_config()
def unconfig_network(self, p):
p.route.remove_vpp_config()
# rekey - create new SAs and update the tunnel protection
np = copy.copy(p)
- np.crypt_key = 'X' + p.crypt_key[1:]
+ np.crypt_key = b'X' + p.crypt_key[1:]
np.scapy_tun_spi += 100
np.scapy_tun_sa_id += 1
np.vpp_tun_spi += 100
# 2) swap output SA to [new]
# 3) use only [new] input SA
np3 = copy.copy(np)
- np3.crypt_key = 'Z' + p.crypt_key[1:]
+ np3.crypt_key = b'Z' + p.crypt_key[1:]
np3.scapy_tun_spi += 100
np3.scapy_tun_sa_id += 1
np3.vpp_tun_spi += 100
self.unconfig_sa(np3)
self.unconfig_network(p)
+ def test_tun_46(self):
+ """IPSEC tunnel protect"""
+
+ p = self.ipv6_params
+
+ self.config_network(p)
+ self.config_sa_tra(p)
+ self.config_protect(p)
+
+ self.verify_tun_46(p, count=127)
+ c = p.tun_if.get_rx_stats()
+ self.assertEqual(c['packets'], 127)
+ c = p.tun_if.get_tx_stats()
+ self.assertEqual(c['packets'], 127)
+
+ # teardown
+ self.unconfig_protect(p)
+ self.unconfig_sa(p)
+ self.unconfig_network(p)
+
class TestIpsec6TunProtectTun(TemplateIpsec,
TemplateIpsec6TunProtect,
# rekey - create new SAs and update the tunnel protection
np = copy.copy(p)
- np.crypt_key = 'X' + p.crypt_key[1:]
+ np.crypt_key = b'X' + p.crypt_key[1:]
np.scapy_tun_spi += 100
np.scapy_tun_sa_id += 1
np.vpp_tun_spi += 100