Commit 302b57f4 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/context-component' into 'develop'

Multiple changes in Context component:

See merge request teraflow-h2020/controller!175
parents 0f5789bd 5dfa664e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ service ContextService {
  rpc ListServices       (ContextId   ) returns (       ServiceList     ) {}
  rpc GetService         (ServiceId   ) returns (       Service         ) {}
  rpc SetService         (Service     ) returns (       ServiceId       ) {}
  rpc UnsetService       (Service     ) returns (       ServiceId       ) {}
  rpc RemoveService      (ServiceId   ) returns (       Empty           ) {}
  rpc GetServiceEvents   (Empty       ) returns (stream ServiceEvent    ) {}

@@ -58,6 +59,7 @@ service ContextService {
  rpc ListSlices         (ContextId   ) returns (       SliceList       ) {}
  rpc GetSlice           (SliceId     ) returns (       Slice           ) {}
  rpc SetSlice           (Slice       ) returns (       SliceId         ) {}
  rpc UnsetSlice         (Slice       ) returns (       SliceId         ) {}
  rpc RemoveSlice        (SliceId     ) returns (       Empty           ) {}
  rpc GetSliceEvents     (Empty       ) returns (stream SliceEvent      ) {}

+14 −0
Original line number Diff line number Diff line
@@ -250,6 +250,13 @@ class ContextClient:
        LOGGER.debug('SetService result: {:s}'.format(grpc_message_to_json_string(response)))
        return response

    @RETRY_DECORATOR
    def UnsetService(self, request: Service) -> ServiceId:
        LOGGER.debug('UnsetService request: {:s}'.format(grpc_message_to_json_string(request)))
        response = self.stub.UnsetService(request)
        LOGGER.debug('UnsetService result: {:s}'.format(grpc_message_to_json_string(response)))
        return response

    @RETRY_DECORATOR
    def RemoveService(self, request: ServiceId) -> Empty:
        LOGGER.debug('RemoveService request: {:s}'.format(grpc_message_to_json_string(request)))
@@ -292,6 +299,13 @@ class ContextClient:
        LOGGER.debug('SetSlice result: {:s}'.format(grpc_message_to_json_string(response)))
        return response

    @RETRY_DECORATOR
    def UnsetSlice(self, request: Slice) -> SliceId:
        LOGGER.debug('UnsetSlice request: {:s}'.format(grpc_message_to_json_string(request)))
        response = self.stub.UnsetSlice(request)
        LOGGER.debug('UnsetSlice result: {:s}'.format(grpc_message_to_json_string(response)))
        return response

    @RETRY_DECORATOR
    def RemoveSlice(self, request: SliceId) -> Empty:
        LOGGER.debug('RemoveSlice request: {:s}'.format(grpc_message_to_json_string(request)))
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ def main():
    global LOGGER # pylint: disable=global-statement

    log_level = get_log_level()
    logging.basicConfig(level=log_level)
    logging.basicConfig(level=log_level, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s")
    LOGGER = logging.getLogger(__name__)

    signal.signal(signal.SIGINT,  signal_handler)
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ def update_config(
    raw_config_rules : List[Tuple[ORM_ConfigActionEnum, str, str]]
) -> List[Tuple[Union[ConfigModel, ConfigRuleModel], bool]]:

    str_config_key = key_to_str([db_parent_pk, config_name], separator=':')
    str_config_key = key_to_str([config_name, db_parent_pk], separator=':')
    result : Tuple[ConfigModel, bool] = get_or_create_object(database, ConfigModel, str_config_key)
    db_config, created = result

+1 −1
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ def set_constraints(
    database : Database, db_parent_pk : str, constraints_name : str, grpc_constraints
) -> List[Tuple[Union[ConstraintsModel, ConstraintModel], bool]]:

    str_constraints_key = key_to_str([db_parent_pk, constraints_name], separator=':')
    str_constraints_key = key_to_str([constraints_name, db_parent_pk], separator=':')
    result : Tuple[ConstraintsModel, bool] = get_or_create_object(database, ConstraintsModel, str_constraints_key)
    db_constraints, created = result

Loading