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

Applied Set to compare special VLANs collections #510

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ UNRELEASED - Under development
Fixed
=====
- Execute routines like consistency checks will not trigger one more time after kytos shuts down.
- Order in ``interface.special_available_tags`` and ``interface.special_tags`` does not matter anymore when looking for used special tag.

[2024.1.2] - 2024-09-16
***********************
Expand Down
8 changes: 6 additions & 2 deletions kytos/core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,12 @@ def all_tags_available(self) -> bool:
"""Return True if all tags are avaiable (no tags used),
False otherwise"""
with self._tag_lock:
return (self.available_tags == self.tag_ranges and
self.special_available_tags == self.special_tags)
if self.available_tags != self.tag_ranges:
return False
for field, ranges in self.special_available_tags.items():
if set(ranges) != set(self.special_tags[field]):
return False
return True

def set_tag_ranges(self, tag_ranges: list[list[int]], tag_type: str):
"""Set new restriction, tag_ranges."""
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_core/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ def test_all_tags_available(self) -> None:
self.iface.special_available_tags = {"vlan": ["any"]}
assert self.iface.all_tags_available()

self.iface.special_available_tags = {"vlan": ["untagged", "any"]}
self.iface.special_tags = {"vlan": ["any", "untagged"]}
assert self.iface.all_tags_available()


class TestUNI():
"""UNI tests."""
Expand Down
Loading