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

VLAN reservation #120

Merged
merged 95 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
abcab85
vlan reservation #101
YufengXin Mar 23, 2023
273e218
Merge remote-tracking branch 'origin/main' into 101.vlan
sajith Jun 13, 2023
c6ef81a
Reformat
sajith Jun 13, 2023
4f806b2
Update a docstring
sajith Jun 13, 2023
23c430a
Add log and error check
sajith Jun 13, 2023
bd9b054
Update a docstring
sajith Jun 13, 2023
005d6a0
Update docstring
sajith Jun 13, 2023
21ac3e2
Add a placeholder test
sajith Jun 14, 2023
1ec7849
Correct method calls
sajith Jun 14, 2023
78fcbaf
Add a placeholder reserve_vlan_on_path
sajith Jun 14, 2023
2847ad1
Add error check and logging
sajith Jun 14, 2023
11f7c62
Format a comment
sajith Jun 14, 2023
7f3af7b
Add a test
sajith Jun 14, 2023
91a0bd7
Iterate correctly
sajith Jun 14, 2023
ffadc8d
Use the correct method name
sajith Jun 14, 2023
b3b7ff7
Add a topology lock
sajith Jun 14, 2023
9261029
Return None from unimplemented method
sajith Jun 14, 2023
e7a5b9a
Use the right branching test, perhaps
sajith Jun 14, 2023
3a1c7ad
Shorten code
sajith Jun 14, 2023
2f37a7e
Add type signature
sajith Jun 14, 2023
661416a
Return the right thing from VLAN reservation method
sajith Jun 14, 2023
da406b4
Add TODO items
sajith Jun 14, 2023
16fb247
Let the test fail
sajith Jun 14, 2023
d1761f4
Disable the complex case for now
sajith Jun 15, 2023
01ceb36
Add more assertions and a comment about output format
sajith Jun 15, 2023
2df264c
Add some data classes to represent the final breakdown
sajith Jun 15, 2023
a62dd9f
Add some notes about VLAN reservation
sajith Jun 15, 2023
e8c5d8a
Keep some extra assertions around, just in case
sajith Jun 16, 2023
143ee7b
Sketch out, poorly, a reserve vlan method
sajith Jun 16, 2023
f5669af
Add docstrings to VLAN-related structures, rename them
sajith Jun 19, 2023
629890f
Return a fake tagged breakdown
sajith Jun 19, 2023
4fcac46
Add more assertions
sajith Jun 19, 2023
058a5b9
Log domain breakdown
sajith Jun 19, 2023
7548c3c
Collect label ranges from links
sajith Jun 19, 2023
4dc0ffe
Create VLAN tags table from nodes in the topology
sajith Jun 19, 2023
ff21ad9
Remove debug print
sajith Jun 19, 2023
470fd9d
Remove unused
sajith Jun 19, 2023
cdfa39c
Remove unused debug prints
sajith Jun 19, 2023
25c6946
Pass domain to reservation method
sajith Jun 19, 2023
5c49acf
Attempt to find a VLAN tag
sajith Jun 20, 2023
0fae77f
Force success for now
sajith Jun 20, 2023
2af27b4
Use the computed VLAN tags
sajith Jun 20, 2023
c7df6d3
Form VLAN table from links, not nodes
sajith Jun 20, 2023
1f3e270
Skip when label range is None
sajith Jun 20, 2023
978fd8d
Use more descriptive variable names
sajith Jun 20, 2023
8614d78
Place comment at the appropriate place
sajith Jun 20, 2023
3525845
Comment out unused code
sajith Jun 20, 2023
d2976e5
Remove unused code
sajith Jun 20, 2023
30d7535
Remove log statement
sajith Jun 20, 2023
79b5bf4
Remove unused code
sajith Jun 20, 2023
e326ce2
Return early when port ID is invalid
sajith Jun 20, 2023
8c081b8
Return early when an available VLAN tag can't be found
sajith Jun 20, 2023
022693b
Mark reserved tag as in-use
sajith Jun 20, 2023
e089384
Disable debug print
sajith Jun 20, 2023
645d51e
Expand labels from links hopefully correctly
sajith Jun 20, 2023
ca69583
Leave a note about port ID inconsistency
sajith Jun 20, 2023
0bfc182
Form VLAN-tagged results into desired shape
sajith Jun 20, 2023
3092658
Update test assertions
sajith Jun 20, 2023
cfe6b11
Run isort
sajith Jun 21, 2023
0feff50
Add a method to print VLAN assignment table
sajith Jun 21, 2023
5cc8eb2
Add a class to represent set of VLAN-tagged breakdowns
sajith Jun 21, 2023
b0fefb6
Use appropriate comment syntax
sajith Jun 21, 2023
74beccc
Expand all labels
sajith Jun 21, 2023
cec5821
Add a method to expand label ranges
sajith Jun 21, 2023
3106772
Remove unused method for creating VLAN table from nodes
sajith Jun 21, 2023
5ced9d1
Rename "interface_id" to "port_id"
sajith Jun 21, 2023
7b7405e
Use shorter names
sajith Jun 21, 2023
5e57d53
Loop over segments when testing
sajith Jun 21, 2023
207f129
Use itertools to expand label range
sajith Jun 21, 2023
a1a034e
Use a shorter way to expand labels
sajith Jun 22, 2023
907f2cc
Rename VLAN tags table update method
sajith Jun 22, 2023
89cc724
Update TODO item
sajith Jun 22, 2023
92a28e6
Comment out unused code
sajith Jun 22, 2023
a4af7c6
Form segment name
sajith Jun 22, 2023
078065b
Remove TODO
sajith Jun 22, 2023
3f5ecbd
Rename models for clarity
sajith Jun 22, 2023
9c0a364
Return the right type
sajith Jun 22, 2023
70ac586
Shorten long lines
sajith Jun 22, 2023
b17e1e8
Mark private APIs as such
sajith Jun 22, 2023
34e40fa
Mark private methods as such
sajith Jun 22, 2023
87f5970
Return VLAN tagged breakdown
sajith Jun 22, 2023
4fc53bc
Return early when a domain can't be found VLAN table
sajith Jun 22, 2023
108237b
Update test case, abandon redundant test
sajith Jun 22, 2023
c5ccacc
Return None when VLAN assignment fails
sajith Jun 22, 2023
6945618
Update VLAN table on initialization too
sajith Jun 22, 2023
dc83d9d
Update assertions
sajith Jun 22, 2023
3b07c61
Read test data in fewer lines
sajith Jun 22, 2023
928d4b7
Assert better
sajith Jun 22, 2023
b3fd025
Assert failure when method is not implemented
sajith Jun 25, 2023
a92ae35
Mark reserved VLAN tag as in-use
sajith Jun 25, 2023
b99a374
Indicate that lock is private
sajith Jun 26, 2023
1e19555
Reformat
sajith Jun 26, 2023
ac71257
Assign issues to TODO items
sajith Jun 28, 2023
eb5f0ba
Remove stale TODO comments
sajith Jun 28, 2023
dc9842f
Reformat
sajith Jun 29, 2023
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
70 changes: 70 additions & 0 deletions src/sdx/pce/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,73 @@ class ConnectionSolution:

