Loading src/common/type_checkers/Assertions.py +11 −5 Original line number Diff line number Diff line Loading @@ -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 --------------------------------------------------------------------------------------------------- Loading Loading @@ -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 Loading @@ -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 if 'endpoint_location' in message: #assert 'endpoint_location' in message # TODO: validate "endpoint_location" assert 'capabilities' in message pass if 'capabilities' in message: #assert 'capabilities' in message # TODO: validate "capabilities" pass def validate_component(component): assert isinstance(component, dict) Loading Loading
src/common/type_checkers/Assertions.py +11 −5 Original line number Diff line number Diff line Loading @@ -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 --------------------------------------------------------------------------------------------------- Loading Loading @@ -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 Loading @@ -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 if 'endpoint_location' in message: #assert 'endpoint_location' in message # TODO: validate "endpoint_location" assert 'capabilities' in message pass if 'capabilities' in message: #assert 'capabilities' in message # TODO: validate "capabilities" pass def validate_component(component): assert isinstance(component, dict) Loading