Skip to content

Commit

Permalink
Added owner to every flow mod to be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Alopalao committed Aug 21, 2024
1 parent ee496b4 commit 22c65ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion models/evc.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ def remove_failover_flows(self, exclude_uni_switches=True,
{
"cookie": cookie,
"cookie_mask": int(0xffffffffffffffff),
"owner": "mef_eline",
}
],
"delete",
Expand Down Expand Up @@ -725,7 +726,8 @@ def remove_current_flows(self, force=True, sync=True):
switches.add(self.uni_z.interface.switch)
match = {
"cookie": self.get_cookie(),
"cookie_mask": int(0xffffffffffffffff)
"cookie_mask": int(0xffffffffffffffff),
"owner": "mef_eline",
}

for switch in switches:
Expand Down Expand Up @@ -766,6 +768,7 @@ def remove_path_flows(
dpid_flows_match[dpid].append({
"cookie": flow["cookie"],
"match": flow["match"],
"owner": "mef_eline",
"cookie_mask": int(0xffffffffffffffff)
})

Expand All @@ -783,6 +786,7 @@ def remove_path_flows(
dpid_flows_match[dpid].append({
"cookie": flow["cookie"],
"match": flow["match"],
"owner": "mef_eline",
"cookie_mask": int(0xffffffffffffffff)
})

Expand Down
13 changes: 10 additions & 3 deletions tests/unit/models/test_evc_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,8 @@ def test_remove_current_flows(self, *args):
assert send_flow_mods_mocked.call_count == 5
assert evc.is_active() is False
flows = [
{"cookie": evc.get_cookie(), "cookie_mask": 18446744073709551615}
{"cookie": evc.get_cookie(), "cookie_mask": 18446744073709551615,
"owner": "mef_eline"}
]
switch_1 = evc.primary_links[0].endpoint_a.switch
switch_2 = evc.primary_links[0].endpoint_b.switch
Expand Down Expand Up @@ -1076,7 +1077,8 @@ def test_remove_failover_flows_exclude_uni_switches(self, *args):
assert send_flow_mods_mocked.call_count == 1
flows = [
{"cookie": evc.get_cookie(),
"cookie_mask": int(0xffffffffffffffff)}
"cookie_mask": int(0xffffffffffffffff),
"owner": "mef_eline"}
]
send_flow_mods_mocked.assert_any_call(switch_b.id, flows, 'delete',
force=True)
Expand Down Expand Up @@ -1140,7 +1142,8 @@ def test_remove_failover_flows_include_all(self, *args):
assert send_flow_mods_mocked.call_count == 3
flows = [
{"cookie": evc.get_cookie(),
"cookie_mask": int(0xffffffffffffffff)}
"cookie_mask": int(0xffffffffffffffff),
"owner": "mef_eline"}
]
send_flow_mods_mocked.assert_any_call(switch_a.id, flows, 'delete',
force=True)
Expand Down Expand Up @@ -1367,25 +1370,29 @@ def test_remove_path_flows(self, *args):
{
'cookie': 12249790986447749121,
'cookie_mask': 18446744073709551615,
"owner": "mef_eline",
'match': {'in_port': 9, 'dl_vlan': 5}
},
]
expected_flows_2 = [
{
'cookie': 12249790986447749121,
'cookie_mask': 18446744073709551615,
"owner": "mef_eline",
'match': {'in_port': 10, 'dl_vlan': 5}
},
{
'cookie': 12249790986447749121,
'cookie_mask': 18446744073709551615,
"owner": "mef_eline",
'match': {'in_port': 11, 'dl_vlan': 6}
},
]
expected_flows_3 = [
{
'cookie': 12249790986447749121,
'cookie_mask': 18446744073709551615,
"owner": "mef_eline",
'match': {'in_port': 12, 'dl_vlan': 6}
},
]
Expand Down
1 change: 1 addition & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def prepare_delete_flow(evc_flows: dict[str, list[dict]]):
dpid_flows[dpid].append({
"cookie": flow["cookie"],
"match": flow["match"],
"owner": "mef_eline",
"cookie_mask": int(0xffffffffffffffff)
})
return dpid_flows

0 comments on commit 22c65ed

Please sign in to comment.