From 6b9847e8012b3b186897f3b2bdeaf478f8767301 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Fri, 2 Aug 2019 17:57:08 +0200 Subject: gbp: add local l3out redirect to local SEP unit test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Type: test Change-Id: Ia6dad86d02f6f665a3e6960812b2527eaabb65f1 Signed-off-by: Benoît Ganne --- src/plugins/gbp/test/test_gbp.py | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'src/plugins/gbp/test/test_gbp.py') diff --git a/src/plugins/gbp/test/test_gbp.py b/src/plugins/gbp/test/test_gbp.py index 0b15eea78cb..2d7fa459440 100644 --- a/src/plugins/gbp/test/test_gbp.py +++ b/src/plugins/gbp/test/test_gbp.py @@ -3869,7 +3869,7 @@ class TestGBP(VppTestCase): self.assertEqual(rx[IPv6].dst, "2001:10::88") # - # redirect to programmed remote SEP in EPG 320 + # a programmed remote SEP in EPG 320 # # gbp vxlan tunnel for the remote SEP @@ -3891,7 +3891,7 @@ class TestGBP(VppTestCase): sep5.add_vpp_config() # - # redirect from local l3out to remote (known, then unknown) SEP + # local l3out redirect tests # # add local l3out @@ -3966,6 +3966,10 @@ class TestGBP(VppTestCase): VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT, sclass=4221).add_vpp_config() + # + # l3out redirect to remote (known, then unknown) SEP + # + # packets from 1 external subnet to the other p = [(Ether(src=eep1.mac, dst=self.router_mac) / Dot1Q(vlan=100) / @@ -4041,7 +4045,36 @@ class TestGBP(VppTestCase): self.assertEqual(rxip.dst, txip.dst) # - # redirect remote EP to remote SEP + # l3out redirect to local SEP + # + + # change the contract between l3out to redirect to local SEPs + # instead of remote SEP + VppGbpContract( + self, 402, 4220, 4221, acl_index, + [VppGbpContractRule( + VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT, + VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_DST_IP, + [VppGbpContractNextHop(sep1.vmac, sep1.epg.bd, + sep1.ip4, sep1.epg.rd)]), + VppGbpContractRule( + VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT, + VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_DST_IP, + [VppGbpContractNextHop(sep1.vmac, sep1.epg.bd, + sep1.ip6, sep1.epg.rd)])], + [ETH_P_IP, ETH_P_IPV6]).add_vpp_config() + + rxs = self.send_and_expect(self.pg0, p, sep1.itf) + for rx, tx in zip(rxs, p): + self.assertEqual(rx[Ether].src, routed_src_mac) + self.assertEqual(rx[Ether].dst, sep1.mac) + rxip = rx[Ether].payload + txip = tx[Ether].payload + self.assertEqual(rxip.src, txip.src) + self.assertEqual(rxip.dst, txip.dst) + + # + # redirect remote EP to remote (known then unknown) SEP # # remote SEP known again -- cgit 1.2.3-korg