Commit 981a5307 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Multiple changes:

Common:
- minor bug resolutions in Context API

Service:
- first functional version of Service (implementation of GetConnectionList postponed)
- minor corrections in service.proto and related files
- implemented unitary tests
parent ad08989e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ service ServiceService {
  rpc GetServiceList (context.Empty) returns (ServiceList) {}
  rpc CreateService (Service) returns (ServiceId) {}
  rpc UpdateService (Service) returns (ServiceId) {}
  rpc DeleteService (Service) returns (context.Empty) {}
  rpc DeleteService (ServiceId) returns (context.Empty) {}
  rpc GetServiceById (ServiceId) returns (Service) {}
  rpc GetConnectionList (context.Empty) returns (ConnectionList) {}
  
+1 −1
Original line number Diff line number Diff line
@@ -34,4 +34,4 @@ KEY_SERVICE_CONSTRAINTS = KEY_SERVICE + '/constraints{container_name}'
KEY_SERVICE_ENDPOINT    = KEY_SERVICE  + '/endpoint[{endpoint_uuid}]'

# Context.Service.Constraint Keys
KEY_SERVICE_CONSTRAINT  = KEY_SERVICE  + '/constraint[{constraint_uuid}]'
KEY_SERVICE_CONSTRAINT  = KEY_SERVICE  + '/constraint[{constraint_type}]'
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class Constraint(_Entity):
        self.update(update_attributes={
            'constraint_value': constraint_value,
        })
        self.parent.endpoints.add(self.constraint_type)
        self.parent.constraints.add(self.constraint_type)
        return self

    def update(self, update_attributes={}, remove_attributes=[]) -> 'Constraint':
@@ -48,7 +48,7 @@ class Constraint(_Entity):

    def delete(self) -> None:
        self.attributes.delete()
        self.parent.endpoints.delete(self.constraint_type)
        self.parent.constraints.delete(self.constraint_type)

    def dump_id(self) -> Dict:
        return {
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ class Service(_Entity):
        if isinstance(service_type, ServiceType): service_type = service_type.value
        service_state = attributes.get('service_state', None)
        if isinstance(service_state, ServiceState): service_state = service_state.value
        service_config = attributes.get('device_config', None)
        service_config = attributes.get('service_config', None)
        endpoints = [self.endpoint(endpoint_uuid).dump() for endpoint_uuid in self.endpoints.get()]
        constraints = [self.constraint(constraint_type).dump() for constraint_type in self.constraints.get()]
        return {
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ class ServiceClient:
        return response

    @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect')
    def DeleteService(self, request : Service) -> Empty:
    def DeleteService(self, request : ServiceId) -> Empty:
        LOGGER.debug('DeleteService request: {}'.format(request))
        response = self.stub.DeleteService(request)
        LOGGER.debug('DeleteService result: {}'.format(response))
Loading