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

Added e2e tests for untagged and any new EVCs #210

Merged
merged 3 commits into from
Mar 14, 2023
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
61 changes: 61 additions & 0 deletions tests/test_e2e_21_flow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,64 @@ def test_031_on_switch_restart_kytos_should_recreate_flows(self):
flows_s1 = s1.dpctl('dump-flows')
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 1, flows_s1
assert 'dl_vlan=999' in flows_s1

def test_032_on_switch_reconnection_should_recreate_untagged_any_flows(self):
"""Test if, after kytos restart, deserialize properly"""

payload = {
"flows": [
{
"priority": 10,
"match": {
"in_port": 1,
"dl_vlan": "4096/4096"
},
"actions": [
{
"action_type": "output",
"port": 2
}
]
},
{
"priority": 10,
"match": {
"in_port": 1,
"dl_vlan": 0
viniarck marked this conversation as resolved.
Show resolved Hide resolved
},
"actions": [
{
"action_type": "output",
"port": 2
}
]
},
]
}

api_url = KYTOS_API + '/flow_manager/v2/flows/00:00:00:00:00:00:00:01'
response = requests.post(api_url, data=json.dumps(payload),
headers={'Content-type': 'application/json'})
assert response.status_code == 202, response.text
data = response.json()
assert 'FlowMod Messages Sent' in data['response']

# wait for the flow to be installed
time.sleep(10)

# OVS does not have a way to actually restart the switch
# so to simulate that, we just delete all flows
s1 = self.net.net.get('s1')
s1.dpctl('del-flows')
# reconnect to trigger and speed up consistency check after the handshake
self.net.reconnect_switches()

# wait for the flow to be installed
time.sleep(10)

flows_s1 = s1.dpctl('dump-flows')
assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 2, flows_s1
# 4096/4096
assert 'vlan_tci=0x1000/0x1000' in flows_s1
# 0
assert 'vlan_tci=0x0000/0x1fff' in flows_s1