summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-08-16 09:07:58 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-08-16 15:03:59 +0800
commitebfb00fb5e70cdc919b910d91650446542088cea (patch)
treec5095e666d73c0666dd063ef5dcd63d070c9e592
parent098b7e99394fcbaaff005239a2143836c02b03e0 (diff)
Add aaiapi file in gvnfm vnflcm
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>
-rw-r--r--lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py4
-rw-r--r--lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py8
-rw-r--r--lcm/lcm/pub/aaiapi/__init__.py13
-rw-r--r--lcm/lcm/pub/aaiapi/aai.py16
-rw-r--r--lcm/lcm/pub/config/config.py5
5 files changed, 43 insertions, 3 deletions
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py b/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
index e4cf7d90..9bedab78 100644
--- a/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
+++ b/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
@@ -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.")
-"""
+'''
diff --git a/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
index c2afe07d..33eb7ded 100644
--- a/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
+++ b/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
@@ -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
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/pub/aaiapi/__init__.py
@@ -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
index 00000000..a512315e
--- /dev/null
+++ b/lcm/lcm/pub/aaiapi/aai.py
@@ -0,0 +1,16 @@
+# 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.
+
+def call_aai(full_url, method, req_data):
+ pass \ No newline at end of file
diff --git a/lcm/lcm/pub/config/config.py b/lcm/lcm/pub/config/config.py
index b965ae89..142a4a60 100644
--- a/lcm/lcm/pub/config/config.py
+++ b/lcm/lcm/pub/config/config.py
@@ -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'