Commit b06cbae9 authored by Shayan Hajipour's avatar Shayan Hajipour
Browse files

debug:

- service id extraction from l3vpn data model in l3vpn driver fixed
- service id extraction from ietf slice data model in l3vpn service handler fixed
parent 3874e897
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -235,7 +235,6 @@ class IetfL3VpnDriver(_Driver):
                try:
                    resource_value = json.loads(resource_value)


                    # if service_exists(self.__tfs_nbi_root, self.__auth, service_uuid):
                    #     exc = NotImplementedError(
                    #         "IETF L3VPN Service Update is still not supported"
@@ -243,13 +242,17 @@ class IetfL3VpnDriver(_Driver):
                    #     results.append((resource[0], exc))
                    #     continue
                    if operation_type == "create":
                        service_id = resource_value["network-slice-services"]["slice-service"][0]["id"]
                        service_id = resource_value["ietf-l3vpn-svc:l3vpn-svc"][
                            "vpn-services"
                        ]["vpn-service"][0]["vpn-id"]
                        l3vpn_datamodel = create_l3vpn_datamodel(
                            service_id, resource_value, operation_type
                        )
                        self.tac.create_connectivity_service(l3vpn_datamodel)
                    elif operation_type == "update":
                        service_id = resource_value["network-slice-services"]["slice-service"][0]["id"]
                        service_id = resource_value["ietf-l3vpn-svc:l3vpn-svc"][
                            "vpn-services"
                        ]["vpn-service"][0]["vpn-id"]
                        l3vpn_datamodel = create_l3vpn_datamodel(
                            service_id, resource_value, operation_type
                        )
+15 −9
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
        if len(endpoints) < 2:
            return []
        results = []
        service_uuid = self.__service.service_id.service_uuid.uuid
        service_config = self.__service.service_config
        try:
            (
@@ -178,8 +177,6 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
                dst_endpoint_uuid,
                controller,
            ) = self.__find_IP_transport_edge_endpoints(endpoints)
            service_uuid = self.__service.service_id.service_uuid.uuid
            service_config = self.__service.service_config
            src_device_obj = self.__task_executor.get_device(
                DeviceId(**json_device_id(src_device_uuid))
            )
@@ -229,6 +226,7 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
            running_candidate_diff = get_running_candidate_ietf_slice_data_diff(
                service_config
            )
            service_id = candidate_resource_value_dict["network-slice-services"]["slice-service"][0]["id"]
            if not running_candidate_diff:
                operation_type = "create"
            elif "values_changed" in running_candidate_diff:
@@ -278,7 +276,7 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
            dst_pe_address = dst_ce_address
            dst_ce_address_prefix = dst_endpoint_settings["address_prefix"]
            resource_value_dict = {
                "uuid": service_uuid,
                "uuid": service_id,
                "src_device_name": src_device_name,
                "src_endpoint_name": src_endpoint_obj.name,
                "src_site_location": src_endpoint_settings["site_location"],
@@ -296,14 +294,14 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
                "dst_ce_pe_network_prefix": dst_ce_address_prefix,
                "dst_mtu": MTU,
            }
            json_config_rules = setup_config_rules(service_uuid, resource_value_dict, operation_type)
            json_config_rules = setup_config_rules(service_id, resource_value_dict, operation_type)
            del controller.device_config.config_rules[:]
            for jcr in json_config_rules:
                controller.device_config.config_rules.append(ConfigRule(**jcr))
            self.__task_executor.configure_device(controller)
        except Exception as e:  # pylint: disable=broad-except
            LOGGER.exception(
                "Unable to SetEndpoint for Service({:s})".format(str(service_uuid))
                "Unable to SetEndpoint for Service({:s})".format(str(service_id))
            )
            results.append(e)

@@ -319,7 +317,15 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
        if len(endpoints) < 2:
            return []

        service_uuid = self.__service.service_id.service_uuid.uuid
        service_config = self.__service.service_config

        ietf_slice_candidate_cr = get_custom_config_rule(
            service_config, CANDIDATE_RESOURCE_KEY
        )
        candidate_resource_value_dict = json.loads(
            ietf_slice_candidate_cr.custom.resource_value
        )
        service_id = candidate_resource_value_dict["network-slice-services"]["slice-service"][0]["id"]

        results = []
        try:
@@ -342,7 +348,7 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
            controller = src_controller

            json_config_rule = json_config_rule_delete(
                "/services/service[{:s}]".format(service_uuid), {"uuid": service_uuid}
                "/services/service[{:s}]".format(service_id), {"uuid": service_id}
            )
            del controller.device_config.config_rules[:]
            controller.device_config.config_rules.append(ConfigRule(**json_config_rule))
@@ -350,7 +356,7 @@ class L3NM_IETFL3VPN_ServiceHandler(_ServiceHandler):
            results.append(True)
        except Exception as e:  # pylint: disable=broad-except
            LOGGER.exception(
                "Unable to DeleteEndpoint for Service({:s})".format(str(service_uuid))
                "Unable to DeleteEndpoint for Service({:s})".format(str(service_id))
            )
            results.append(e)