Loading src/common/tools/object_factory/Service.py +10 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,16 @@ def json_service_tapi_planned( status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints, config_rules=config_rules) def json_service_iplink_planned( service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [], config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME ): return json_service( service_uuid, ServiceTypeEnum.SERVICETYPE_PON_ACCESS, context_id=json_context_id(context_uuid), status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints, config_rules=config_rules) def json_service_p4_planned( service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [], config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME Loading src/common/type_checkers/Assertions.py +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ def validate_device_driver_enum(message): 'DEVICEDRIVER_IETF_ACTN', 'DEVICEDRIVER_OC', 'DEVICEDRIVER_QKD', 'DEVICEDRIVER_PON', ] def validate_device_operational_status_enum(message): Loading Loading @@ -107,6 +109,7 @@ def validate_service_type_enum(message): 'SERVICETYPE_E2E', 'SERVICETYPE_OPTICAL_CONNECTIVITY', 'SERVICETYPE_QKD', 'SERVICETYPE_PON_ACCESSs', ] def validate_service_state_enum(message): Loading Loading @@ -144,6 +147,7 @@ def validate_uuid(message, allow_empty=False): CONFIG_RULE_TYPES = { 'custom', 'acl', 'pon_access' } def validate_config_rule(message): assert isinstance(message, dict) Loading src/context/service/database/ConfigRule.py +4 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,10 @@ def compose_config_rules_data( _, _, endpoint_uuid = endpoint_get_uuid(config_rule.acl.endpoint_id, allow_random=False) rule_set_name = config_rule.acl.rule_set.name configrule_name = '{:s}:{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid, rule_set_name) elif kind == ConfigRuleKindEnum.PON_ACCESS: _, _, endpoint_uuid = endpoint_get_uuid(config_rule.pon_access.endpoint_id, allow_random=False) rule_set_name = config_rule.pon_access.rule_set.name configrule_name = '{:s}:{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid, rule_set_name) else: MSG = 'Name for ConfigRule({:s}) cannot be inferred '+\ '(device_uuid={:s}, service_uuid={:s}, slice_uuid={:s})' Loading src/context/service/database/Service.py +3 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,9 @@ def service_set(db_engine : Engine, messagebroker : MessageBroker, request : Ser if service_type is None and request.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: service_type = "OPTICAL_CONNECTIVITY" if service_type is None and request.service_type == ServiceTypeEnum.SERVICETYPE_PON_ACCESS : service_type = "PON_ACCESS" service_status = grpc_to_enum__service_status(request.service_status.service_status) now = datetime.datetime.now(datetime.timezone.utc) Loading src/context/service/database/models/ConfigRuleModel.py +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ from ._Base import _Base class ConfigRuleKindEnum(enum.Enum): CUSTOM = 'custom' ACL = 'acl' PON_ACCESS = 'pon_access' class DeviceConfigRuleModel(_Base): __tablename__ = 'device_configrule' Loading Loading
src/common/tools/object_factory/Service.py +10 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,16 @@ def json_service_tapi_planned( status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints, config_rules=config_rules) def json_service_iplink_planned( service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [], config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME ): return json_service( service_uuid, ServiceTypeEnum.SERVICETYPE_PON_ACCESS, context_id=json_context_id(context_uuid), status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints, config_rules=config_rules) def json_service_p4_planned( service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [], config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME Loading
src/common/type_checkers/Assertions.py +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ def validate_device_driver_enum(message): 'DEVICEDRIVER_IETF_ACTN', 'DEVICEDRIVER_OC', 'DEVICEDRIVER_QKD', 'DEVICEDRIVER_PON', ] def validate_device_operational_status_enum(message): Loading Loading @@ -107,6 +109,7 @@ def validate_service_type_enum(message): 'SERVICETYPE_E2E', 'SERVICETYPE_OPTICAL_CONNECTIVITY', 'SERVICETYPE_QKD', 'SERVICETYPE_PON_ACCESSs', ] def validate_service_state_enum(message): Loading Loading @@ -144,6 +147,7 @@ def validate_uuid(message, allow_empty=False): CONFIG_RULE_TYPES = { 'custom', 'acl', 'pon_access' } def validate_config_rule(message): assert isinstance(message, dict) Loading
src/context/service/database/ConfigRule.py +4 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,10 @@ def compose_config_rules_data( _, _, endpoint_uuid = endpoint_get_uuid(config_rule.acl.endpoint_id, allow_random=False) rule_set_name = config_rule.acl.rule_set.name configrule_name = '{:s}:{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid, rule_set_name) elif kind == ConfigRuleKindEnum.PON_ACCESS: _, _, endpoint_uuid = endpoint_get_uuid(config_rule.pon_access.endpoint_id, allow_random=False) rule_set_name = config_rule.pon_access.rule_set.name configrule_name = '{:s}:{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid, rule_set_name) else: MSG = 'Name for ConfigRule({:s}) cannot be inferred '+\ '(device_uuid={:s}, service_uuid={:s}, slice_uuid={:s})' Loading
src/context/service/database/Service.py +3 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,9 @@ def service_set(db_engine : Engine, messagebroker : MessageBroker, request : Ser if service_type is None and request.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: service_type = "OPTICAL_CONNECTIVITY" if service_type is None and request.service_type == ServiceTypeEnum.SERVICETYPE_PON_ACCESS : service_type = "PON_ACCESS" service_status = grpc_to_enum__service_status(request.service_status.service_status) now = datetime.datetime.now(datetime.timezone.utc) Loading
src/context/service/database/models/ConfigRuleModel.py +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ from ._Base import _Base class ConfigRuleKindEnum(enum.Enum): CUSTOM = 'custom' ACL = 'acl' PON_ACCESS = 'pon_access' class DeviceConfigRuleModel(_Base): __tablename__ = 'device_configrule' Loading