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
db81efc6
Commit
db81efc6
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Pre-merge code cleanup
parent
39504ce4
No related branches found
No related tags found
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!133
Integration of TE component
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/service/service/ServiceServiceServicerImpl.py
+37
-43
37 additions, 43 deletions
src/service/service/ServiceServiceServicerImpl.py
with
37 additions
and
43 deletions
src/service/service/ServiceServiceServicerImpl.py
+
37
−
43
View file @
db81efc6
...
...
@@ -117,6 +117,28 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
service
.
service_type
=
request
.
service_type
# pylint: disable=no-member
service
.
service_status
.
service_status
=
ServiceStatusEnum
.
SERVICESTATUS_PLANNED
# pylint: disable=no-member
if
service
.
service_type
==
ServiceTypeEnum
.
SERVICETYPE_TE
:
# TE service:
context_client
.
SetService
(
request
)
te_service_client
=
TEServiceClient
()
service_status
=
te_service_client
.
RequestLSP
(
service
)
if
service_status
.
service_status
==
ServiceStatusEnum
.
SERVICESTATUS_ACTIVE
:
_service
:
Optional
[
Service
]
=
get_service_by_id
(
context_client
,
request
.
service_id
,
rw_copy
=
True
,
include_config_rules
=
False
,
include_constraints
=
False
,
include_endpoint_ids
=
False
)
_service
.
service_status
.
service_status
=
ServiceStatusEnum
.
SERVICESTATUS_ACTIVE
service_id
=
context_client
.
SetService
(
_service
)
return
service_id
else
:
MSG
=
'
RequestLSP for Service({:s}) returned ServiceStatus({:s})
'
context_uuid
=
request
.
service_id
.
context_id
.
context_uuid
.
uuid
service_uuid
=
request
.
service_id
.
service_uuid
.
uuid
service_key
=
'
{:s}/{:s}
'
.
format
(
context_uuid
,
service_uuid
)
str_service_status
=
ServiceStatusEnum
.
Name
(
service_status
.
service_status
)
raise
Exception
(
MSG
.
format
(
service_key
,
str_service_status
))
del
service
.
service_endpoint_ids
[:]
# pylint: disable=no-member
for
endpoint_id
in
request
.
service_endpoint_ids
:
service
.
service_endpoint_ids
.
add
().
CopyFrom
(
endpoint_id
)
# pylint: disable=no-member
...
...
@@ -169,34 +191,6 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
context_client
,
service_id_with_uuids
,
rw_copy
=
False
,
include_config_rules
=
True
,
include_constraints
=
True
,
include_endpoint_ids
=
True
)
if
service
.
service_type
==
ServiceTypeEnum
.
SERVICETYPE_TE
:
# TE service:
te_service_client
=
TEServiceClient
()
# Note: TE should update the service in Context.
# By now we update it manually for debugging purposes
service
=
Service
()
service
.
CopyFrom
(
request
)
service
.
service_status
.
service_status
=
ServiceStatusEnum
.
SERVICESTATUS_PLANNED
context_client
.
SetService
(
request
)
service_status
=
te_service_client
.
RequestLSP
(
service
)
if
service_status
.
service_status
==
ServiceStatusEnum
.
SERVICESTATUS_ACTIVE
:
_service
:
Optional
[
Service
]
=
get_service
(
context_client
,
request
.
service_id
)
service
=
Service
()
service
.
CopyFrom
(
_service
)
service
.
service_status
.
service_status
=
ServiceStatusEnum
.
SERVICESTATUS_ACTIVE
context_client
.
SetService
(
service
)
else
:
MSG
=
'
RequestLSP for Service({:s}) returned ServiceStatus({:s})
'
context_uuid
=
request
.
service_id
.
context_id
.
context_uuid
.
uuid
service_uuid
=
request
.
service_id
.
service_uuid
.
uuid
service_key
=
'
{:s}/{:s}
'
.
format
(
context_uuid
,
service_uuid
)
str_service_status
=
ServiceStatusEnum
.
Name
(
service_status
.
service_status
)
raise
Exception
(
MSG
.
format
(
service_key
,
str_service_status
))
else
:
# Normal service:
num_disjoint_paths
=
None
for
constraint
in
request
.
service_constraints
:
if
constraint
.
WhichOneof
(
'
constraint
'
)
==
'
sla_availability
'
:
...
...
@@ -253,7 +247,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
te_service_client
=
TEServiceClient
()
te_service_client
.
DeleteLSP
(
request
)
context_client
.
RemoveService
(
request
)
else
:
return
Empty
()
# Normal service
# Feed TaskScheduler with this service and the sub-services and sub-connections related to this service.
# TaskScheduler identifies inter-dependencies among them and produces a schedule of tasks (an ordered list of
...
...
@@ -261,7 +256,6 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
tasks_scheduler
=
TasksScheduler
(
self
.
service_handler_factory
)
tasks_scheduler
.
compose_from_service
(
service
,
is_delete
=
True
)
tasks_scheduler
.
execute_all
()
return
Empty
()
@safe_and_metered_rpc_method
(
METRICS_POOL
,
LOGGER
)
...
...
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