Skip to content

Commit

Permalink
Merge pull request #210 from Alopalao/untagged_uni
Browse files Browse the repository at this point in the history
Added e2e tests for untagged and any new EVCs
  • Loading branch information
Alopalao authored Mar 14, 2023
2 parents e7c9cee + e316016 commit a6b9a56
Showing 1 changed file with 61 additions and 0 deletions.
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
},
"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

0 comments on commit a6b9a56

Please sign in to comment.