aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Chabiera <michal.chabiera@orange.com>2020-12-22 11:55:52 +0100
committerMichal Chabiera <michal.chabiera@orange.com>2020-12-22 11:48:52 +0000
commit39c2b877126da78057a02030064b22452c51a3b9 (patch)
tree97a4a01b2ce1a2930f02e1f778aa07123aa5bca2
parent303fe3b4343838ae4c7b7a2511cb065f3abe7699 (diff)
Check orchestration status during instantiation and deletion vFW_CNF_CDS usecase7.0.1guilin
Check orchestration status during instantiation and deletion vFW_CNF_CDS usecase Issue-ID: INT-1658 Signed-off-by: Michal Chabiera <michal.chabiera@orange.com> Change-Id: Iffeda65393cea55a8108b91f282b7ee9d6e6f7c8 (cherry picked from commit 1e501466e21b774ccaadef19f4618decc0650001)
-rwxr-xr-xheat/vFW_CNF_CDS/automation/README.md1
-rwxr-xr-xheat/vFW_CNF_CDS/automation/delete.py8
-rwxr-xr-xheat/vFW_CNF_CDS/automation/instantiate.py8
-rw-r--r--heat/vFW_CNF_CDS/automation/vsp/.keep0
4 files changed, 17 insertions, 0 deletions
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
--- /dev/null
+++ b/heat/vFW_CNF_CDS/automation/vsp/.keep