update vCPE local case

Issue-ID: INT-1355
Change-Id: I3172f1aacebc7f226472dac1259d35c50f520473
Signed-off-by: zhaoliping123 <zhaoliping@chinamobile.com>
diff --git a/docs/docs_vCPE_tosca_local.rst b/docs/docs_vCPE_tosca_local.rst
index 6ced77a..b2993cb 100644
--- a/docs/docs_vCPE_tosca_local.rst
+++ b/docs/docs_vCPE_tosca_local.rst
@@ -23,7 +23,7 @@
 ~~~~~~~~~~
 The use case has been automated by vcpe_tosca_test scripts. The followings are the main steps to run the use case in Integration lab environment:
 
-1) Install ONAP CLI environment, open_cli_product is onap-elalto.
+1) Install ONAP CLI environment, open_cli_product is onap-dublin.
 
 
 2) Prepare openstack test environment.
@@ -157,14 +157,14 @@
       modeling-etsicatalog: 1.0.5
       multicloud-framework: 1.5.1
       multicloud-windriver: 1.5.5
-      cli: onap-elalto
+      cli: onap-dublin
 
 
 Note
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1) You should create an image named image before running the test script, the name must be the same with image which is defined in vnf csar file.
 
-2) There are something wrong if you use the cli dublin, so please use elalto instead.
+2) You should install ONAP CLI before running the script.
 
 
 Known Issues and Workaround
diff --git a/test/vcpe_tosca/local/vcpe_tosca_test.py b/test/vcpe_tosca/local/vcpe_tosca_test.py
index 9db7657..e60d7bd 100644
--- a/test/vcpe_tosca/local/vcpe_tosca_test.py
+++ b/test/vcpe_tosca/local/vcpe_tosca_test.py
@@ -92,8 +92,6 @@
             print("Remove cloud %s" % self.config_params["cloud-owner"])
             self.delete_cloud_helper()
 
-        time.sleep(30)
-
         if self.complex_version:
             self.get_complex_resource_version()
             print("Remove complex %s" % self.config_params["complex_name"])
@@ -203,8 +201,23 @@
         multicloud_url = self.base_url + "/api/multicloud-titaniumcloud/v1/{}/{}" \
             .format(self.config_params["cloud-owner"], cloud_region)
         requests.delete(url=multicloud_url, headers=header, verify=False)
+        cloud_url = self.base_url + "/aai/v11/cloud-infrastructure/cloud-regions"
+        n = 60
+        while n > 0:
+            cloud_flag = False
+            cloud_list_response = requests.get(url=cloud_url, headers=self.aai_header, verify=False)
+            n = n - 1
+            if cloud_list_response.status_code == 200:
+                for cloud in (cloud_list_response.json()).get("cloud-region"):
+                    if cloud['cloud-owner'] == self.config_params["cloud-owner"]:
+                        cloud_flag = True
+                        break
+                if not cloud_flag:
+                    break
+                else:
+                    time.sleep(1)
         print("Multicloud-cloud-delete----successful")
-        self.customer_version = None
+        self.cloud_version = None
 
     def create_service_type(self):
         self.service_type_version = None
@@ -485,12 +498,19 @@
     def get_vnf_package(self):
         vnfdid_list = []
         for vnf_package_id in self.vnf_package_list:
-            vnf_package_url = self.base_url + '/api/vnfpkgm/v1/vnf_packages/%s' % vnf_package_id
-            vnf_resp = requests.get(vnf_package_url, verify=False)
-            if 200 == vnf_resp.status_code:
-                vnfdId = vnf_resp.json().get("vnfdId")
-                print("vnfdId is %s" % vnfdId)
-                vnfdid_list.append(vnfdId)
+            n = 60
+            while n > 0:
+                vnf_package_url = self.base_url + '/api/vnfpkgm/v1/vnf_packages/%s' % vnf_package_id
+                vnf_resp = requests.get(vnf_package_url, verify=False)
+                n = n - 1
+                if 200 == vnf_resp.status_code:
+                    vnfdId = vnf_resp.json().get("vnfdId")
+                    if vnfdId is None:
+                        time.sleep(1)
+                    else:
+                        print("vnfdId is %s" % vnfdId)
+                        vnfdid_list.append(vnfdId)
+                        break
         return vnfdid_list
 
     def getVnf(self, vnfs):
@@ -564,7 +584,6 @@
         print("Use csar file is uploaded by local")
         self.vnf_package_list = self.create_upload_vnf_package()
         self.assertIsNotNone(self.vnf_package_list)
-        time.sleep(60)
 
         self.ns_package_id = self.create_ns_package()
         self.assertIsNotNone(self.ns_package_id)