diff options
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | zte/vmanager/docker/Dockerfile | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/docker/build_image.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/docker/docker-entrypoint.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/docker/instance_config.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/docker/instance_init.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/docker/instance_run.sh | 0 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/tests.py | 50 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/views.py | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/initialize.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/run.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | zte/vmanager/stop.sh | 0 |
12 files changed, 40 insertions, 36 deletions
@@ -25,7 +25,7 @@ <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> - <name>vfc/nfvo/driver/vnfm/svnfm</name> + <name>vfc-nfvo-driver-vnfm-svnfm</name> <description>vfc-nfvo-driver-vnfm-svnfm</description> <modules> <module>zte</module> diff --git a/zte/vmanager/docker/Dockerfile b/zte/vmanager/docker/Dockerfile index b0248074..db1c6c9f 100644 --- a/zte/vmanager/docker/Dockerfile +++ b/zte/vmanager/docker/Dockerfile @@ -23,7 +23,7 @@ ADD . /service WORKDIR /service # get binary zip from nexus - vfc-nfvo-driver-vnfm-svnfm-zte-vmanager -RUN wget -q -O vfc-nfvo-driver-vnfm-svnfm-zte-vmanager.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vfc.nfvo.driver.vnfm.svnfm&a=vfc-nfvo-driver-vnfm-svnfm-zte-vmanager&v=LATEST&e=zip' && \ +RUN wget -q -O vfc-nfvo-driver-vnfm-svnfm-zte-vmanager.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vfc.nfvo.driver.vnfm.svnfm.zte.vmanager&a=vfc-nfvo-driver-vnfm-svnfm-zte-vmanager&v=LATEST&e=zip' && \ unzip vfc-nfvo-driver-vnfm-svnfm-zte-vmanager.zip && \ rm -rf vfc-nfvo-driver-vnfm-svnfm-zte-vmanager.zip diff --git a/zte/vmanager/docker/build_image.sh b/zte/vmanager/docker/build_image.sh index 9bf3b60a..9bf3b60a 100644..100755 --- a/zte/vmanager/docker/build_image.sh +++ b/zte/vmanager/docker/build_image.sh diff --git a/zte/vmanager/docker/docker-entrypoint.sh b/zte/vmanager/docker/docker-entrypoint.sh index ef779a44..ef779a44 100644..100755 --- a/zte/vmanager/docker/docker-entrypoint.sh +++ b/zte/vmanager/docker/docker-entrypoint.sh diff --git a/zte/vmanager/docker/instance_config.sh b/zte/vmanager/docker/instance_config.sh index d4169a31..d4169a31 100644..100755 --- a/zte/vmanager/docker/instance_config.sh +++ b/zte/vmanager/docker/instance_config.sh diff --git a/zte/vmanager/docker/instance_init.sh b/zte/vmanager/docker/instance_init.sh index a9bf588e..a9bf588e 100644..100755 --- a/zte/vmanager/docker/instance_init.sh +++ b/zte/vmanager/docker/instance_init.sh diff --git a/zte/vmanager/docker/instance_run.sh b/zte/vmanager/docker/instance_run.sh index 777fb40e..777fb40e 100644..100755 --- a/zte/vmanager/docker/instance_run.sh +++ b/zte/vmanager/docker/instance_run.sh diff --git a/zte/vmanager/driver/interfaces/tests.py b/zte/vmanager/driver/interfaces/tests.py index cebc8c51..daacdb6a 100644 --- a/zte/vmanager/driver/interfaces/tests.py +++ b/zte/vmanager/driver/interfaces/tests.py @@ -27,9 +27,9 @@ class InterfacesTest(TestCase): def tearDown(self): pass - @mock.patch.object(restcall, 'call_req_aai') + # @mock.patch.object(restcall, 'call_req_aai') @mock.patch.object(restcall, 'call_req') - def test_instantiate_vnf_001(self, mock_call_req, mock_call_req_aai): + def test_instantiate_vnf_001(self, mock_call_req): """ Initate_VNF """ @@ -109,8 +109,8 @@ class InterfacesTest(TestCase): r3 = [0, json.JSONEncoder().encode(packageInfo), "200"] - mock_call_req_aai.side_effect =[r1] - mock_call_req.side_effect = [r2, r3, ret] + # mock_call_req_aai.side_effect =[r1] + mock_call_req.side_effect = [r1, r2, r3, ret] req_data = {'vnfInstanceName': 'VFW_f88c0cb7-512a-44c4-bd09-891663f19367', 'vnfPackageId': 'd852e1be-0aac-48f1-b1a4-cd825f6cdf9a', @@ -131,9 +131,9 @@ class InterfacesTest(TestCase): expect_resp_data = {"jobid": "NF-CREATE-8-b384535c-9f45-11e6-8749-fa163e91c2f9", "vnfInstanceId": "8"} self.assertEqual(expect_resp_data, response.data) - @mock.patch.object(restcall, 'call_req_aai') + # @mock.patch.object(restcall, 'call_req_aai') @mock.patch.object(restcall, 'call_req') - def test_terminate_vnf__002(self, mock_call_req, mock_call_req_aai): + def test_terminate_vnf__002(self, mock_call_req): """ Terminate_VNF """ @@ -152,8 +152,8 @@ class InterfacesTest(TestCase): "createTime": "2016-07-06 15:33:18"}), "200"] r2 = [0, json.JSONEncoder().encode({"vnfInstanceId": "1", "JobId": "1"}), "200"] - mock_call_req_aai.side_effect = [r1] - mock_call_req.side_effect = [r2] + # mock_call_req_aai.side_effect = [r1] + mock_call_req.side_effect = [r1, r2] response = self.client.post("/api/ztevmanagerdriver/v1/ztevnfmid/vnfs/vbras_innstance_id/terminate") @@ -161,9 +161,9 @@ class InterfacesTest(TestCase): expect_resp_data = {"jobid": "1", "vnfInstanceId": "1"} self.assertEqual(expect_resp_data, response.data) - @mock.patch.object(restcall, 'call_req_aai') + # @mock.patch.object(restcall, 'call_req_aai') @mock.patch.object(restcall, 'call_req') - def test_query_vnf_003(self, mock_call_req, mock_call_req_aai): + def test_query_vnf_003(self, mock_call_req): """ Query_VNF """ @@ -182,8 +182,8 @@ class InterfacesTest(TestCase): "createTime": "2016-07-06 15:33:18"}), "200"] r2 = [0, json.JSONEncoder().encode({"vnfinstancestatus": "1"}), "200"] - mock_call_req_aai.side_effect = [r1] - mock_call_req.side_effect = [r2] + # mock_call_req_aai.side_effect = [r1] + mock_call_req.side_effect = [r1, r2] response = self.client.get("/api/ztevmanagerdriver/v1/ztevnfmid/vnfs/vbras_innstance_id") @@ -192,9 +192,9 @@ class InterfacesTest(TestCase): expect_resp_data = {"vnfInfo": {"vnfStatus": "1"}} self.assertEqual(expect_resp_data, response.data) - @mock.patch.object(restcall, 'call_req_aai') + # @mock.patch.object(restcall, 'call_req_aai') @mock.patch.object(restcall, 'call_req') - def test_operation_status_004(self, mock_call_req, mock_call_req_aai): + def test_operation_status_004(self, mock_call_req): """ Operation_status """ @@ -224,8 +224,8 @@ class InterfacesTest(TestCase): "jobid": "NF-CREATE-11-ec6c2f2a-9f48-11e6-9405-fa163e91c2f9"} r1 = [0, json.JSONEncoder().encode(vnfm_info), '200'] r2 = [0, json.JSONEncoder().encode(resp_body), '200'] - mock_call_req_aai.side_effect = [r1] - mock_call_req.side_effect = [r2] + # mock_call_req_aai.side_effect = [r1] + mock_call_req.side_effect = [r1, r2] response = self.client.get("/api/ztevmanagerdriver/v1/{vnfmid}/jobs/{jobid}?responseId={responseId}". format( vnfmid=vnfm_info["vnfmId"], @@ -338,9 +338,9 @@ class InterfacesTest(TestCase): expect_resp_data = None self.assertEqual(expect_resp_data, response.data) - @mock.patch.object(restcall, 'call_req_aai') + # @mock.patch.object(restcall, 'call_req_aai') @mock.patch.object(restcall, 'call_req') - def test_scale(self, mock_call_req, mock_call_req_aai): + def test_scale(self, mock_call_req): job_info = {"jobid":"801","nfInstanceId":"101"} vnfm_info = {u'userName': u'admin', u'vendor': u'ZTE', @@ -357,8 +357,8 @@ class InterfacesTest(TestCase): ret = [0, json.JSONEncoder().encode(job_info), "202"] ret_vnfm = [0,json.JSONEncoder().encode(vnfm_info), "200"] - mock_call_req_aai.side_effect = [ret_vnfm] - mock_call_req.side_effect = [ret] + # mock_call_req_aai.side_effect = [ret_vnfm] + mock_call_req.side_effect = [ret_vnfm, ret] vnfd_info = { "vnf_flavours":[ @@ -416,9 +416,9 @@ class InterfacesTest(TestCase): self.assertEqual(str(status.HTTP_202_ACCEPTED), response.status_code) self.assertDictEqual(job_info, response.data) - @mock.patch.object(restcall, 'call_req_aai') + # @mock.patch.object(restcall, 'call_req_aai') @mock.patch.object(restcall, 'call_req') - def test_heal(self, mock_call_req, mock_call_req_aai): + def test_heal(self, mock_call_req): job_info = {"jobid": "12234455", "nfInstanceId": "10144445666"} vnfm_info = {u'userName': u'admin', u'vendor': u'ZTE', @@ -435,8 +435,8 @@ class InterfacesTest(TestCase): ret = [0, json.JSONEncoder().encode(job_info), "202"] ret_vnfm = [0, json.JSONEncoder().encode(vnfm_info), "200"] - mock_call_req_aai.side_effect = [ret_vnfm] - mock_call_req.side_effect = [ret] + # mock_call_req_aai.side_effect = [ret_vnfm] + mock_call_req.side_effect = [ret_vnfm, ret] heal_vnf_data = { 'action': 'vmReset', @@ -458,4 +458,4 @@ class InterfacesTest(TestCase): data=json.dumps(heal_vnf_data), content_type='application/json') self.assertEqual(str(status.HTTP_202_ACCEPTED), response.status_code) - self.assertDictEqual(job_info, response.data)
\ No newline at end of file + self.assertDictEqual(job_info, response.data) diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py index dc94f838..3f4a4baf 100644 --- a/zte/vmanager/driver/interfaces/views.py +++ b/zte/vmanager/driver/interfaces/views.py @@ -55,18 +55,22 @@ query_vnfd_url = "api/nslcm/v1/vnfpackage/%s" query_vnfm_url = "api/extsys/v1/vnfms/%s" query_package_url = "api/nslcm/v1/vnfpackage/%s" +#Query vnfm_info from nslcm +def get_vnfminfo_from_nslcm(vnfmid): + ret = req_by_msb("api/nslcm/v1/vnfms/%s" % vnfmid, "GET") + return ret -# Query VNFM by VNFMID +# Query vnfm_info from esr def vnfm_get(vnfmid): ret = call_aai("api/aai-esr-server/v1/vnfms/%s" % vnfmid, "GET") return ret - +# Query vnfd_info from nslcm def vnfd_get(vnfpackageid): ret = req_by_msb("api/nslcm/v1/vnfpackage/%s" % vnfpackageid, "GET") return ret - +# Query vnfpackage_info from nslcm def vnfpackage_get(csarid): ret = req_by_msb("api/nslcm/v1/vnfpackage/%s" % csarid, "GET") return ret @@ -95,7 +99,7 @@ def instantiate_vnf(request, *args, **kwargs): try: logger.debug("[%s] request.data=%s", fun_name(), request.data) vnfm_id = ignorcase_get(kwargs, "vnfmid") - ret = vnfm_get(vnfm_id) + ret = get_vnfminfo_from_nslcm(vnfm_id) if ret[0] != 0: return Response(data={'error': ret[1]}, status=ret[2]) vnfm_info = json.JSONDecoder().decode(ret[1]) @@ -179,7 +183,7 @@ def terminate_vnf(request, *args, **kwargs): try: logger.debug("[%s] request.data=%s", fun_name(), request.data) vnfm_id = ignorcase_get(kwargs, "vnfmid") - ret = vnfm_get(vnfm_id) + ret = get_vnfminfo_from_nslcm(vnfm_id) if ret[0] != 0: return Response(data={'error': ret[1]}, status=ret[2]) vnfm_info = json.JSONDecoder().decode(ret[1]) @@ -218,7 +222,7 @@ def query_vnf(request, *args, **kwargs): try: logger.debug("[%s] request.data=%s", fun_name(), request.data) vnfm_id = ignorcase_get(kwargs, "vnfmid") - ret = vnfm_get(vnfm_id) + ret = get_vnfminfo_from_nslcm(vnfm_id) if ret[0] != 0: return Response(data={'error': ret[1]}, status=ret[2]) vnfm_info = json.JSONDecoder().decode(ret[1]) @@ -263,7 +267,7 @@ def operation_status(request, *args, **kwargs): try: logger.debug("[%s] request.data=%s", fun_name(), request.data) vnfm_id = ignorcase_get(kwargs, "vnfmid") - ret = vnfm_get(vnfm_id) + ret = get_vnfminfo_from_nslcm(vnfm_id) if ret[0] != 0: return Response(data={'error': ret[1]}, status=ret[2]) vnfm_info = json.JSONDecoder().decode(ret[1]) @@ -436,7 +440,7 @@ def scale(request, *args, **kwargs): logger.info("requested_url = %s", request.get_full_path()) vnfm_id = ignorcase_get(kwargs, "vnfmid") nf_instance_id = ignorcase_get(kwargs, "vnfInstanceId") - ret = vnfm_get(vnfm_id) + ret = get_vnfminfo_from_nslcm(vnfm_id) if ret[0] != 0: return Response(data={'error': ret[1]}, status=ret[2]) vnfm_info = json.JSONDecoder().decode(ret[1]) @@ -491,7 +495,7 @@ def heal(request, *args, **kwargs): logger.info("requested_url = %s", request.get_full_path()) vnfm_id = ignorcase_get(kwargs, "vnfmid") nf_instance_id = ignorcase_get(kwargs, "vnfInstanceId") - ret = vnfm_get(vnfm_id) + ret = get_vnfminfo_from_nslcm(vnfm_id) if ret[0] != 0: return Response(data={'error': ret[1]}, status=ret[2]) vnfm_info = json.JSONDecoder().decode(ret[1]) diff --git a/zte/vmanager/initialize.sh b/zte/vmanager/initialize.sh index ec0c5137..ec0c5137 100644..100755 --- a/zte/vmanager/initialize.sh +++ b/zte/vmanager/initialize.sh diff --git a/zte/vmanager/run.sh b/zte/vmanager/run.sh index 4ed4445b..4ed4445b 100644..100755 --- a/zte/vmanager/run.sh +++ b/zte/vmanager/run.sh diff --git a/zte/vmanager/stop.sh b/zte/vmanager/stop.sh index a4f5c8a0..a4f5c8a0 100644..100755 --- a/zte/vmanager/stop.sh +++ b/zte/vmanager/stop.sh |