Commit 5888b41d authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component - L3NM IETF Slice and NCE FAN:

- Corrected composition of DELETE config rules; was using service uuid instead of service name
parent 14b31a73
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -195,14 +195,15 @@ class L3NM_IETFSlice_ServiceHandler(_ServiceHandler):
                MSG = 'Unsupported number of Slices[{:d}]({:s})'
                raise Exception(MSG.format(len(running_slice), str(running_slice)))
            running_slice = running_slice[0]
            slice_name = running_slice['id']

            slice_data_model = {'network-slice-services': {'slice-service': [{
                'id': running_slice['id'],
                'id': slice_name,
            }]}}

            del controller.device_config.config_rules[:]
            controller.device_config.config_rules.append(ConfigRule(**json_config_rule_delete(
                '/service[{:s}]/IETFSlice'.format(service_uuid), slice_data_model
                '/service[{:s}]/IETFSlice'.format(slice_name), slice_data_model
            )))
            self.__task_executor.configure_device(controller)
            results.append(True)
+12 −12
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ from common.tools.object_factory.ConfigRule import (
)


def setup_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]:
def setup_config_rules(service_name: str, json_settings: Dict) -> List[Dict]:
    operation_type: str = json_settings["operation_type"]
    app_flow_id: str = json_settings["app_flow_id"]
    app_flow_user_id: str = json_settings["app_flow_user_id"]
@@ -96,17 +96,17 @@ def setup_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]:
    }
    json_config_rules = [
        json_config_rule_set(
            "/service[{:s}]/AppFlow".format(service_uuid), app_flow_datamodel
        ),
        json_config_rule_set(
            "/service[{:s}]/AppFlow/operation".format(service_uuid),
            {"type": operation_type},
            "/service[{:s}]/AppFlow".format(service_name), app_flow_datamodel
        ),
        #json_config_rule_set(
        #    "/service[{:s}]/AppFlow/operation".format(service_name),
        #    {"type": operation_type},
        #),
    ]
    return json_config_rules


def teardown_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]:
def teardown_config_rules(service_name: str, json_settings: Dict) -> List[Dict]:
    app_flow_id      : str = json_settings["app_flow_id"]
    application_name : str = f"App_Flow_{app_flow_id}"
    app_flow_name    : str = f"App_Flow_{app_flow_id}"
@@ -126,13 +126,13 @@ def teardown_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]:

    json_config_rules = [
        json_config_rule_delete(
            "/service[{:s}]/AppFlow".format(service_uuid),
            "/service[{:s}]/AppFlow".format(service_name),
            app_flow_datamodel
        ),
        json_config_rule_delete(
            "/service[{:s}]/AppFlow/operation".format(service_uuid),
            {},
        ),
        #json_config_rule_delete(
        #    "/service[{:s}]/AppFlow/operation".format(service_name),
        #    {},
        #),
    ]

    return json_config_rules
+1 −1
Original line number Diff line number Diff line
@@ -528,7 +528,7 @@ class L3NM_NCEFAN_ServiceHandler(_ServiceHandler):
            resource_value_dict = {
                "app_flow_id": f"{src_sdp_idx}_{dst_sdp_idx}_{service_name}",
            }
            json_config_rules = teardown_config_rules(service_uuid, resource_value_dict)
            json_config_rules = teardown_config_rules(service_name, resource_value_dict)
            if len(json_config_rules) > 0:
                del controller.device_config.config_rules[:]
                for json_config_rule in json_config_rules: