From 39c2b877126da78057a02030064b22452c51a3b9 Mon Sep 17 00:00:00 2001 From: Michal Chabiera Date: Tue, 22 Dec 2020 11:55:52 +0100 Subject: Check orchestration status during instantiation and deletion vFW_CNF_CDS usecase Check orchestration status during instantiation and deletion vFW_CNF_CDS usecase Issue-ID: INT-1658 Signed-off-by: Michal Chabiera Change-Id: Iffeda65393cea55a8108b91f282b7ee9d6e6f7c8 (cherry picked from commit 1e501466e21b774ccaadef19f4618decc0650001) --- heat/vFW_CNF_CDS/automation/README.md | 1 + heat/vFW_CNF_CDS/automation/delete.py | 8 ++++++++ heat/vFW_CNF_CDS/automation/instantiate.py | 8 ++++++++ heat/vFW_CNF_CDS/automation/vsp/.keep | 0 4 files changed, 17 insertions(+) create mode 100644 heat/vFW_CNF_CDS/automation/vsp/.keep (limited to 'heat/vFW_CNF_CDS/automation') diff --git a/heat/vFW_CNF_CDS/automation/README.md b/heat/vFW_CNF_CDS/automation/README.md index bbc9cdeb..e153cc68 100755 --- a/heat/vFW_CNF_CDS/automation/README.md +++ b/heat/vFW_CNF_CDS/automation/README.md @@ -16,3 +16,4 @@ 6. Run script `python create_k8s_region.py` in order to create **k8s cloud region** 7. Onboard **vFW** `python onboard.py` 8. Instantiate **vFW** `python instantiate.py` +9. Once test is done, **vFW** service instance can be deleted with `python delete.py` command diff --git a/heat/vFW_CNF_CDS/automation/delete.py b/heat/vFW_CNF_CDS/automation/delete.py index 435d04ae..c5ac334a 100755 --- a/heat/vFW_CNF_CDS/automation/delete.py +++ b/heat/vFW_CNF_CDS/automation/delete.py @@ -16,8 +16,10 @@ # ============LICENSE_END========================================================= import logging +from time import sleep from onapsdk.aai.business import Customer +from onapsdk.so.so_element import OrchestrationRequest from config import Config @@ -59,3 +61,9 @@ if not service_instance: logger.info("******** Delete Service %s *******", service_instance.instance_name) service_deletion = service_instance.delete() +status = None +while not (status == OrchestrationRequest.StatusEnum.COMPLETED + or status == OrchestrationRequest.StatusEnum.FAILED): + sleep(10) + status = service_deletion.status + logger.info(f"Orchestration status is: {status.value}") diff --git a/heat/vFW_CNF_CDS/automation/instantiate.py b/heat/vFW_CNF_CDS/automation/instantiate.py index 0316f113..fb461862 100755 --- a/heat/vFW_CNF_CDS/automation/instantiate.py +++ b/heat/vFW_CNF_CDS/automation/instantiate.py @@ -18,6 +18,7 @@ import logging import zipfile from io import BytesIO +from time import sleep from uuid import uuid4 import oyaml as yaml @@ -37,6 +38,7 @@ from onapsdk.so.instantiation import ( InstantiationParameter, VnfParameters, VfmoduleParameters) from onapsdk.sdc.service import Service from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project +from onapsdk.so.so_element import OrchestrationRequest logger = logging.getLogger("") logger.setLevel(logging.DEBUG) @@ -207,3 +209,9 @@ if not service_instance: service_instance_name=Config.SERVICE_INSTANCE_NAME, vnf_parameters=[vnf_params] ) + status = None + while not (status == OrchestrationRequest.StatusEnum.COMPLETED + or status == OrchestrationRequest.StatusEnum.FAILED): + sleep(10) + status = service_instantiation.status + logger.info(f"Orchestration status is: {status.value}") diff --git a/heat/vFW_CNF_CDS/automation/vsp/.keep b/heat/vFW_CNF_CDS/automation/vsp/.keep new file mode 100644 index 00000000..e69de29b -- cgit 1.2.3-korg