Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Adjust MEF E-Line tests to also consider failover_path flows #144

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 53 additions & 26 deletions tests/test_e2e_10_mef_eline.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

TIME_FMT = "%Y-%m-%dT%H:%M:%S+0000"

RE_I=re.IGNORECASE

# BasicFlows
# Each should have at least 3 flows, considering topology 'ring':
# - 01 for LLDP
Expand Down Expand Up @@ -166,13 +168,15 @@ def test_020_create_evc_inter_switch(self):
assert 'circuit_id' in data
time.sleep(10)

# Each switch must have BASIC_FLOWS + 02 for the EVC (ingress + egress)
# search for the cookie, should have three flows:
# - 2 for the current path
# - 1 for the failover path
s1, s2 = self.net.net.get('s1', 's2')
flows_s1 = s1.dpctl('dump-flows')
flows_s2 = s2.dpctl('dump-flows')

assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 3
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 3

# make sure it should be dl_vlan instead of vlan_vid
assert 'dl_vlan=15' in flows_s1
Expand Down Expand Up @@ -217,12 +221,14 @@ def test_025_create_evc_different_tags_each_side(self):
assert 'circuit_id' in data
time.sleep(10)

# Each switch must have BASIC_FLOWS + 02 for the EVC (ingress + egress)
# Each switch must have BASIC_FLOWS + 03 for the EVC:
# - 2 for current path (ingress + egress)
# - 1 for failover path
s1, s2 = self.net.net.get('s1', 's2')
flows_s1 = s1.dpctl('dump-flows')
flows_s2 = s2.dpctl('dump-flows')
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 3
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 3

# make sure it should be dl_vlan instead of vlan_vid
assert 'dl_vlan=102' in flows_s1
Expand Down Expand Up @@ -266,12 +272,14 @@ def test_030_create_evc_tag_notag(self):
assert 'circuit_id' in data
time.sleep(10)

# Each switch must have BASIC_FLOWS + 02 for the EVC (ingress + egress)
# Each switch must have BASIC_FLOWS + 03 for the EVC:
# - 2 for current path (ingress + egress)
# - 1 for failover path
s1, s2 = self.net.net.get('s1', 's2')
flows_s1 = s1.dpctl('dump-flows')
flows_s2 = s2.dpctl('dump-flows')
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 3
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 3

# make sure it should be dl_vlan instead of vlan_vid
assert 'dl_vlan=104' in flows_s1
Expand Down Expand Up @@ -341,15 +349,16 @@ def test_035_create_evc_same_vid_different_uni(self):
assert evc1 != evc2
time.sleep(10)

# Switch should have BASIC_FLOWS + 02 for evc1 + 02 for evc2
# The switches 2 and 3 should have BASIC_FLOWS + 02 for evc
# Switch s1 should have BASIC_FLOWS + 3 for evc1 + 3 for evc2
# Switch s2 should have BASIC_FLOWS + 3 for evc1 + 2 for evc2/failover
# Switch s2 should have BASIC_FLOWS + 3 for evc2 + 2 for evc1/failover
s1, s2, s3 = self.net.net.get('s1', 's2', 's3')
flows_s1 = s1.dpctl('dump-flows')
flows_s2 = s2.dpctl('dump-flows')
flows_s3 = s3.dpctl('dump-flows')
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 4
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s3.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 6
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 5
assert len(flows_s3.split('\r\n ')) == BASIC_FLOWS + 5

# make sure it should be dl_vlan instead of vlan_vid
assert 'dl_vlan=110' in flows_s1
Expand Down Expand Up @@ -501,12 +510,14 @@ def test_045_create_circuit_reusing_same_vlanid_from_previous_evc(self):
assert evc1 != evc2
time.sleep(10)

# Each switch must have BASIC_FLOWS + 02 for the EVC (ingress + egress)
# Each switch must have BASIC_FLOWS + 03 for the EVC:
# - 2 for current path (ingress + egress)
# - 1 for failover path
s1, s2 = self.net.net.get('s1', 's2')
flows_s1 = s1.dpctl('dump-flows')
flows_s2 = s2.dpctl('dump-flows')
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 2
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 3
assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 3

# Nodes should be able to ping each other
h11, h2 = self.net.net.get('h11', 'h2')
Expand Down Expand Up @@ -560,7 +571,9 @@ def test_050_on_primary_path_fail_should_migrate_to_backup(self):

time.sleep(10)

# Each switch must have BASIC_FLOWS + 02 for the EVC (ingress + egress)
# Each switch must have BASIC_FLOWS + 02 for the EVC:
# - 2 for current path (ingress + egress)
# - (there will be no failover path)
s1, s2, s3 = self.net.net.get('s1', 's2', 's3')
flows_s1 = s1.dpctl('dump-flows')
flows_s2 = s2.dpctl('dump-flows')
Expand Down Expand Up @@ -691,9 +704,17 @@ def test_080_create_and_remove_ten_circuits_ten_times(self):
# search for the vlan id
assert "dl_vlan=%s" % vid in flows_s1
assert "dl_vlan=%s" % vid in flows_s2
# search for the cookie, should have two flows
assert len(re.findall(evc['id'], flows_s1, flags=re.IGNORECASE)) == 2, "round=%d - should have 2 flows but had: \n%s" % (x, flows_s1)
assert len(re.findall(evc['id'], flows_s2, flags=re.IGNORECASE)) == 2, "round=%d - should have 2 flows but had: \n%s" % (x, flows_s2)
# search for the cookie, should have three flows:
# - 2 for the current path
# - 1 for the failover path
assert (
len(re.findall(evc['id'], flows_s1, flags=RE_I)) == 3,
f"round={x} - should have 3 flows but had: \n{flows_s1}"
)
assert (
len(re.findall(evc['id'], flows_s2, flags=RE_I)) == 3,
f"round={x} - should have 3 flows but had: \n{flows_s2}"
)

# Delete the circuits
for vid in evcs:
Expand Down Expand Up @@ -754,11 +775,17 @@ def test_085_create_and_remove_ten_circuit_concurrently(self):
# search for the vlan id
assert "dl_vlan=%s" % vid in flows_s1
assert "dl_vlan=%s" % vid in flows_s2
# search for the cookie, should have two flows
assert len(re.findall(evc['id'], flows_s1, flags=re.IGNORECASE)) == 2, \
"should have 2 flows but had: \n%s" % flows_s1
assert len(re.findall(evc['id'], flows_s2, flags=re.IGNORECASE)) == 2, \
"should have 2 flows but had: \n%s" % flows_s2
# search for the cookie, should have three flows:
# - 2 for the current path
# - 1 for the failover path
assert (
len(re.findall(evc['id'], flows_s1, flags=RE_I)) == 3,
"should have 3 flows but had: \n%s" % flows_s1
)
assert (
len(re.findall(evc['id'], flows_s2, flags=RE_I)) == 3,
"should have 3 flows but had: \n%s" % flows_s2
)

# Delete the circuits
for vid in self.evcs:
Expand Down