Skip to content
Snippets Groups Projects
Commit 17a045c0 authored by Leandro Campos's avatar Leandro Campos
Browse files

service

parent 86ee1b9f
No related branches found
No related tags found
1 merge request!327Draft: Resolve "(TID) New service type for PON Controller"
...@@ -82,6 +82,16 @@ def json_service_tapi_planned( ...@@ -82,6 +82,16 @@ def json_service_tapi_planned(
status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints, status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints,
config_rules=config_rules) 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( def json_service_p4_planned(
service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [], service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [],
config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME
......
...@@ -50,6 +50,8 @@ def validate_device_driver_enum(message): ...@@ -50,6 +50,8 @@ def validate_device_driver_enum(message):
'DEVICEDRIVER_IETF_ACTN', 'DEVICEDRIVER_IETF_ACTN',
'DEVICEDRIVER_OC', 'DEVICEDRIVER_OC',
'DEVICEDRIVER_QKD', 'DEVICEDRIVER_QKD',
'DEVICEDRIVER_PON',
] ]
def validate_device_operational_status_enum(message): def validate_device_operational_status_enum(message):
...@@ -107,6 +109,7 @@ def validate_service_type_enum(message): ...@@ -107,6 +109,7 @@ def validate_service_type_enum(message):
'SERVICETYPE_E2E', 'SERVICETYPE_E2E',
'SERVICETYPE_OPTICAL_CONNECTIVITY', 'SERVICETYPE_OPTICAL_CONNECTIVITY',
'SERVICETYPE_QKD', 'SERVICETYPE_QKD',
'SERVICETYPE_PON_ACCESSs',
] ]
def validate_service_state_enum(message): def validate_service_state_enum(message):
...@@ -144,6 +147,7 @@ def validate_uuid(message, allow_empty=False): ...@@ -144,6 +147,7 @@ def validate_uuid(message, allow_empty=False):
CONFIG_RULE_TYPES = { CONFIG_RULE_TYPES = {
'custom', 'custom',
'acl', 'acl',
'pon_access'
} }
def validate_config_rule(message): def validate_config_rule(message):
assert isinstance(message, dict) assert isinstance(message, dict)
......
...@@ -71,6 +71,10 @@ def compose_config_rules_data( ...@@ -71,6 +71,10 @@ def compose_config_rules_data(
_, _, endpoint_uuid = endpoint_get_uuid(config_rule.acl.endpoint_id, allow_random=False) _, _, endpoint_uuid = endpoint_get_uuid(config_rule.acl.endpoint_id, allow_random=False)
rule_set_name = config_rule.acl.rule_set.name 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) 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: else:
MSG = 'Name for ConfigRule({:s}) cannot be inferred '+\ MSG = 'Name for ConfigRule({:s}) cannot be inferred '+\
'(device_uuid={:s}, service_uuid={:s}, slice_uuid={:s})' '(device_uuid={:s}, service_uuid={:s}, slice_uuid={:s})'
......
...@@ -88,6 +88,9 @@ def service_set(db_engine : Engine, messagebroker : MessageBroker, request : Ser ...@@ -88,6 +88,9 @@ def service_set(db_engine : Engine, messagebroker : MessageBroker, request : Ser
service_type = grpc_to_enum__service_type(request.service_type) service_type = grpc_to_enum__service_type(request.service_type)
if service_type is None and request.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: if service_type is None and request.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY:
service_type = "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) service_status = grpc_to_enum__service_status(request.service_status.service_status)
......
...@@ -23,6 +23,7 @@ from ._Base import _Base ...@@ -23,6 +23,7 @@ from ._Base import _Base
class ConfigRuleKindEnum(enum.Enum): class ConfigRuleKindEnum(enum.Enum):
CUSTOM = 'custom' CUSTOM = 'custom'
ACL = 'acl' ACL = 'acl'
PON_ACCESS = 'pon_access'
class DeviceConfigRuleModel(_Base): class DeviceConfigRuleModel(_Base):
__tablename__ = 'device_configrule' __tablename__ = 'device_configrule'
......
...@@ -30,6 +30,7 @@ class ORM_ServiceTypeEnum(enum.Enum): ...@@ -30,6 +30,7 @@ class ORM_ServiceTypeEnum(enum.Enum):
E2E = ServiceTypeEnum.SERVICETYPE_E2E E2E = ServiceTypeEnum.SERVICETYPE_E2E
OPTICAL_CONNECTIVITY = ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY OPTICAL_CONNECTIVITY = ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY
QKD = ServiceTypeEnum.SERVICETYPE_QKD QKD = ServiceTypeEnum.SERVICETYPE_QKD
PON_ACCESS = ServiceTypeEnum.SERVICETYPE_PON_ACCESS
grpc_to_enum__service_type = functools.partial( grpc_to_enum__service_type = functools.partial(
grpc_to_enum, ServiceTypeEnum, ORM_ServiceTypeEnum) grpc_to_enum, ServiceTypeEnum, ORM_ServiceTypeEnum)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment