diff --git a/src/common/tools/object_factory/Service.py b/src/common/tools/object_factory/Service.py index ab399adbe734adeb55f60c804aea0e4877072316..5ba01274f016c52c396d510465e258e6553b6871 100644 --- a/src/common/tools/object_factory/Service.py +++ b/src/common/tools/object_factory/Service.py @@ -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 diff --git a/src/common/type_checkers/Assertions.py b/src/common/type_checkers/Assertions.py index 70f5c4220252a3515eab017c1c332af99b082813..403b120b708bf87756cc45871a76c683779c1a40 100644 --- a/src/common/type_checkers/Assertions.py +++ b/src/common/type_checkers/Assertions.py @@ -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): @@ -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): @@ -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) diff --git a/src/context/service/database/ConfigRule.py b/src/context/service/database/ConfigRule.py index 4074eb9c01032612a272fdd80ebd6041c3f0a8ea..d5c6f50024b0a8700cfb7dbeb046470f9500d5fb 100644 --- a/src/context/service/database/ConfigRule.py +++ b/src/context/service/database/ConfigRule.py @@ -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})' diff --git a/src/context/service/database/Service.py b/src/context/service/database/Service.py index 62f07e4fbe4f90af7834358cc79d4c8cb82934f4..c4235baa8dceea84ab8e6bf90a931534502770b4 100644 --- a/src/context/service/database/Service.py +++ b/src/context/service/database/Service.py @@ -88,6 +88,9 @@ def service_set(db_engine : Engine, messagebroker : MessageBroker, request : Ser service_type = grpc_to_enum__service_type(request.service_type) 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) diff --git a/src/context/service/database/models/ConfigRuleModel.py b/src/context/service/database/models/ConfigRuleModel.py index 029aa6867349e10eb56546ce65d2541065ec6a6f..03e882d98f706ef5efde44eeac10ac1cf3aa8cf2 100644 --- a/src/context/service/database/models/ConfigRuleModel.py +++ b/src/context/service/database/models/ConfigRuleModel.py @@ -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' diff --git a/src/context/service/database/models/enums/ServiceType.py b/src/context/service/database/models/enums/ServiceType.py index 45f849a2643a328284e200f1718b02191fab9563..de96b7c7a86d18c69884eb23cc7d9a7faff5fac1 100644 --- a/src/context/service/database/models/enums/ServiceType.py +++ b/src/context/service/database/models/enums/ServiceType.py @@ -30,6 +30,7 @@ class ORM_ServiceTypeEnum(enum.Enum): E2E = ServiceTypeEnum.SERVICETYPE_E2E OPTICAL_CONNECTIVITY = ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY QKD = ServiceTypeEnum.SERVICETYPE_QKD + PON_ACCESS = ServiceTypeEnum.SERVICETYPE_PON_ACCESS grpc_to_enum__service_type = functools.partial( grpc_to_enum, ServiceTypeEnum, ORM_ServiceTypeEnum)