summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-12-04 11:37:24 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-12-04 11:37:24 +0800
commit8a06725115e3c9892620cd11d6b4215c73d85af3 (patch)
tree23f023ff0d18997e11b1c3706c4e7fc67c615bb3
parent7bab11e3895646560fdd4c89e35aba47d4d61a5b (diff)
Fix vfc-lcm unit tests
Change-Id: I88b532e1a557ba9eba03adaf8052570bffb60b8c Issue-ID: VFC-602 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/ns/ns_instant.py6
-rw-r--r--lcm/ns/tests/tests_ns_terminate.py2
-rw-r--r--lcm/ns/tests/vnfs/tests.py16
3 files changed, 10 insertions, 14 deletions
diff --git a/lcm/ns/ns_instant.py b/lcm/ns/ns_instant.py
index 52418085..5c2d363c 100644
--- a/lcm/ns/ns_instant.py
+++ b/lcm/ns/ns_instant.py
@@ -87,11 +87,7 @@ class InstantNSService(object):
plan_dict = json.JSONDecoder().decode(dst_plan)
for vnf in ignore_case_get(plan_dict, "vnfs"):
vnfd_id = vnf['properties']['id']
- # vnfd = NfPackageModel.objects.get(vnfdid=vnfd_id)
- # vnfpackage_info = query_vnfpackage_by_id(vnfd_id)
- # vnfd_model = json.JSONDecoder().decode(ignore_case_get(vnfpackage_info["packageInfo"], "vnfdModel"))
- # vnfm_type = vnfd_model["metadata"].get("vnfmType", "ztevmanagerdriver")
- vnfm_type = vnf['properties'].get("nf_type", "ztevmanagerdriver")
+ vnfm_type = vnf['properties'].get("nf_type", "undefined")
vimid = self.get_vnf_vim_id(vim_id, location_constraints, vnfd_id)
vnfm_info = select_vnfm(vnfm_type=vnfm_type, vim_id=vimid)
params_vnf.append({
diff --git a/lcm/ns/tests/tests_ns_terminate.py b/lcm/ns/tests/tests_ns_terminate.py
index a39cb6ee..4a33105d 100644
--- a/lcm/ns/tests/tests_ns_terminate.py
+++ b/lcm/ns/tests/tests_ns_terminate.py
@@ -72,7 +72,7 @@ class TestTerminateNsViews(TestCase):
[0, json.JSONEncoder().encode({"jobId": self.job_id}), '200'],
"/api/nslcm/v1/ns/vnfs/1":
[0, json.JSONEncoder().encode({}), '200'],
- "/api/ztevmanagerdriver/v1/jobs/" + self.job_id + "&responseId=0":
+ "/api/ztevnfmdriver/v1/jobs/" + self.job_id + "&responseId=0":
[0, json.JSONEncoder().encode({"jobid": self.job_id,
"responsedescriptor": {"progress": "100",
"status": JOB_MODEL_STATUS.FINISHED,
diff --git a/lcm/ns/tests/vnfs/tests.py b/lcm/ns/tests/vnfs/tests.py
index b071a03f..4a898ba0 100644
--- a/lcm/ns/tests/vnfs/tests.py
+++ b/lcm/ns/tests/vnfs/tests.py
@@ -96,7 +96,7 @@ class TestCreateVnfViews(TestCase):
def test_create_vnf_thread(self, mock_call_req):
nf_inst_id, job_id = create_vnfs.prepare_create_params()
mock_vals = {
- "/api/ztevmanagerdriver/v1/1/vnfs":
+ "/api/ztevnfmdriver/v1/1/vnfs":
[0, json.JSONEncoder().encode({"jobId": self.job_id, "vnfInstanceId": 3}), '200'],
"/api/catalog/v1/vnfpackages/zte_vbras":
[0, json.JSONEncoder().encode(nf_package_info), '200'],
@@ -112,7 +112,7 @@ class TestCreateVnfViews(TestCase):
[0, json.JSONEncoder().encode(vim_info), '201'],
"/cloud-infrastructure/cloud-regions/cloud-region/zte/test/tenants/tenant/admin/vservers/vserver/1":
[0, json.JSONEncoder().encode({}), '201'],
- "/api/ztevmanagerdriver/v1/1/jobs/" + self.job_id + "?responseId=0":
+ "/api/ztevnfmdriver/v1/1/jobs/" + self.job_id + "?responseId=0":
[0, json.JSONEncoder().encode({"jobid": self.job_id,
"responsedescriptor": {"progress": "100",
"status": JOB_MODEL_STATUS.FINISHED,
@@ -243,7 +243,7 @@ class TestTerminateVnfViews(TestCase):
mock_vals = {
"/external-system/esr-vnfm-list/esr-vnfm/1?depth=all":
[0, json.JSONEncoder().encode(vnfm_info), '200'],
- "/api/ztevmanagerdriver/v1/1/vnfs/111/terminate":
+ "/api/ztevnfmdriver/v1/1/vnfs/111/terminate":
[0, json.JSONEncoder().encode({"jobId": job_id}), '200'],
"/api/resmgr/v1/vnf/1":
[0, json.JSONEncoder().encode({"jobId": job_id}), '200'],
@@ -253,7 +253,7 @@ class TestTerminateVnfViews(TestCase):
[0, json.JSONEncoder().encode(vserver_info), '201'],
"/cloud-infrastructure/cloud-regions/cloud-region/zte/test/tenants/tenant/admin/vservers/vserver/1?resource-version=1505465356263":
[0, json.JSONEncoder().encode({}), '200'],
- "/api/ztevmanagerdriver/v1/1/jobs/" + job_id + "?responseId=0":
+ "/api/ztevnfmdriver/v1/1/jobs/" + job_id + "?responseId=0":
[0, json.JSONEncoder().encode(job_info), '200'],
"/network/generic-vnfs/generic-vnf/1?depth=all":
[0, json.JSONEncoder().encode(vnf_info), '200'],
@@ -362,7 +362,7 @@ class TestScaleVnfViews(TestCase):
}
mock_vals = {
- "/api/ztevmanagerdriver/v1/1/vnfs/111/terminate":
+ "/api/ztevnfmdriver/v1/1/vnfs/111/terminate":
[0, json.JSONEncoder().encode({"jobId": job_id}), '200']
}
@@ -407,13 +407,13 @@ class TestHealVnfViews(TestCase):
def test_heal_vnf(self, mock_call_req):
mock_vals = {
- "/api/ztevmanagerdriver/v1/1/vnfs/111/heal":
+ "/api/ztevnfmdriver/v1/1/vnfs/111/heal":
[0, json.JSONEncoder().encode({"jobId": self.job_id}), '200'],
"/external-system/esr-vnfm-list/esr-vnfm/1":
[0, json.JSONEncoder().encode(vnfm_info), '200'],
"/api/resmgr/v1/vnf/1":
[0, json.JSONEncoder().encode({"jobId": self.job_id}), '200'],
- "/api/ztevmanagerdriver/v1/1/jobs/" + self.job_id + "?responseId=0":
+ "/api/ztevnfmdriver/v1/1/jobs/" + self.job_id + "?responseId=0":
[0, json.JSONEncoder().encode({"jobId": self.job_id,
"responsedescriptor": {"progress": "100",
"status": JOB_MODEL_STATUS.FINISHED,
@@ -1235,7 +1235,7 @@ vnfm_info = {
{
"esr-system-info-id": "example-esr-system-info-id-val-7713",
"system-name": "example-system-name-val-19801",
- "type": "ztevmanagerdriver",
+ "type": "ztevnfmdriver",
"vendor": "example-vendor-val-50079",
"version": "example-version-val-93146",
"service-url": "example-service-url-val-68090",