Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
514c4613
Commit
514c4613
authored
5 months ago
by
Mohammad Ismaeel
Browse files
Options
Downloads
Patches
Plain Diff
Bugs in optical controller fixed
parent
ad24389f
No related branches found
No related tags found
2 merge requests
!294
Release TeraFlowSDN 4.0
,
!285
Resolve: "(CNIT) New SBI Driver based on OpenROADM for ROADMs"
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/opticalcontroller/RSA.py
+6
-8
6 additions, 8 deletions
src/opticalcontroller/RSA.py
src/opticalcontroller/tools.py
+1
-61
1 addition, 61 deletions
src/opticalcontroller/tools.py
with
7 additions
and
69 deletions
src/opticalcontroller/RSA.py
+
6
−
8
View file @
514c4613
...
...
@@ -269,15 +269,14 @@ class RSA():
print
(
f
"
fib updated
{
fib
}
"
)
#print(fib)
def
update_link_2
(
self
,
fib
,
slots
,
band
,
link
):
def
update_link_2
(
self
,
fib
,
slots
,
band
):
#print(fib)
for
i
in
slots
:
fib
[
band
][
str
(
i
)]
=
0
if
'
used
'
in
fib
:
fib
[
'
used
'
]
=
True
set_link_update
(
fib
,
link
)
#print(fib)
def
update_optical_band
(
self
,
optical_band_id
,
slots
,
band
):
for
i
in
slots
:
...
...
@@ -294,14 +293,13 @@ class RSA():
fib
[
'
used
'
]
=
False
#fib[band].sort()
def
restore_link_2
(
self
,
fib
,
slots
,
band
,
link
):
print
(
"
start restoring link
"
)
def
restore_link_2
(
self
,
fib
,
slots
,
band
):
for
i
in
slots
:
fib
[
band
][
str
(
i
)]
=
1
if
'
used
'
in
fib
:
fib
[
'
used
'
]
=
False
#fib[band].keys().sort()
set_link_update
(
fib
,
link
,
test
=
"
restoration
"
)
def
restore_optical_band
(
self
,
optical_band_id
,
slots
,
band
):
for
i
in
slots
:
...
...
@@ -512,7 +510,7 @@ class RSA():
if
list_in_list
(
slots
,
str_list_to_int
(
fib
[
band
].
keys
())):
#fiber_list[l] = fib["ID"]
#self.update_link(fib, slots, band)
self
.
update_link_2
(
fib
,
slots
,
band
,
link
)
self
.
update_link_2
(
fib
,
slots
,
band
)
break
print
(
"
INFO: Path forward computation completed
"
)
return
fiber_list
...
...
This diff is collapsed.
Click to expand it.
src/opticalcontroller/tools.py
+
1
−
61
View file @
514c4613
...
...
@@ -261,65 +261,5 @@ def handle_slot (slot_field, slot):
slot_field
[
key
]
=
value
def
update_optical_band
(
optical_bands
,
optical_band_id
,
band
,
link
):
key_list
=
optical_bands
[
optical_band_id
][
band
].
keys
()
corrected_slots
=
optical_bands
[
optical_band_id
][
band
]
print
(
f
"
band
{
band
}
"
)
print
(
f
"
corrected_slots_before
{
corrected_slots
}
"
)
if
(
len
(
key_list
)
<
20
):
corrected_slots
=
correct_slot
(
optical_bands
[
optical_band_id
][
band
])
fib
=
{}
print
(
f
"
corrected_slots_after
{
corrected_slots
}
"
)
fib
[
'
c_slots
'
]
=
link
[
'
optical_details
'
][
'
c_slots
'
]
fib
[
'
l_slots
'
]
=
link
[
'
optical_details
'
][
'
l_slots
'
]
fib
[
'
s_slots
'
]
=
link
[
'
optical_details
'
][
'
s_slots
'
]
fib
[
band
]
=
corrected_slots
fib
[
"
src_port
"
]
=
optical_bands
[
optical_band_id
][
'
src_port
'
]
fib
[
"
dst_port
"
]
=
optical_bands
[
optical_band_id
][
'
dst_port
'
]
fib
[
"
local_peer_port
"
]
=
link
[
"
optical_details
"
][
"
local_peer_port
"
]
fib
[
"
remote_peer_port
"
]
=
link
[
"
optical_details
"
][
"
remote_peer_port
"
]
set_link_update
(
fib
,
link
,
test
=
f
"
restoring_optical_band
{
link
[
'
link_id
'
]
}
"
)
def
set_link_update
(
fib
:
dict
,
link
:
dict
,
test
=
"
updating
"
):
print
(
f
"
invoked from
{
test
}
"
)
print
(
f
"
fib updated
{
fib
}
"
)
optical_link
=
OpticalLink
()
linkId
=
LinkId
()
linkId
.
link_uuid
.
uuid
=
link
[
"
link_id
"
][
"
link_uuid
"
][
"
uuid
"
]
optical_details
=
OpticalLinkDetails
()
optical_link
.
optical_details
.
length
=
0
if
"
src_port
"
in
fib
:
optical_link
.
optical_details
.
src_port
=
fib
[
"
src_port
"
]
if
"
dst_port
"
in
fib
:
optical_link
.
optical_details
.
dst_port
=
fib
[
"
dst_port
"
]
if
"
local_peer_port
"
in
fib
:
optical_link
.
optical_details
.
local_peer_port
=
fib
[
'
local_peer_port
'
]
if
"
remote_peer_port
"
in
fib
:
optical_link
.
optical_details
.
remote_peer_port
=
fib
[
'
remote_peer_port
'
]
optical_link
.
optical_details
.
used
=
fib
[
'
used
'
]
if
'
used
'
in
fib
else
False
if
"
c_slots
"
in
fib
:
handle_slot
(
optical_link
.
optical_details
.
c_slots
,
fib
[
"
c_slots
"
])
if
"
s_slots
"
in
fib
:
handle_slot
(
optical_link
.
optical_details
.
s_slots
,
fib
[
"
s_slots
"
])
if
"
l_slots
"
in
fib
:
handle_slot
(
optical_link
.
optical_details
.
l_slots
,
fib
[
"
l_slots
"
])
optical_link
.
name
=
link
[
'
name
'
]
optical_link
.
link_id
.
CopyFrom
(
linkId
)
ctx_client
=
ContextClient
()
ctx_client
.
connect
()
try
:
ctx_client
.
SetOpticalLink
(
optical_link
)
except
Exception
as
err
:
print
(
f
"
setOpticalLink
{
err
}
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment