diff --git a/src/common/type_checkers/Assertions.py b/src/common/type_checkers/Assertions.py index f241dc0fbb4c0197ba98f0f053bf13673365d2ce..cbe095396b0d5f8107c9c0efc703a03c7c11f7ec 100644 --- a/src/common/type_checkers/Assertions.py +++ b/src/common/type_checkers/Assertions.py @@ -15,6 +15,8 @@ import logging from typing import Callable, Dict +from common.tools.grpc.Tools import grpc_message_to_json_string + LOGGER = logging.getLogger(__name__) # ----- Enumerations --------------------------------------------------------------------------------------------------- @@ -472,7 +474,7 @@ def validate_topology(message, num_devices=None, num_links=None): def validate_endpoint(message): assert isinstance(message, dict) - assert len(message.keys()) == 6 + assert len(message.keys()) in {5, 6}, 'Wrong number of attributes: {:s}'.format(str(message)) assert 'endpoint_id' in message validate_endpoint_id(message['endpoint_id']) assert 'name' in message @@ -482,10 +484,14 @@ def validate_endpoint(message): assert 'kpi_sample_types' in message assert isinstance(message['kpi_sample_types'], list) for kpi_sample_type in message['kpi_sample_types']: validate_kpi_sample_types_enum(kpi_sample_type) - assert 'endpoint_location' in message - # TODO: validate "endpoint_location" - assert 'capabilities' in message - # TODO: validate "capabilities" + if 'endpoint_location' in message: + #assert 'endpoint_location' in message + # TODO: validate "endpoint_location" + pass + if 'capabilities' in message: + #assert 'capabilities' in message + # TODO: validate "capabilities" + pass def validate_component(component): assert isinstance(component, dict)