Commit 307e5ba1 authored by Shayan Hajipour's avatar Shayan Hajipour
Browse files

code polishing

parent 2594c23a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2025 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+1 −1
Original line number Diff line number Diff line
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2025 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+1 −1
Original line number Diff line number Diff line
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2025 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+5 −6
Original line number Diff line number Diff line
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2025 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -195,8 +195,10 @@ class NCEDriver(_Driver):
        self, resources: List[Tuple[str, Any]]
    ) -> List[Union[bool, Exception]]:
        results = []

        if len(resources) == 0:
            return results

        with self.__lock:
            for resource in resources:
                resource_key, resource_value = resource
@@ -215,13 +217,14 @@ class NCEDriver(_Driver):
                try:
                    resource_value = json.loads(resource_value)
                    if operation_type == "create":

                        self.nce.create_app_flow(resource_value)
                    elif operation_type == "delete":

                        app_flow_name = resource_value["huawei-nce-app-flow:app-flows"][
                            "app-flow"
                        ][0]["app-name"]
                        self.nce.delete_app_flow(app_flow_name)
                    LOGGER.debug(f"app_flow_datamodel {resource_value}")
                    results.append((resource_key, True))
                except Exception as e:  # pylint: disable=broad-except
                    LOGGER.exception(
@@ -244,10 +247,6 @@ class NCEDriver(_Driver):
                LOGGER.info("resource = {:s}".format(str(resource)))
                resource_key, resource_value = resource
                try:
                    # resource_value = json.loads(resource_value)
                    # service_uuid = resource_value["uuid"]
                    # if service_exists(self.__tfs_nbi_root, self.__auth, service_uuid):
                    #     self.tac.delete_connectivity_service(service_uuid)
                    results.append((resource_key, True))
                except Exception as e:  # pylint: disable=broad-except
                    LOGGER.exception(
+3 −1
Original line number Diff line number Diff line
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2025 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -71,6 +71,7 @@ class NCEClient:
            app_url = self._nce_fan_url + "/app-flows/apps"
            LOGGER.info(f'Creating app: {app_data} URL: {app_url}')
            requests.post(app_url, json=app_data, headers=HEADERS)

            app_flow_data = {
                "app-flow": app_flow_data["huawei-nce-app-flow:app-flows"]["app-flow"]
            }
@@ -85,6 +86,7 @@ class NCEClient:
            app_url = self._nce_fan_url + f"/app-flows/apps/application={app_flow_name}"
            LOGGER.info(f'Deleting app: {app_flow_name} URL: {app_url}')
            requests.delete(app_url)

            app_flow_url = self._nce_fan_url + f"/app-flows/app-flow={app_flow_name}"
            LOGGER.info(f'Deleting app flow: {app_flow_name} URL: {app_flow_url}')
            requests.delete(app_flow_url)