diff options
author | zhaoliping123 <zhaoliping@chinamobile.com> | 2020-05-08 18:33:20 +0800 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-05-08 13:30:33 +0000 |
commit | c981fa0f1062dcebd0f2fa01aff1ff58ecb302fc (patch) | |
tree | 6a9b6acd38c8b3a97f332831891e252dc4626e5c /test/vcpe_tosca/local | |
parent | 11689da07382ec3ba3a69a2531969d8b88ab1681 (diff) |
update vCPE local case
Issue-ID: INT-1355
Change-Id: I3172f1aacebc7f226472dac1259d35c50f520473
Signed-off-by: zhaoliping123 <zhaoliping@chinamobile.com>
Diffstat (limited to 'test/vcpe_tosca/local')
-rw-r--r-- | test/vcpe_tosca/local/vcpe_tosca_test.py | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/test/vcpe_tosca/local/vcpe_tosca_test.py b/test/vcpe_tosca/local/vcpe_tosca_test.py index 9db7657fa..e60d7bd79 100644 --- a/test/vcpe_tosca/local/vcpe_tosca_test.py +++ b/test/vcpe_tosca/local/vcpe_tosca_test.py @@ -92,8 +92,6 @@ class VcpeToscaTest(unittest.TestCase): 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 @@ class VcpeToscaTest(unittest.TestCase): 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 @@ class VcpeToscaTest(unittest.TestCase): 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 @@ class VcpeToscaTest(unittest.TestCase): 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) |