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
6c1f9f67
Commit
6c1f9f67
authored
2 years ago
by
delacal
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into feat/l3-components
parents
e4c17515
b8f1c792
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!93
Updated L3 components + scalability
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/service/service/service_handler_api/_ServiceHandler.py
+87
-58
87 additions, 58 deletions
src/service/service/service_handler_api/_ServiceHandler.py
with
87 additions
and
58 deletions
src/service/service/service_handler_api/_ServiceHandler.py
+
87
−
58
View file @
6c1f9f67
...
...
@@ -19,10 +19,12 @@ from device.client.DeviceClient import DeviceClient
from
service.service.database.ServiceModel
import
ServiceModel
class
_ServiceHandler
:
def
__init__
(
self
,
db_service
:
ServiceModel
,
database
:
Database
,
context_client
:
ContextClient
,
device_client
:
DeviceClient
,
**
settings
)
->
None
:
def
__init__
(
self
,
db_service
:
ServiceModel
,
database
:
Database
,
context_client
:
ContextClient
,
device_client
:
DeviceClient
,
**
settings
)
->
None
:
"""
Initialize Driver.
Parameters:
db_service
...
...
@@ -30,94 +32,121 @@ class _ServiceHandler:
database
The instance of the local in-memory database.
context_client
An instance of context client to be used to retrieve information from the service and the devices.
An instance of context client to be used to retrieve
information from the service and the devices.
device_client
An instance of device client to be used to configure the devices.
An instance of device client to be used to configure
the devices.
**settings
Extra settings required by the service handler.
"""
raise
NotImplementedError
()
def
SetEndpoint
(
self
,
endpoints
:
List
[
Tuple
[
str
,
str
,
Optional
[
str
]]])
->
List
[
Union
[
bool
,
Exception
]]:
"""
Set endpoints from a list.
def
SetEndpoint
(
self
,
endpoints
:
List
[
Tuple
[
str
,
str
,
Optional
[
str
]]])
\
->
List
[
Union
[
bool
,
Exception
]]:
"""
Create/Update service endpoints.
Parameters:
endpoints : List[Tuple[str, str, Optional[str]]]
List of tuples, each containing a device_uuid, endpoint_uuid and, optionally, the topology_uuid
endpoints: List[Tuple[str, str, Optional[str]]]
List of tuples, each containing a device_uuid,
endpoint_uuid and, optionally, the topology_uuid
of the endpoint to be added.
Returns:
results : List[Union[bool, Exception]]
List of results for endpoint changes requested. Return values must be in the same order than
endpoints requested. If an endpoint is properly added, True must be retrieved; otherwise, the
Exception that is raised during the processing must be retrieved.
results: List[Union[bool, Exception]]
List of results for endpoint changes requested.
Return values must be in the same order as the requested
endpoints. If an endpoint is properly added, True must be
returned; otherwise, the Exception that is raised during
the processing must be returned.
"""
raise
NotImplementedError
()
def
DeleteEndpoint
(
self
,
endpoints
:
List
[
Tuple
[
str
,
str
,
Optional
[
str
]]])
->
List
[
Union
[
bool
,
Exception
]]:
"""
Delete endpoints form a list.
def
DeleteEndpoint
(
self
,
endpoints
:
List
[
Tuple
[
str
,
str
,
Optional
[
str
]]])
\
->
List
[
Union
[
bool
,
Exception
]]:
"""
Delete service endpoints.
Parameters:
endpoints : List[Tuple[str, str, Optional[str]]]
List of tuples, each containing a device_uuid, endpoint_uuid, and the topology_uuid of the endpoint
endpoints: List[Tuple[str, str, Optional[str]]]
List of tuples, each containing a device_uuid,
endpoint_uuid, and the topology_uuid of the endpoint
to be removed.
Returns:
results : List[Union[bool, Exception]]
List of results for endpoint deletions requested. Return values must be in the same order than
endpoints requested. If an endpoint is properly deleted, True must be retrieved; otherwise, the
Exception that is raised during the processing must be retrieved.
results: List[Union[bool, Exception]]
List of results for endpoint deletions requested.
Return values must be in the same order as the requested
endpoints. If an endpoint is properly deleted, True must be
returned; otherwise, the Exception that is raised during
the processing must be returned.
"""
raise
NotImplementedError
()
def
SetConstraint
(
self
,
constraints
:
List
[
Tuple
[
str
,
Any
]])
->
List
[
Union
[
bool
,
Exception
]]:
"""
Create/Update constraints.
def
SetConstraint
(
self
,
constraints
:
List
[
Tuple
[
str
,
Any
]])
\
->
List
[
Union
[
bool
,
Exception
]]:
"""
Create/Update service constraints.
Parameters:
constraints : List[Tuple[str, Any]]
List of tuples, each containing a constraint_type and the new constraint_value to be set.
constraints: List[Tuple[str, Any]]
List of tuples, each containing a constraint_type and the
new constraint_value to be set.
Returns:
results : List[Union[bool, Exception]]
List of results for constraint changes requested. Return values must be in the same order than
constraints requested. If a constraint is properly set, True must be retrieved; otherwise, the
Exception that is raised during the processing must be retrieved.
results: List[Union[bool, Exception]]
List of results for constraint changes requested.
Return values must be in the same order as the requested
constraints. If a constraint is properly set, True must be
returned; otherwise, the Exception that is raised during
the processing must be returned.
"""
raise
NotImplementedError
()
def
DeleteConstraint
(
self
,
constraints
:
List
[
Tuple
[
str
,
Any
]])
->
List
[
Union
[
bool
,
Exception
]]:
"""
Delete constraints.
def
DeleteConstraint
(
self
,
constraints
:
List
[
Tuple
[
str
,
Any
]])
\
->
List
[
Union
[
bool
,
Exception
]]:
"""
Delete service constraints.
Parameters:
constraints : List[Tuple[str, Any]]
List of tuples, each containing a constraint_type pointing to the constraint to be deleted, and a
constraint_value containing possible additionally required values to locate the constraint to be
removed.
constraints: List[Tuple[str, Any]]
List of tuples, each containing a constraint_type pointing
to the constraint to be deleted, and a constraint_value
containing possible additionally required values to locate
the constraint to be removed.
Returns:
results : List[Union[bool, Exception]]
List of results for constraint deletions requested. Return values must be in the same order than
constraints requested. If a constraint is properly deleted, True must be retrieved; otherwise, the
Exception that is raised during the processing must be retrieved.
results: List[Union[bool, Exception]]
List of results for constraint deletions requested.
Return values must be in the same order as the requested
constraints. If a constraint is properly deleted, True must
be returned; otherwise, the Exception that is raised during
the processing must be returned.
"""
raise
NotImplementedError
()
def
SetConfig
(
self
,
resources
:
List
[
Tuple
[
str
,
Any
]])
->
List
[
Union
[
bool
,
Exception
]]:
"""
Create/Update configuration for a list of resources.
def
SetConfig
(
self
,
resources
:
List
[
Tuple
[
str
,
Any
]])
\
->
List
[
Union
[
bool
,
Exception
]]:
"""
Create/Update configuration for a list of service resources.
Parameters:
resources : List[Tuple[str, Any]]
List of tuples, each containing a resource_key pointing the resource to be modified, and a
resource_value containing the new value to be set.
resources: List[Tuple[str, Any]]
List of tuples, each containing a resource_key pointing to
the resource to be modified, and a resource_value
containing the new value to be set.
Returns:
results : List[Union[bool, Exception]]
List of results for resource key changes requested. Return values must be in the same order than
resource keys requested. If a resource is properly set, True must be retrieved; otherwise, the
Exception that is raised during the processing must be retrieved.
results: List[Union[bool, Exception]]
List of results for resource key changes requested.
Return values must be in the same order as the requested
resource keys. If a resource is properly set, True must be
returned; otherwise, the Exception that is raised during
the processing must be returned.
"""
raise
NotImplementedError
()
def
DeleteConfig
(
self
,
resources
:
List
[
Tuple
[
str
,
Any
]])
->
List
[
Union
[
bool
,
Exception
]]:
"""
Delete configuration for a list of resources.
def
DeleteConfig
(
self
,
resources
:
List
[
Tuple
[
str
,
Any
]])
\
->
List
[
Union
[
bool
,
Exception
]]:
"""
Delete configuration for a list of service resources.
Parameters:
resources : List[Tuple[str, Any]]
List of tuples, each containing a resource_key pointing the resource to be modified, and a
resource_value containing possible additionally required values to locate the value to be removed.
resources: List[Tuple[str, Any]]
List of tuples, each containing a resource_key pointing to
the resource to be modified, and a resource_value containing
possible additionally required values to locate the value
to be removed.
Returns:
results : List[Union[bool, Exception]]
List of results for resource key deletions requested. Return values must be in the same order than
resource keys requested. If a resource is properly deleted, True must be retrieved; otherwise, the
Exception that is raised during the processing must be retrieved.
results: List[Union[bool, Exception]]
List of results for resource key deletions requested.
Return values must be in the same order as the requested
resource keys. If a resource is properly deleted, True must
be returned; otherwise, the Exception that is raised during
the processing must be returned.
"""
raise
NotImplementedError
()
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