Skip to content
Snippets Groups Projects
Commit e889d81d authored by gkatsikas's avatar gkatsikas
Browse files

style(service): fix style issues in service handler


Signed-off-by: default avatargkatsikas <katsikas.gp@gmail.com>
parent 72473224
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!4Compute component:
...@@ -19,10 +19,12 @@ from device.client.DeviceClient import DeviceClient ...@@ -19,10 +19,12 @@ from device.client.DeviceClient import DeviceClient
from service.service.database.ServiceModel import ServiceModel from service.service.database.ServiceModel import ServiceModel
class _ServiceHandler: class _ServiceHandler:
def __init__( def __init__(self,
self, db_service : ServiceModel, database : Database, context_client : ContextClient, db_service: ServiceModel,
device_client : DeviceClient, **settings database: Database,
) -> None: context_client: ContextClient,
device_client: DeviceClient,
**settings) -> None:
""" Initialize Driver. """ Initialize Driver.
Parameters: Parameters:
db_service db_service
...@@ -30,94 +32,121 @@ class _ServiceHandler: ...@@ -30,94 +32,121 @@ class _ServiceHandler:
database database
The instance of the local in-memory database. The instance of the local in-memory database.
context_client 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 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 **settings
Extra settings required by the service handler. Extra settings required by the service handler.
""" """
raise NotImplementedError() raise NotImplementedError()
def SetEndpoint(self, endpoints : List[Tuple[str, str, Optional[str]]]) -> List[Union[bool, Exception]]: def SetEndpoint(self, endpoints: List[Tuple[str, str, Optional[str]]]) \
""" Set endpoints from a list. -> List[Union[bool, Exception]]:
""" Create/Update service endpoints.
Parameters: Parameters:
endpoints : List[Tuple[str, str, Optional[str]]] endpoints: List[Tuple[str, str, Optional[str]]]
List of tuples, each containing a device_uuid, endpoint_uuid and, optionally, the topology_uuid List of tuples, each containing a device_uuid,
endpoint_uuid and, optionally, the topology_uuid
of the endpoint to be added. of the endpoint to be added.
Returns: Returns:
results : List[Union[bool, Exception]] results: List[Union[bool, Exception]]
List of results for endpoint changes requested. Return values must be in the same order than List of results for endpoint changes requested.
endpoints requested. If an endpoint is properly added, True must be retrieved; otherwise, the Return values must be in the same order as the requested
Exception that is raised during the processing must be retrieved. 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() raise NotImplementedError()
def DeleteEndpoint(self, endpoints : List[Tuple[str, str, Optional[str]]]) -> List[Union[bool, Exception]]: def DeleteEndpoint(self, endpoints: List[Tuple[str, str, Optional[str]]]) \
""" Delete endpoints form a list. -> List[Union[bool, Exception]]:
""" Delete service endpoints.
Parameters: Parameters:
endpoints : List[Tuple[str, str, Optional[str]]] endpoints: List[Tuple[str, str, Optional[str]]]
List of tuples, each containing a device_uuid, endpoint_uuid, and the topology_uuid of the endpoint List of tuples, each containing a device_uuid,
endpoint_uuid, and the topology_uuid of the endpoint
to be removed. to be removed.
Returns: Returns:
results : List[Union[bool, Exception]] results: List[Union[bool, Exception]]
List of results for endpoint deletions requested. Return values must be in the same order than List of results for endpoint deletions requested.
endpoints requested. If an endpoint is properly deleted, True must be retrieved; otherwise, the Return values must be in the same order as the requested
Exception that is raised during the processing must be retrieved. 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() raise NotImplementedError()
def SetConstraint(self, constraints : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: def SetConstraint(self, constraints: List[Tuple[str, Any]]) \
""" Create/Update constraints. -> List[Union[bool, Exception]]:
""" Create/Update service constraints.
Parameters: Parameters:
constraints : List[Tuple[str, Any]] constraints: List[Tuple[str, Any]]
List of tuples, each containing a constraint_type and the new constraint_value to be set. List of tuples, each containing a constraint_type and the
new constraint_value to be set.
Returns: Returns:
results : List[Union[bool, Exception]] results: List[Union[bool, Exception]]
List of results for constraint changes requested. Return values must be in the same order than List of results for constraint changes requested.
constraints requested. If a constraint is properly set, True must be retrieved; otherwise, the Return values must be in the same order as the requested
Exception that is raised during the processing must be retrieved. 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() raise NotImplementedError()
def DeleteConstraint(self, constraints : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: def DeleteConstraint(self, constraints: List[Tuple[str, Any]]) \
""" Delete constraints. -> List[Union[bool, Exception]]:
""" Delete service constraints.
Parameters: Parameters:
constraints : List[Tuple[str, Any]] constraints: List[Tuple[str, Any]]
List of tuples, each containing a constraint_type pointing to the constraint to be deleted, and a List of tuples, each containing a constraint_type pointing
constraint_value containing possible additionally required values to locate the constraint to be to the constraint to be deleted, and a constraint_value
removed. containing possible additionally required values to locate
the constraint to be removed.
Returns: Returns:
results : List[Union[bool, Exception]] results: List[Union[bool, Exception]]
List of results for constraint deletions requested. Return values must be in the same order than List of results for constraint deletions requested.
constraints requested. If a constraint is properly deleted, True must be retrieved; otherwise, the Return values must be in the same order as the requested
Exception that is raised during the processing must be retrieved. 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() raise NotImplementedError()
def SetConfig(self, resources : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: def SetConfig(self, resources: List[Tuple[str, Any]]) \
""" Create/Update configuration for a list of resources. -> List[Union[bool, Exception]]:
""" Create/Update configuration for a list of service resources.
Parameters: Parameters:
resources : List[Tuple[str, Any]] resources: List[Tuple[str, Any]]
List of tuples, each containing a resource_key pointing the resource to be modified, and a List of tuples, each containing a resource_key pointing to
resource_value containing the new value to be set. the resource to be modified, and a resource_value
containing the new value to be set.
Returns: Returns:
results : List[Union[bool, Exception]] results: List[Union[bool, Exception]]
List of results for resource key changes requested. Return values must be in the same order than List of results for resource key changes requested.
resource keys requested. If a resource is properly set, True must be retrieved; otherwise, the Return values must be in the same order as the requested
Exception that is raised during the processing must be retrieved. 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() raise NotImplementedError()
def DeleteConfig(self, resources : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: def DeleteConfig(self, resources: List[Tuple[str, Any]]) \
""" Delete configuration for a list of resources. -> List[Union[bool, Exception]]:
""" Delete configuration for a list of service resources.
Parameters: Parameters:
resources : List[Tuple[str, Any]] resources: List[Tuple[str, Any]]
List of tuples, each containing a resource_key pointing the resource to be modified, and a List of tuples, each containing a resource_key pointing to
resource_value containing possible additionally required values to locate the value to be removed. the resource to be modified, and a resource_value containing
possible additionally required values to locate the value
to be removed.
Returns: Returns:
results : List[Union[bool, Exception]] results: List[Union[bool, Exception]]
List of results for resource key deletions requested. Return values must be in the same order than List of results for resource key deletions requested.
resource keys requested. If a resource is properly deleted, True must be retrieved; otherwise, the Return values must be in the same order as the requested
Exception that is raised during the processing must be retrieved. 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() raise NotImplementedError()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment