Add aaiapi file in gvnfm vnflcm 75/7675/2
authorying.yunlong <ying.yunlong@zte.com.cn>
Wed, 16 Aug 2017 01:07:58 +0000 (09:07 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Wed, 16 Aug 2017 07:03:59 +0000 (15:03 +0800)
Create aaiapi directory and new aai.py file
to implement call aai in the future.

Change-Id: I7236c299b2539c807f0e1092a4fbb0d8ebfd70bb
Issue-ID: VFC-98
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
lcm/lcm/pub/aaiapi/__init__.py [new file with mode: 0644]
lcm/lcm/pub/aaiapi/aai.py [new file with mode: 0644]
lcm/lcm/pub/config/config.py

index e4cf7d9..9bedab7 100644 (file)
@@ -97,7 +97,7 @@ class TestNFTerminate(TestCase):
         TermVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
         self.assert_job_result(self.job_id, 255, "VnfInst(%s) does not exist" % self.nf_inst_id)
     """
-"""
+'''
     @mock.patch.object(restcall, 'call_req')
     @mock.patch.object(api, 'call')
     def test_terminate_vnf_success(self, mock_call, mock_call_req):
@@ -117,4 +117,4 @@ class TestNFTerminate(TestCase):
         JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
         TermVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
         self.assert_job_result(self.job_id, 100, "Terminate Vnf success.")
-"""
+'''
index c2afe07..33eb7de 100644 (file)
@@ -13,8 +13,9 @@
 # limitations under the License.
 import logging
 
+from lcm.pub.aaiapi.aai import call_aai
+from lcm.pub.config.config import AAI_BASE_URL
 from lcm.pub.database.models import NfInstModel, NfvoRegInfoModel
-from lcm.pub.exceptions import NFLCMException
 
 logger = logging.getLogger(__name__)
 
@@ -34,3 +35,8 @@ class DeleteVnf:
         #    raise NFLCMException("Don't allow to delete vnf(status:[%s])" % sel_vnf.status)
         NfInstModel.objects.filter(nfinstid=self.nf_inst_id).delete()
         NfvoRegInfoModel.objects.filter(nfvoid=self.nf_inst_id).delete()
+
+    def delete_data_from_aai(self, req_data):
+        full_url = AAI_BASE_URL + "api/aai-service-design-and-creation/v1/%s" % self.nf_inst_id
+        del_result = call_aai(full_url, "DELETE", req_data)
+        pass
\ No newline at end of file
diff --git a/lcm/lcm/pub/aaiapi/__init__.py b/lcm/lcm/pub/aaiapi/__init__.py
new file mode 100644 (file)
index 0000000..c7b6818
--- /dev/null
@@ -0,0 +1,13 @@
+# Copyright 2017 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/lcm/lcm/pub/aaiapi/aai.py b/lcm/lcm/pub/aaiapi/aai.py
new file mode 100644 (file)
index 0000000..a512315
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright 2017 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+#         http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+\r
+def call_aai(full_url, method, req_data):\r
+    pass
\ No newline at end of file
index b965ae8..142a4a6 100644 (file)
@@ -17,6 +17,11 @@ import os
 MSB_SERVICE_IP = '127.0.0.1'
 MSB_SERVICE_PORT = '80'
 
+# [AAI]
+AAI_SERVICE_IP = '127.0.0.1'
+AAI_SERVICE_PORT = '8443'
+AAI_BASE_URL = "https://%s:%s/" % (AAI_SERVICE_IP, AAI_SERVICE_PORT)
+
 # [REDIS]
 REDIS_HOST = '127.0.0.1'
 REDIS_PORT = '6379'