diff --git a/src/device/service/drivers/nce/Constants.py b/src/device/service/drivers/nce/Constants.py index df66eb16b3d78c1b388a086011ed6f6b75b8099f..172c328aeaa5a2beafe4ced1b273cb3e7577e241 100644 --- a/src/device/service/drivers/nce/Constants.py +++ b/src/device/service/drivers/nce/Constants.py @@ -1,4 +1,4 @@ -# 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. diff --git a/src/device/service/drivers/nce/Tools.py b/src/device/service/drivers/nce/Tools.py index ba54beb360f25498497356b63015b7ed603e7a04..f9b2f24a8df494d04d749624ea6b2e5b986944fc 100644 --- a/src/device/service/drivers/nce/Tools.py +++ b/src/device/service/drivers/nce/Tools.py @@ -1,4 +1,4 @@ -# 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. diff --git a/src/device/service/drivers/nce/__init__.py b/src/device/service/drivers/nce/__init__.py index bbfc943b68af13a11e562abbc8680ade71db8f02..6242c89c7fa17bc5b6cc44328d8ce58438721d45 100644 --- a/src/device/service/drivers/nce/__init__.py +++ b/src/device/service/drivers/nce/__init__.py @@ -1,4 +1,4 @@ -# 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. diff --git a/src/device/service/drivers/nce/driver.py b/src/device/service/drivers/nce/driver.py index 003a0fabfdf384da61258159490b30929f46b3e4..4ac1a2b1c604a6ebe5028688dc39f545e0e1cee6 100644 --- a/src/device/service/drivers/nce/driver.py +++ b/src/device/service/drivers/nce/driver.py @@ -1,4 +1,4 @@ -# 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( diff --git a/src/device/service/drivers/nce/nce_fan_client.py b/src/device/service/drivers/nce/nce_fan_client.py index fd42ef96276f38217a1691607589c9f6bb33085e..1c3523427ab5818b650a5eeecafc098b1c55662e 100644 --- a/src/device/service/drivers/nce/nce_fan_client.py +++ b/src/device/service/drivers/nce/nce_fan_client.py @@ -1,4 +1,4 @@ -# 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)