aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-09-06 09:50:26 -0700
committerJohn Lo <loj@cisco.com>2018-09-08 14:51:48 +0000
commit3b81a1e5f205482b8ea30edbfd39559c4368ac4d (patch)
tree345ff2e3d599502852512180e95f21c76ec31f48 /test
parent3348a4cf070b90a9c23bbc0b3752fa2801f832a9 (diff)
L2 BVI/FIB: Update L2 FIB table when BVI's MAC changes
also some moving of l2 headers to reduce dependencies Change-Id: I7a700a411a91451ef13fd65f9c90de2432b793bb Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_ip4_irb.py27
-rw-r--r--test/vpp_interface.py9
2 files changed, 27 insertions, 9 deletions
diff --git a/test/test_ip4_irb.py b/test/test_ip4_irb.py
index 460cb43b726..6aad60a7609 100644
--- a/test/test_ip4_irb.py
+++ b/test/test_ip4_irb.py
@@ -31,6 +31,7 @@ from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from framework import VppTestCase, VppTestRunner
+from util import mactobinary
class TestIpIrb(VppTestCase):
@@ -238,26 +239,36 @@ class TestIpIrb(VppTestCase):
self.assertListEqual(rcvd1.res, rcvd2.res)
- def test_ip4_irb_2(self):
- """ IPv4 IRB test 2
-
- Test scenario:
- - ip traffic from pg0 and pg1 ends on pg2
- """
-
+ def send_and_verify_l2_to_ip(self):
stream1 = self.create_stream_l2_to_ip(
self.pg0, self.loop0, self.pg2, self.pg_if_packet_sizes)
stream2 = self.create_stream_l2_to_ip(
self.pg1, self.loop0, self.pg2, self.pg_if_packet_sizes)
+ self.vapi.cli("clear trace")
self.pg0.add_stream(stream1)
self.pg1.add_stream(stream2)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
- rcvd = self.pg2.get_capture()
+ rcvd = self.pg2.get_capture(514)
self.verify_capture_l2_to_ip(self.pg2, self.loop0, rcvd)
+ def test_ip4_irb_2(self):
+ """ IPv4 IRB test 2
+
+ Test scenario:
+ - ip traffic from pg0 and pg1 ends on pg2
+ """
+ self.send_and_verify_l2_to_ip()
+
+ # change the BVI's mac and resed traffic
+ self.loop0.set_mac("00:00:00:11:11:33")
+
+ self.send_and_verify_l2_to_ip()
+ # check it wasn't flooded
+ self.pg1.assert_nothing_captured(remark="UU Flood")
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index e14a31eb722..1db34ba7958 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -1,7 +1,7 @@
from abc import abstractmethod, ABCMeta
import socket
-from util import Host, mk_ll_addr
+from util import Host, mk_ll_addr, mactobinary
class VppInterface(object):
@@ -170,6 +170,13 @@ class VppInterface(object):
self._hosts_by_ip4 = {}
self._hosts_by_ip6 = {}
+ def set_mac(self, mac):
+ self._local_mac = mac
+ self._local_ip6_ll = mk_ll_addr(mac)
+ self.test.vapi.sw_interface_set_mac_address(
+ self.sw_if_index,
+ mactobinary(self._local_mac))
+
def set_sw_if_index(self, sw_if_index):
self._sw_if_index = sw_if_index