Skip to content

Commit

Permalink
Added RANGE_SB_PRIORITY
Browse files Browse the repository at this point in the history
- Updated changelog
  • Loading branch information
Alopalao committed Nov 15, 2023
1 parent 84ca0c0 commit 2c7b49c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Added
- Added a UI button for redeploying an EVC.
- UNI tag_type are now accepted as string.
- EVCs now listen to ``switch.interface.(link_up|link_down|created|deleted)`` events for activation/deactivation
- Circuits with a vlan range are supported now. The ranges follows ``list[list[int]]`` format and both UNIs vlan should have the same ranges.
- Added default priority ``RANGE_SB_PRIORITY`` with value as ``18000`` for circuits with vlan ranges.

Changed
=======
Expand Down
9 changes: 5 additions & 4 deletions models/evc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ def set_flow_table_group_id(self, flow_mod: dict, vlan) -> dict:
def get_priority(vlan):
"""Return priority value depending on vlan value"""
if isinstance(vlan, list):
return settings.EVPL_SB_PRIORITY
return settings.RANGE_SB_PRIORITY
if vlan not in {None, "4096/4096", 0}:
return settings.EVPL_SB_PRIORITY
if vlan == 0:
Expand Down Expand Up @@ -1272,18 +1272,19 @@ def _prepare_push_flow(self, *args, queue_id=None):
Arguments:
in_interface(str): Interface input.
out_interface(str): Interface output.
in_vlan(int,str,list,None): Vlan input.
in_vlan(int,str,None): Vlan input.
out_vlan(str): Vlan output.
new_c_vlan(str): New client vlan.
new_c_vlan(int,str,list,None): New client vlan.
Return:
dict: An python dictionary representing a FlowMod
"""
# assign all arguments
in_interface, out_interface, in_vlan, out_vlan, new_c_vlan = args
vlan_pri = in_vlan if not isinstance(new_c_vlan, list) else new_c_vlan
flow_mod = self._prepare_flow_mod(
in_interface, out_interface, queue_id, in_vlan
in_interface, out_interface, queue_id, vlan_pri
)
# the service tag must be always pushed
new_action = {"action_type": "set_vlan", "vlan_id": out_vlan}
Expand Down
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
EPL_SB_PRIORITY = 10000
ANY_SB_PRIORITY = 15000
UNTAGGED_SB_PRIORITY = 20000
RANGE_SB_PRIORITY = 18000

# Time (seconds) to check if an evc has been updated
# or flows have been deleted.
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/models/test_evc_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from napps.kytos.mef_eline.models import EVC, EVCDeploy, Path # NOQA
from napps.kytos.mef_eline.settings import (ANY_SB_PRIORITY, # NOQA
EPL_SB_PRIORITY, EVPL_SB_PRIORITY,
MANAGER_URL, SDN_TRACE_CP_URL,
MANAGER_URL, RANGE_SB_PRIORITY,
SDN_TRACE_CP_URL,
UNTAGGED_SB_PRIORITY)
from napps.kytos.mef_eline.tests.helpers import (get_link_mocked, # NOQA
get_uni_mocked)
Expand Down Expand Up @@ -1968,7 +1969,7 @@ def test_get_priority(self):
assert epl_value == EPL_SB_PRIORITY

epl_value = EVC.get_priority([[1, 5]])
assert epl_value == EVPL_SB_PRIORITY
assert epl_value == RANGE_SB_PRIORITY

def test_set_flow_table_group_id(self):
"""Test set_flow_table_group_id"""
Expand Down Expand Up @@ -2053,11 +2054,11 @@ def test_prepare_direct_uni_flows(self):
for i in range(0, 3):
assert flows[i]["match"]["in_port"] == 1
assert flows[i]["match"]["dl_vlan"] == mask_list[i]
assert flows[i]["priority"] == EVPL_SB_PRIORITY
assert flows[i]["priority"] == RANGE_SB_PRIORITY
for i in range(3, 6):
assert flows[i]["match"]["in_port"] == 2
assert flows[i]["match"]["dl_vlan"] == mask_list[i-3]
assert flows[i]["priority"] == EVPL_SB_PRIORITY
assert flows[i]["priority"] == RANGE_SB_PRIORITY

@patch("napps.kytos.mef_eline.models.evc.EVCDeploy.check_trace")
def test_check_range(self, mock_check_range):
Expand Down

0 comments on commit 2c7b49c

Please sign in to comment.