summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-08-02 17:57:08 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-09-19 18:15:43 +0000
commit6b9847e8012b3b186897f3b2bdeaf478f8767301 (patch)
tree3440ef521c56b09c305904ddcf378b3d0ab6b2a3 /src/plugins/gbp
parentda900b25c8fa47c70b4dcba7f2cb68716dcfad46 (diff)
gbp: add local l3out redirect to local SEP unit test
Type: test Change-Id: Ia6dad86d02f6f665a3e6960812b2527eaabb65f1 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/gbp')
-rw-r--r--src/plugins/gbp/test/test_gbp.py39
1 files changed, 36 insertions, 3 deletions
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