summaryrefslogtreecommitdiffstats
path: root/test/test_gbp.py
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-07-31 14:15:57 +0200
committerNeale Ranns <nranns@cisco.com>2019-08-09 10:32:51 +0000
commitb85432497d964ccd58a7fc3348b25ecbf624ff14 (patch)
treedd00010bdd38085464b871fffefce29ef6455a8e /test/test_gbp.py
parent71dd9d5ff8f9f629d7d917cc2b3695a910640602 (diff)
gbp: add unknown remote EP redirect unit test
Type: test Change-Id: I1dfbeef08a4f112551450682fc4040820251485b Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'test/test_gbp.py')
-rw-r--r--test/test_gbp.py33
1 files changed, 27 insertions, 6 deletions
diff --git a/test/test_gbp.py b/test/test_gbp.py
index 0c9cdb415dd..c835fc1b7a2 100644
--- a/test/test_gbp.py
+++ b/test/test_gbp.py
@@ -3725,6 +3725,7 @@ class TestGBP(VppTestCase):
#
# learn a remote EP in EPG 221
+ # packets coming from unknown remote EPs will be leant & redirected
#
vx_tun_l3 = VppGbpVxlanTunnel(
self, 444, rd1.rd_id,
@@ -3735,13 +3736,19 @@ class TestGBP(VppTestCase):
c4 = VppGbpContract(
self, 402, epg_221.sclass, epg_220.sclass, acl_index,
[VppGbpContractRule(
- VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
+ VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SRC_IP,
- []),
+ [VppGbpContractNextHop(sep1.vmac, sep1.epg.bd,
+ sep1.ip4, sep1.epg.rd),
+ VppGbpContractNextHop(sep2.vmac, sep2.epg.bd,
+ sep2.ip4, sep2.epg.rd)]),
VppGbpContractRule(
- VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
+ VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SRC_IP,
- [])],
+ [VppGbpContractNextHop(sep3.vmac, sep3.epg.bd,
+ sep3.ip6, sep3.epg.rd),
+ VppGbpContractNextHop(sep4.vmac, sep4.epg.bd,
+ sep4.ip6, sep4.epg.rd)])],
[ETH_P_IP, ETH_P_IPV6])
c4.add_vpp_config()
@@ -3756,7 +3763,14 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- rx = self.send_and_expect(self.pg7, [p], self.pg0)
+ # unknown remote EP to local EP redirected
+ rxs = self.send_and_expect(self.pg7, [p], sep1.itf)
+
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, routed_src_mac)
+ self.assertEqual(rx[Ether].dst, sep1.mac)
+ self.assertEqual(rx[IP].src, "10.0.0.88")
+ self.assertEqual(rx[IP].dst, ep1.ip4.address)
# endpoint learnt via the parent GBP-vxlan interface
self.assertTrue(find_gbp_endpoint(self,
@@ -3774,7 +3788,14 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- rx = self.send_and_expect(self.pg7, [p], self.pg0)
+ # unknown remote EP to local EP redirected (ipv6)
+ rxs = self.send_and_expect(self.pg7, [p], sep3.itf)
+
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, routed_src_mac)
+ self.assertEqual(rx[Ether].dst, sep3.mac)
+ self.assertEqual(rx[IPv6].src, "2001:10::88")
+ self.assertEqual(rx[IPv6].dst, ep1.ip6.address)
# endpoint learnt via the parent GBP-vxlan interface
self.assertTrue(find_gbp_endpoint(self,