summaryrefslogtreecommitdiffstats
path: root/test/test_punt.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-02-20 09:45:16 +0000
committerNeale Ranns <nranns@cisco.com>2020-02-25 10:48:52 +0000
commit8d6d74cdf43d7560eab3cf609cab27e5deb816e0 (patch)
treefe3d7328edbb9b8e6d7d8e3b0cea7fd7307d78e5 /test/test_punt.py
parent719ef39d988182d1297dc9c3f06b7bbda3043d47 (diff)
vlib: Punt reason allocation listener enable/disable callback
Type: improvement allow clients that allocate punt reasons to pass a callback function that is invoked when the first/last client registers to use/listen on that punt reason. This allows the client to perform some necessary configs that might not otherwise be enabled. IPSec uses this callback to register the ESP proto and UDP handling nodes, that would not otherwise be enabled unless a tunnel was present. Change-Id: I9759349903f21ffeeb253d4271e619e6bf46054b Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/test_punt.py')
-rw-r--r--test/test_punt.py60
1 files changed, 36 insertions, 24 deletions
diff --git a/test/test_punt.py b/test/test_punt.py
index 9627e542c2c..8ebf44767f3 100644
--- a/test/test_punt.py
+++ b/test/test_punt.py
@@ -794,30 +794,6 @@ class TestExceptionPuntSocket(TestPuntSocket):
}
#
- # we need an IPSec tunnels for this to work otherwise ESP gets dropped
- # due to unknown IP proto
- #
- VppIpsecTunInterface(self, self.pg0, 1000, 1000,
- (VppEnum.vl_api_ipsec_crypto_alg_t.
- IPSEC_API_CRYPTO_ALG_AES_CBC_128),
- b"0123456701234567",
- b"0123456701234567",
- (VppEnum.vl_api_ipsec_integ_alg_t.
- IPSEC_API_INTEG_ALG_SHA1_96),
- b"0123456701234567",
- b"0123456701234567").add_vpp_config()
- VppIpsecTunInterface(self, self.pg1, 1000, 1000,
- (VppEnum.vl_api_ipsec_crypto_alg_t.
- IPSEC_API_CRYPTO_ALG_AES_CBC_128),
- b"0123456701234567",
- b"0123456701234567",
- (VppEnum.vl_api_ipsec_integ_alg_t.
- IPSEC_API_INTEG_ALG_SHA1_96),
- b"0123456701234567",
- b"0123456701234567",
- udp_encap=True).add_vpp_config()
-
- #
# we're dealing with IPSec tunnels punting for no-such-tunnel
# adn SPI=0
#
@@ -880,6 +856,42 @@ class TestExceptionPuntSocket(TestPuntSocket):
cfg['spi'], cfg['udp'])
#
+ # add some tunnels, make sure it still punts
+ #
+ VppIpsecTunInterface(self, self.pg0, 1000, 1000,
+ (VppEnum.vl_api_ipsec_crypto_alg_t.
+ IPSEC_API_CRYPTO_ALG_AES_CBC_128),
+ b"0123456701234567",
+ b"0123456701234567",
+ (VppEnum.vl_api_ipsec_integ_alg_t.
+ IPSEC_API_INTEG_ALG_SHA1_96),
+ b"0123456701234567",
+ b"0123456701234567").add_vpp_config()
+ VppIpsecTunInterface(self, self.pg1, 1000, 1000,
+ (VppEnum.vl_api_ipsec_crypto_alg_t.
+ IPSEC_API_CRYPTO_ALG_AES_CBC_128),
+ b"0123456701234567",
+ b"0123456701234567",
+ (VppEnum.vl_api_ipsec_integ_alg_t.
+ IPSEC_API_INTEG_ALG_SHA1_96),
+ b"0123456701234567",
+ b"0123456701234567",
+ udp_encap=True).add_vpp_config()
+
+ #
+ # send packets for each SPI we expect to be punted
+ #
+ for cfg in cfgs.values():
+ self.send_and_assert_no_replies(cfg['itf'], cfg['pkts'])
+
+ #
+ # verify the punted packets arrived on the associated socket
+ #
+ for cfg in cfgs.values():
+ rx = cfg['sock'].close()
+ self.verify_esp_pkts(rx, len(cfg['pkts']),
+ cfg['spi'], cfg['udp'])
+ #
# socket deregister
#
for cfg in cfgs.values():