X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=test%2Ftest_punt.py;h=0c5ec7efe1ffa55abe69391971af5a71b43b0807;hb=f0ca1e8d92114582ec9142bd15a40f1eb0102793;hp=c0c635079771cbef37acb090ebad07fe3d5bf8ce;hpb=12989b538881f9681f078cf1485c51df1251877a;p=vpp.git diff --git a/test/test_punt.py b/test/test_punt.py index c0c63507977..0c5ec7efe1f 100644 --- a/test/test_punt.py +++ b/test/test_punt.py @@ -793,41 +793,14 @@ 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 + # (SPI=0 goes to ikev2) # cfgs = dict() 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 @@ -835,6 +808,8 @@ class TestExceptionPuntSocket(TestPuntSocket): rs = self.vapi.punt_reason_dump() for key in cfgs: for r in rs: + print(r.reason.name) + print(key) if r.reason.name == key: cfgs[key]['id'] = r.reason.id cfgs[key]['vpp'] = copy.deepcopy( @@ -880,6 +855,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(): @@ -1057,7 +1068,6 @@ class TestPunt(VppTestCase): for i in self.pg_interfaces: i.unconfig_ip4() i.unconfig_ip6() - i.ip6_disable() i.admin_down() super(TestPunt, self).tearDown()