connection_map: Mapping[ConnectionRequest, List[ConnectionPath]]
cost: float


# The classess below should help us construct a breakdown of the below
# form that pertains to one domain:
#
# {
# "name": "TENET_vlan_201_203_Ampath_Tenet",
# "dynamic_backup_path": true,
# "uni_a": {
# "tag": {
# "value": 203,
# "tag_type": 1
# },
# "interface_id": "cc:00:00:00:00:00:00:07:41"
# },
# "uni_z": {
# "tag": {
# "value": 201,
# "tag_type": 1
# },
# "interface_id": "cc:00:00:00:00:00:00:08:50"
# }
# }


@dataclass_json
@dataclass(frozen=True)
class VlanTag:
"""
Representation of a VLAN tag.

TODO: document tag_type.
"""

value: int
tag_type: int


@dataclass_json
@dataclass(frozen=True)
class VlanTaggedPort:
"""
Representation of a port.
"""

tag: VlanTag
port_id: str


@dataclass_json
@dataclass(frozen=True)
class VlanTaggedBreakdown:
"""
Path breakdown within a single domain with VLAN assignments.
"""

name: str
dynamic_backup_path: bool
uni_a: VlanTaggedPort
uni_z: VlanTaggedPort


@dataclass_json
@dataclass(frozen=True)
class VlanTaggedBreakdowns:
"""
Mapping from domain to breakdown.
"""

breakdowns: Mapping[str, VlanTaggedBreakdown]
Loading