Skip to content

Commit 2b2c8fa

Browse files
authored
Merge pull request #2471 from anarkiwi/master
Add mirroring to global router test.
2 parents a76295f + 25d355e commit 2b2c8fa

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

tests/integration/mininet_tests.py

+25-15
Original file line numberDiff line numberDiff line change
@@ -4479,6 +4479,8 @@ def ip(self, args):
44794479
vip: 128
44804480
flood: 384
44814481
interfaces:
4482+
%s:
4483+
mirror: %s
44824484
%s:
44834485
native_vlan: 99
44844486
tagged_vlans: [%s]
@@ -4489,10 +4491,12 @@ def ip(self, args):
44894491
tagged_vlans: [%s]
44904492
hairpin_unicast: True
44914493
description: "b2"
4492-
""" % (global_vid(), '%(port_1)d', ','.join(STR_VIDS), '%(port_2)d', ','.join(STR_VIDS))
4494+
""" % (global_vid(), '%(port_3)d', '%(port_1)d', '%(port_1)d',
4495+
','.join(STR_VIDS), '%(port_2)d', ','.join(STR_VIDS))
44934496

44944497
def test_tagged(self):
4495-
hosts = self.net.hosts[:2]
4498+
first_host, second_host, mirror_host = self.net.hosts[:3]
4499+
hosts = (first_host, second_host)
44964500
required_ipds = set()
44974501
for i, host in enumerate(hosts, start=1):
44984502
setup_commands = []
@@ -4545,31 +4549,30 @@ def test_tagged(self):
45454549
self.assertFalse(required_ipds)
45464550

45474551
# verify routing performance
4548-
host, other_host = hosts
4549-
for host_ip, other_ip in (
4552+
for first_host_ip, second_host_ip in (
45504553
(self.netbase(self.NEW_VIDS[0], 1), self.netbase(self.NEW_VIDS[0], 2)),
45514554
(self.netbase(self.NEW_VIDS[0], 1), self.netbase(self.NEW_VIDS[-1], 2)),
45524555
(self.netbase(self.NEW_VIDS[-1], 1), self.netbase(self.NEW_VIDS[0], 2))):
45534556
self.verify_iperf_min(
4554-
((host, self.port_map['port_1']),
4555-
(other_host, self.port_map['port_2'])),
4556-
1, host_ip.ip, other_ip.ip)
4557+
((first_host, self.port_map['port_1']),
4558+
(second_host, self.port_map['port_2'])),
4559+
1, first_host_ip.ip, second_host_ip.ip)
45574560

45584561
# verify L3 reachability between hosts within each subnet
45594562
for vid in self.NEW_VIDS:
45604563
macvlan_int = 'macvlan%u' % vid
4561-
host_ip = self.netbase(vid, 1)
4562-
other_ip = self.netbase(vid, 2)
4563-
self.ping(host, other_ip.ip, macvlan_int)
4564-
self.ping(other_host, host_ip.ip, macvlan_int)
4564+
first_host_ip = self.netbase(vid, 1)
4565+
second_host_ip = self.netbase(vid, 2)
4566+
self.ping(first_host, second_host_ip.ip, macvlan_int)
4567+
self.ping(second_host, first_host_ip.ip, macvlan_int)
45654568

45664569
# verify L3 hairpin reachability
45674570
macvlan1_int = 'macvlan%u' % self.NEW_VIDS[0]
45684571
macvlan2_int = 'macvlan%u' % self.NEW_VIDS[1]
45694572
macvlan2_ip = self.netbase(self.NEW_VIDS[1], 1)
45704573
macvlan1_gw = self.netbase(self.NEW_VIDS[0], 254)
45714574
macvlan2_gw = self.netbase(self.NEW_VIDS[1], 254)
4572-
netns = self.hostns(host)
4575+
netns = self.hostns(first_host)
45734576
setup_cmds = []
45744577
setup_cmds.extend(
45754578
[self.ip('link set %s netns %s' % (macvlan2_int, netns))])
@@ -4580,8 +4583,12 @@ def test_tagged(self):
45804583
setup_cmds.append('ip netns exec %s %s' % (netns, exec_cmd))
45814584
setup_cmds.append(
45824585
self.ip('route add %s via %s' % (macvlan2_ip, macvlan1_gw.ip)))
4583-
self.quiet_commands(host, setup_cmds)
4584-
self.ping(host, macvlan2_ip.ip, macvlan1_int)
4586+
self.quiet_commands(first_host, setup_cmds)
4587+
self.ping(first_host, macvlan2_ip.ip, macvlan1_int)
4588+
4589+
# Verify mirror.
4590+
self.verify_ping_mirrored(first_host, second_host, mirror_host)
4591+
self.verify_bcast_ping_mirrored(first_host, second_host, mirror_host)
45854592

45864593

45874594
class FaucetTaggedGlobalIPv6RouteTest(FaucetTaggedGlobalIPv4RouteTest):
@@ -4638,6 +4645,8 @@ def ip(self, args):
46384645
vip: 128
46394646
flood: 384
46404647
interfaces:
4648+
%s:
4649+
mirror: %s
46414650
%s:
46424651
native_vlan: 99
46434652
tagged_vlans: [%s]
@@ -4648,7 +4657,8 @@ def ip(self, args):
46484657
tagged_vlans: [%s]
46494658
hairpin_unicast: True
46504659
description: "b2"
4651-
""" % (global_vid(), '%(port_1)d', ','.join(STR_VIDS), '%(port_2)d', ','.join(STR_VIDS))
4660+
""" % (global_vid(), '%(port_3)d', '%(port_1)d', '%(port_1)d',
4661+
','.join(STR_VIDS), '%(port_2)d', ','.join(STR_VIDS))
46524662

46534663

46544664

0 commit comments

Comments
 (0)