@@ -4534,14 +4534,42 @@ def test_tagged(self):
4534
4534
self .wait_nonzero_packet_count_flow (
4535
4535
{'dl_type' : 0x0800 , 'nw_dst' : str (ip )}, table_id = self ._IPV4_FIB_TABLE )
4536
4536
4537
- # verify reachability between hosts within each subnet
4537
+ # verify L3 reachability between hosts within each subnet
4538
4538
for vid in self .NEW_VIDS :
4539
4539
macvlan_int = 'macvlan%u' % vid
4540
4540
host_ip = '192.168.%u.%u' % (vid , 1 )
4541
4541
other_ip = '192.168.%u.%u' % (vid , 2 )
4542
4542
self .one_ipv4_ping (host , other_ip , intf = macvlan_int )
4543
4543
self .one_ipv4_ping (other_host , host_ip , intf = macvlan_int )
4544
4544
4545
+ # verify L3 hairpin reachability
4546
+ macvlan1_int = 'macvlan%u' % self .NEW_VIDS [0 ]
4547
+ macvlan2_int = 'macvlan%u' % self .NEW_VIDS [1 ]
4548
+ macvlan1_ip = '192.168.%u.1' % self .NEW_VIDS [0 ]
4549
+ macvlan2_ip = '192.168.%u.1' % self .NEW_VIDS [1 ]
4550
+ macvlan1_gw = '192.168.%u.254' % self .NEW_VIDS [0 ]
4551
+ macvlan2_gw = '192.168.%u.254' % self .NEW_VIDS [1 ]
4552
+ macvlan2_mac = self .get_mac_of_intf (host , macvlan2_int )
4553
+ netns = host .name
4554
+ setup_cmds = []
4555
+ if self .get_netns_list (host ):
4556
+ setup_cmds .append ('ip netns del %s' % netns )
4557
+ setup_cmds .extend (
4558
+ [('ip netns add %s' % netns ),
4559
+ ('ip link set %s netns %s' % (macvlan2_int , netns ))])
4560
+ for exec_cmd in (
4561
+ ('ip address add %s/24 brd + dev %s' % (macvlan2_ip , macvlan2_int ),
4562
+ 'ip link set %s up' % macvlan2_int ,
4563
+ 'ip route add default via %s' % macvlan2_gw )):
4564
+ setup_cmds .append ('ip netns exec %s %s' % (netns , exec_cmd ))
4565
+ setup_cmds .append (
4566
+ 'ip route add %s/32 via %s' % (macvlan2_ip , macvlan1_gw ))
4567
+ self .quiet_commands (host , setup_cmds )
4568
+ self .one_ipv4_ping (host , macvlan2_ip , intf = macvlan1_int )
4569
+ self .quiet_commands (host , ['ip netns del %s' % netns ])
4570
+ self .wait_nonzero_packet_count_flow (
4571
+ {'eth_dst' : macvlan2_mac }, table_id = self ._ETH_DST_HAIRPIN_TABLE )
4572
+
4545
4573
4546
4574
class FaucetTaggedScaleTest (FaucetTaggedTest ):
4547
4575
0 commit comments