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
cdc9c97c
Commit
cdc9c97c
authored
5 months ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Pre-merge code fixes and cleanup
parent
67c89954
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!294
Release TeraFlowSDN 4.0
,
!285
Resolve: "(CNIT) New SBI Driver based on OpenROADM for ROADMs"
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/tools/descriptor/Loader.py
+29
-13
29 additions, 13 deletions
src/common/tools/descriptor/Loader.py
with
29 additions
and
13 deletions
src/common/tools/descriptor/Loader.py
+
29
−
13
View file @
cdc9c97c
...
...
@@ -133,11 +133,11 @@ class DescriptorLoader:
self
.
__topologies
=
self
.
__descriptors
.
get
(
'
topologies
'
,
[])
self
.
__devices
=
self
.
__descriptors
.
get
(
'
devices
'
,
[])
self
.
__links
=
self
.
__descriptors
.
get
(
'
links
'
,
[])
self
.
__optical_links
=
self
.
__descriptors
.
get
(
'
optical_links
'
,[])
self
.
__services
=
self
.
__descriptors
.
get
(
'
services
'
,
[])
self
.
__slices
=
self
.
__descriptors
.
get
(
'
slices
'
,
[])
self
.
__ietf_slices
=
self
.
__descriptors
.
get
(
'
ietf-network-slice-service:network-slice-services
'
,
{})
self
.
__connections
=
self
.
__descriptors
.
get
(
'
connections
'
,
[])
self
.
__optical_links
=
self
.
__descriptors
.
get
(
'
optical_links
'
,[])
if
len
(
self
.
__ietf_slices
)
>
0
:
for
slice_service
in
self
.
__ietf_slices
[
"
slice-service
"
]:
...
...
@@ -249,6 +249,12 @@ class DescriptorLoader:
@property
def
num_links
(
self
)
->
int
:
return
len
(
self
.
__links
)
@property
def
optical_links
(
self
)
->
List
[
Dict
]:
return
self
.
__optical_links
@property
def
num_optical_links
(
self
)
->
int
:
return
len
(
self
.
__optical_links
)
@property
def
services
(
self
)
->
Dict
[
str
,
List
[
Dict
]]:
_services
=
{}
...
...
@@ -286,9 +292,6 @@ class DescriptorLoader:
@property
def
num_connections
(
self
)
->
int
:
return
len
(
self
.
__connections
)
@property
def
optical_links
(
self
)
->
List
[
Dict
]:
return
self
.
__optical_links
def
process
(
self
)
->
TypeResults
:
# Format CustomConfigRules in Devices, Services and Slices provided in JSON format
...
...
@@ -314,14 +317,15 @@ class DescriptorLoader:
controllers
,
network_devices
=
split_controllers_and_network_devices
(
self
.
__devices
)
self
.
__ctx_cli
.
connect
()
self
.
_process_descr
(
'
context
'
,
'
add
'
,
self
.
__ctx_cli
.
SetContext
,
Context
,
self
.
__contexts_add
)
self
.
_process_descr
(
'
topology
'
,
'
add
'
,
self
.
__ctx_cli
.
SetTopology
,
Topology
,
self
.
__topologies_add
)
self
.
_process_descr
(
'
controller
'
,
'
add
'
,
self
.
__ctx_cli
.
SetDevice
,
Device
,
controllers
)
self
.
_process_descr
(
'
device
'
,
'
add
'
,
self
.
__ctx_cli
.
SetDevice
,
Device
,
network_devices
)
self
.
_process_descr
(
'
link
'
,
'
add
'
,
self
.
__ctx_cli
.
SetLink
,
Link
,
self
.
__links
)
self
.
_process_descr
(
'
service
'
,
'
add
'
,
self
.
__ctx_cli
.
SetService
,
Service
,
self
.
__services
)
self
.
_process_descr
(
'
slice
'
,
'
add
'
,
self
.
__ctx_cli
.
SetSlice
,
Slice
,
self
.
__slices
)
self
.
_process_descr
(
'
connection
'
,
'
add
'
,
self
.
__ctx_cli
.
SetConnection
,
Connection
,
self
.
__connections
)
self
.
_process_descr
(
'
context
'
,
'
add
'
,
self
.
__ctx_cli
.
SetContext
,
Context
,
self
.
__contexts_add
)
self
.
_process_descr
(
'
topology
'
,
'
add
'
,
self
.
__ctx_cli
.
SetTopology
,
Topology
,
self
.
__topologies_add
)
self
.
_process_descr
(
'
controller
'
,
'
add
'
,
self
.
__ctx_cli
.
SetDevice
,
Device
,
controllers
)
self
.
_process_descr
(
'
device
'
,
'
add
'
,
self
.
__ctx_cli
.
SetDevice
,
Device
,
network_devices
)
self
.
_process_descr
(
'
link
'
,
'
add
'
,
self
.
__ctx_cli
.
SetLink
,
Link
,
self
.
__links
)
self
.
_process_descr
(
'
link
'
,
'
add
'
,
self
.
__ctx_cli
.
SetOpticalLink
,
OpticalLink
,
self
.
__optical_links
)
self
.
_process_descr
(
'
service
'
,
'
add
'
,
self
.
__ctx_cli
.
SetService
,
Service
,
self
.
__services
)
self
.
_process_descr
(
'
slice
'
,
'
add
'
,
self
.
__ctx_cli
.
SetSlice
,
Slice
,
self
.
__slices
)
self
.
_process_descr
(
'
connection
'
,
'
add
'
,
self
.
__ctx_cli
.
SetConnection
,
Connection
,
self
.
__connections
)
# By default the Context component automatically assigns devices and links to topologies based on their
# endpoints, and assigns topologies, services, and slices to contexts based on their identifiers.
...
...
@@ -358,11 +362,11 @@ class DescriptorLoader:
self
.
_process_descr
(
'
device
'
,
'
add
'
,
self
.
__dev_cli
.
AddDevice
,
Device
,
network_devices_add
)
self
.
_process_descr
(
'
device
'
,
'
config
'
,
self
.
__dev_cli
.
ConfigureDevice
,
Device
,
self
.
__devices_config
)
self
.
_process_descr
(
'
link
'
,
'
add
'
,
self
.
__ctx_cli
.
SetLink
,
Link
,
self
.
__links
)
self
.
_process_descr
(
'
link
'
,
'
add
'
,
self
.
__ctx_cli
.
SetOpticalLink
,
OpticalLink
,
self
.
__optical_links
)
self
.
_process_descr
(
'
service
'
,
'
add
'
,
self
.
__svc_cli
.
CreateService
,
Service
,
self
.
__services_add
)
self
.
_process_descr
(
'
service
'
,
'
update
'
,
self
.
__svc_cli
.
UpdateService
,
Service
,
self
.
__services
)
self
.
_process_descr
(
'
slice
'
,
'
add
'
,
self
.
__slc_cli
.
CreateSlice
,
Slice
,
self
.
__slices_add
)
self
.
_process_descr
(
'
slice
'
,
'
update
'
,
self
.
__slc_cli
.
UpdateSlice
,
Slice
,
self
.
__slices
)
self
.
_process_descr
(
'
link
'
,
'
add
'
,
self
.
__ctx_cli
.
SetOpticalLink
,
OpticalLink
,
self
.
__optical_links
)
# By default the Context component automatically assigns devices and links to topologies based on their
# endpoints, and assigns topologies, services, and slices to contexts based on their identifiers.
...
...
@@ -420,6 +424,9 @@ class DescriptorLoader:
response
=
self
.
__ctx_cli
.
ListLinks
(
Empty
())
assert
len
(
response
.
links
)
==
self
.
num_links
response
=
self
.
__ctx_cli
.
GetOpticalLinkList
(
Empty
())
assert
len
(
response
.
optical_links
)
==
self
.
num_links
for
context_uuid
,
num_services
in
self
.
num_services
.
items
():
response
=
self
.
__ctx_cli
.
ListServices
(
ContextId
(
**
json_context_id
(
context_uuid
)))
assert
len
(
response
.
services
)
==
num_services
...
...
@@ -440,6 +447,9 @@ class DescriptorLoader:
for
service
in
service_list
:
self
.
__ctx_cli
.
RemoveService
(
ServiceId
(
**
service
[
'
service_id
'
]))
for
optical_link
in
self
.
optical_links
:
self
.
__ctx_cli
.
DeleteOpticalLink
(
LinkId
(
**
optical_link
[
'
link_id
'
]))
for
link
in
self
.
links
:
self
.
__ctx_cli
.
RemoveLink
(
LinkId
(
**
link
[
'
link_id
'
]))
...
...
@@ -470,6 +480,9 @@ class DescriptorLoader:
for
service
in
service_list
:
self
.
__svc_cli
.
DeleteService
(
ServiceId
(
**
service
[
'
service_id
'
]))
for
optical_link
in
self
.
optical_links
:
self
.
__ctx_cli
.
DeleteOpticalLink
(
LinkId
(
**
optical_link
[
'
link_id
'
]))
for
link
in
self
.
links
:
self
.
__ctx_cli
.
RemoveLink
(
LinkId
(
**
link
[
'
link_id
'
]))
...
...
@@ -524,3 +537,6 @@ def validate_empty_scenario(context_client : ContextClient) -> None:
response
=
context_client
.
ListLinks
(
Empty
())
assert
len
(
response
.
links
)
==
0
response
=
context_client
.
GetOpticalLinkList
(
Empty
())
assert
len
(
response
.
optical_links
)
==
0
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