Skip to content

Commit b0418d2

Browse files
authored
Merge pull request #1998 from anarkiwi/master
Test IPv6 VIPs are inconsistent, fix group_id check.
2 parents 3dbc02b + 1fcee16 commit b0418d2

File tree

2 files changed

+21
-37
lines changed

2 files changed

+21
-37
lines changed

clib/mininet_test_base.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class FaucetTestBase(unittest.TestCase):
4747
ONE_GOOD_PING = '1 packets transmitted, 1 received, 0% packet loss'
4848
FAUCET_VIPV4 = ipaddress.ip_interface(u'10.0.0.254/24')
4949
FAUCET_VIPV4_2 = ipaddress.ip_interface(u'172.16.0.254/24')
50-
FAUCET_VIPV6 = ipaddress.ip_interface(u'fc00::1:254/64')
51-
FAUCET_VIPV6_2 = ipaddress.ip_interface(u'fc01::1:254/64')
50+
FAUCET_VIPV6 = ipaddress.ip_interface(u'fc00::1:254/112')
51+
FAUCET_VIPV6_2 = ipaddress.ip_interface(u'fc01::1:254/112')
5252
OFCTL = 'ovs-ofctl -OOpenFlow13'
5353
VSCTL = 'ovs-vsctl'
5454
OVS_TYPE = 'kernel'
@@ -750,21 +750,16 @@ def get_matching_flow(self, match, timeout=10, table_id=None,
750750
cookie=cookie)
751751

752752
def get_group_id_for_matching_flow(self, match, timeout=10, table_id=None):
753-
group_id = None
754753
for _ in range(timeout):
755754
flow_dict = self.get_matching_flow(
756755
match, timeout=timeout, table_id=table_id)
757756
if flow_dict:
758757
for action in flow_dict['actions']:
759758
if action.startswith('GROUP'):
760759
_, group_id = action.split(':')
761-
group_id = int(group_id)
762-
break
760+
return int(group_id)
763761
time.sleep(1)
764-
self.assertTrue(
765-
group_id,
766-
msg='Cannot find group_id for matching flow %s' % match)
767-
return group_id
762+
return None
768763

769764
def matching_flow_present_on_dpid(self, dpid, match, timeout=10, table_id=None,
770765
actions=None, match_exact=None, hard_timeout=0,
@@ -1941,6 +1936,7 @@ def wait_for_route_as_flow(self, nexthop, prefix, vlan_vid=None, timeout=10,
19411936
if with_group_table:
19421937
group_id = self.get_group_id_for_matching_flow(
19431938
nw_dst_match)
1939+
self.assertTrue(group_id)
19441940
self.wait_matching_in_group_table(
19451941
nexthop_action, group_id, timeout)
19461942
else:

tests/faucet_mininet_test_unit.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4327,10 +4327,10 @@ class FaucetUntaggedIPv6InterVLANRouteTest(FaucetUntaggedTest):
43274327
CONFIG_GLOBAL = """
43284328
vlans:
43294329
100:
4330-
faucet_vips: ["fc00::1:254/64"]
4330+
faucet_vips: ["fc00::1:254/112"]
43314331
vlanb:
43324332
vid: 200
4333-
faucet_vips: ["fc01::1:254/64"]
4333+
faucet_vips: ["fc01::1:254/112"]
43344334
faucet_mac: "%s"
43354335
vlanc:
43364336
vid: 100
@@ -4523,7 +4523,7 @@ class FaucetUntaggedMixedIPv6RouteTest(FaucetUntaggedTest):
45234523
vlans:
45244524
100:
45254525
description: "untagged"
4526-
faucet_vips: ["fc00::1:254/64", "fc01::1:254/64"]
4526+
faucet_vips: ["fc00::1:254/112", "fc01::1:254/112"]
45274527
"""
45284528

45294529
CONFIG = """
@@ -5488,6 +5488,7 @@ def test_group_exist(self):
54885488
{u'dl_vlan': u'100', u'dl_dst': u'ff:ff:ff:ff:ff:ff'},
54895489
table_id=self._FLOOD_TABLE))
54905490

5491+
54915492
class FaucetGroupTableUntaggedIPv4RouteTest(FaucetUntaggedTest):
54925493

54935494
CONFIG_GLOBAL = """
@@ -5502,9 +5503,6 @@ class FaucetGroupTableUntaggedIPv4RouteTest(FaucetUntaggedTest):
55025503
- route:
55035504
ip_dst: "10.0.2.0/24"
55045505
ip_gw: "10.0.0.2"
5505-
- route:
5506-
ip_dst: "10.0.3.0/24"
5507-
ip_gw: "10.0.0.2"
55085506
"""
55095507
CONFIG = """
55105508
arp_neighbor_timeout: 2
@@ -5530,18 +5528,14 @@ def test_untagged(self):
55305528
first_host, second_host = host_pair
55315529
first_host_routed_ip = ipaddress.ip_interface(u'10.0.1.1/24')
55325530
second_host_routed_ip = ipaddress.ip_interface(u'10.0.2.1/24')
5533-
self.verify_ipv4_routing(
5534-
first_host, first_host_routed_ip,
5535-
second_host, second_host_routed_ip,
5536-
with_group_table=True)
5537-
self.swap_host_macs(first_host, second_host)
5538-
self.verify_ipv4_routing(
5539-
first_host, first_host_routed_ip,
5540-
second_host, second_host_routed_ip,
5541-
with_group_table=True)
5531+
for _ in range(2):
5532+
self.verify_ipv4_routing(
5533+
first_host, first_host_routed_ip,
5534+
second_host, second_host_routed_ip,
5535+
with_group_table=True)
5536+
self.swap_host_macs(first_host, second_host)
55425537

55435538

5544-
@unittest.skip('group table routing unreliable')
55455539
class FaucetGroupTableUntaggedIPv6RouteTest(FaucetUntaggedTest):
55465540

55475541
CONFIG_GLOBAL = """
@@ -5556,9 +5550,6 @@ class FaucetGroupTableUntaggedIPv6RouteTest(FaucetUntaggedTest):
55565550
- route:
55575551
ip_dst: "fc00::20:0/112"
55585552
ip_gw: "fc00::1:2"
5559-
- route:
5560-
ip_dst: "fc00::30:0/112"
5561-
ip_gw: "fc00::1:2"
55625553
"""
55635554

55645555
CONFIG = """
@@ -5587,15 +5578,12 @@ def test_untagged(self):
55875578
second_host_ip = ipaddress.ip_interface(u'fc00::1:2/112')
55885579
first_host_routed_ip = ipaddress.ip_interface(u'fc00::10:1/112')
55895580
second_host_routed_ip = ipaddress.ip_interface(u'fc00::20:1/112')
5590-
self.verify_ipv6_routing_pair(
5591-
first_host, first_host_ip, first_host_routed_ip,
5592-
second_host, second_host_ip, second_host_routed_ip,
5593-
with_group_table=True)
5594-
self.swap_host_macs(first_host, second_host)
5595-
self.verify_ipv6_routing_pair(
5596-
first_host, first_host_ip, first_host_routed_ip,
5597-
second_host, second_host_ip, second_host_routed_ip,
5598-
with_group_table=True)
5581+
for _ in range(2):
5582+
self.verify_ipv6_routing_pair(
5583+
first_host, first_host_ip, first_host_routed_ip,
5584+
second_host, second_host_ip, second_host_routed_ip,
5585+
with_group_table=True)
5586+
self.swap_host_macs(first_host, second_host)
55995587

56005588

56015589
class FaucetEthSrcMaskTest(FaucetUntaggedTest):

0 commit comments

Comments
 (0)