Merge "Eliminate appx 350 Sphinx Warnings"
authorFu Jinhua <fu.jinhua@zte.com.cn>
Tue, 7 Aug 2018 08:12:21 +0000 (08:12 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 7 Aug 2018 08:12:21 +0000 (08:12 +0000)
28 files changed:
assembly.xml
docker/Dockerfile
lcm/ns/ns_instant.py
lcm/ns/tests/test_ns_instant.py
lcm/ns/views.py
lcm/ns/vnfs/serializers.py
lcm/ns/vnfs/views.py
lcm/packages/nf_package.py [deleted file]
lcm/packages/ns_package.py [deleted file]
lcm/packages/sdc_nf_package.py [deleted file]
lcm/packages/tests/test_nf.py [deleted file]
lcm/packages/tests/test_ns.py [deleted file]
lcm/packages/tests/test_sdc_nf.py [deleted file]
lcm/packages/urls.py [deleted file]
lcm/packages/views.py [deleted file]
lcm/pub/utils/toscaparser/__init__.py [deleted file]
lcm/pub/utils/toscaparser/basemodel.py [deleted file]
lcm/pub/utils/toscaparser/dataentityext.py [deleted file]
lcm/pub/utils/toscaparser/nsdmodel.py [deleted file]
lcm/pub/utils/toscaparser/vnfdmodel.py [deleted file]
lcm/pub/utils/toscautil.py [deleted file]
lcm/pub/utils/toscautil_new.py [deleted file]
lcm/settings.py
lcm/swagger/management/__init__.py [moved from lcm/packages/__init__.py with 94% similarity]
lcm/swagger/management/commands/__init__.py [moved from lcm/packages/tests/__init__.py with 94% similarity]
lcm/swagger/management/commands/export_swagger.py [new file with mode: 0644]
lcm/urls.py
static/catalog/empty.txt [deleted file]

index 5e7aef7..24979fb 100644 (file)
                 <include>Dockerfile</include>
             </includes>
         </fileSet>
-        <fileSet>
-            <directory>static</directory>
-            <outputDirectory>/static</outputDirectory>
-            <includes>
-                <include>**/*.txt</include>
-            </includes>
-        </fileSet>
         <fileSet>
             <directory>resources</directory>
             <outputDirectory>/resources</outputDirectory>
index 1911a26..72a366e 100755 (executable)
@@ -6,6 +6,9 @@ ARG HTTPS_PROXY=${HTTPS_PROXY}
 ENV http_proxy $HTTP_PROXY
 ENV https_proxy $HTTPS_PROXY
 
+RUN sed -i "s|set compatible|set nocompatible|" /etc/vim/vimrc.tiny
+RUN echo "set backspace=2" >> /etc/vim/vimrc.tiny
+
 RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
 RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
 
index 41c9bf3..b10b9c1 100644 (file)
@@ -26,11 +26,10 @@ from lcm.pub.database.models import NSInstModel, VNFFGInstModel, WFPlanModel
 from lcm.pub.exceptions import NSLCMException
 from lcm.pub.msapi import activiti
 from lcm.pub.msapi import sdc_run_catalog
-from lcm.pub.msapi.catalog import get_process_id, query_rawdata_from_catalog
+from lcm.pub.msapi.catalog import get_process_id
 from lcm.pub.msapi.catalog import get_servicetemplate_id, get_servicetemplate
 from lcm.pub.msapi.extsys import select_vnfm
 from lcm.pub.msapi.wso2bpel import workflow_run
-from lcm.pub.utils import toscautil
 from lcm.pub.utils.jobutil import JobUtil
 from lcm.pub.utils.values import ignore_case_get
 from lcm.workflows import build_in
@@ -71,13 +70,8 @@ class InstantNSService(object):
                 location_constraints = self.req_data['locationConstraints']
 
             JobUtil.add_job_status(job_id, 5, 'Start query nsd(%s)' % ns_inst.nspackage_id)
-            dst_plan = None
-            if WORKFLOW_OPTION == "wso2":
-                src_plan = query_rawdata_from_catalog(ns_inst.nspackage_id, input_parameters)
-                dst_plan = toscautil.convert_nsd_model(src_plan["rawData"])
-            else:
-                dst_plan = sdc_run_catalog.parse_nsd(ns_inst.nspackage_id, input_parameters)
-            logger.debug('tosca plan dest:%s' % dst_plan)
+            dst_plan = sdc_run_catalog.parse_nsd(ns_inst.nspackage_id, input_parameters)
+            logger.debug('tosca plan dest: %s' % dst_plan)
 
             NSInstModel.objects.filter(id=self.ns_inst_id).update(nsd_model=dst_plan)
 
index 6e50cb6..ff9d1be 100644 (file)
@@ -28,37 +28,3 @@ class TestNsInstant(TestCase):
 
     def tearDown(self):
         pass
-
-    """
-    @mock.patch.object(restcall, 'call_req')
-    @mock.patch.object(toscautil, 'convert_nsd_model')
-    def test_ns_instant_ok(self, mock_convert_nsd_model, mock_call_req):
-        mock_convert_nsd_model.return_value = self.context
-        mock_vals = {
-            "/api/catalog/v1/csars/7/files?relativePath=abc.yaml":
-                [0, '{"downloadUri":"http://test.yaml", "localPath":"./test.yaml"}', '200'],
-            "/api/tosca/v1/indirect/plan":
-                [0, '{"description":"", "metadata":{}, "nodes":[]}', '200'],
-            "/api/catalog/v1/servicetemplates/2/operations":
-                [0, '[{"name":"LCM", "processId":"{http://www.open-o.org/tosca/nfv/2015/12}init-16"}]', '200'],
-            "/api/wso2bpel/v1/process/instance":
-                [0, '{"status": 1}', '200']}
-
-        def side_effect(*args):
-            return mock_vals[args[4]]
-
-        mock_call_req.side_effect = side_effect
-
-        data = {'iaUrl': "", 'vnfmId': "", 'context': "{\"e\":{\"f\":\"4\"}}", 'statusUrl': "",
-                'serviceTemplateId': "", 'roUrl': "", 'containerapiUrl': "", 'flavor': "",
-                'nsInstanceId': "123", 'instanceId': "234", 'resourceUrl': "", 'callbackId': "",
-                'additionalParamForVnf': "[{\"b\":1},{\"c\":{\"d\":\"2\"}}]",
-                'additionalParamForNs': "[{\"a\":3},{\"e\":{\"f\":\"4\"}}]", 'flavorParams': ""}
-        resp = self.client.post("/api/nslcm/v1/ns/123/instantiate", data, format='json')
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-
-
-    def test_swagger_ok(self):
-        resp = self.client.get("/api/nslcm/v1/swagger.json", format='json')
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-    """
index 11e3718..413a89a 100644 (file)
@@ -114,10 +114,10 @@ class NSInstView(APIView):
     )
     def post(self, request, ns_instance_id):
         logger.debug("Enter NSInstView::post::ns_instance_id=%s", ns_instance_id)
-        req_serializer = InstantNsReqSerializer(data=request.data)
-        if not req_serializer.is_valid():
-        # return Response({'error': req_serializer.errors},
-        # status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+        req_serializer = InstantNsReqSerializer(data=request.data)
+        if not req_serializer.is_valid():
+            return Response({'error': req_serializer.errors},
+                            status=status.HTTP_500_INTERNAL_SERVER_ERROR)
         ack = InstantNSService(ns_instance_id, request.data).do_biz()
         resp_serializer = NsOperateJobSerializer(data=ack['data'])
         if not resp_serializer.is_valid():
index ae32d2f..652cf7e 100644 (file)
@@ -203,9 +203,9 @@ class VnfmInfoRespSerializer(serializers.Serializer):
     version = serializers.CharField(help_text="Version of VNFM", required=False, allow_null=True, allow_blank=True)
     description = serializers.CharField(help_text="Description of VNFM", required=False, allow_null=True, allow_blank=True)
     certificateUrl = serializers.CharField(help_text="Certificate PEM of VNFM", required=False, allow_null=True, allow_blank=True)
-    url = serializers.CharField(help_text="url of VNFM", required=True)
-    userName = serializers.CharField(help_text="User Name of VNFM", required=True)
-    password = serializers.CharField(help_text="Password of VNFM", required=True)
+    url = serializers.CharField(help_text="url of VNFM", required=False, allow_null=True, allow_blank=True)
+    userName = serializers.CharField(help_text="User Name of VNFM", required=False, allow_null=True, allow_blank=True)
+    password = serializers.CharField(help_text="Password of VNFM", required=False, allow_null=True, allow_blank=True)
     createTime = serializers.CharField(help_text="Create Time of VNFM", required=False, allow_null=True, allow_blank=True)
 
 
index 6a35eb6..810793f 100644 (file)
@@ -60,9 +60,9 @@ class NfView(APIView):
     def post(self, request):
         logger.debug("VnfCreateView--post::> %s" % request.data)
 
-        req_serializer = InstVnfReqSerializer(data=request.data)
-        if not req_serializer.is_valid():
-        # logger.error(req_serializer.errors)
+        req_serializer = InstVnfReqSerializer(data=request.data)
+        if not req_serializer.is_valid():
+            logger.error(req_serializer.errors)
 
         data = {'ns_instance_id': ignore_case_get(request.data, 'nsInstanceId'),
                 'additional_param_for_ns': ignore_case_get(request.data, 'additionalParamForVnf'),
@@ -190,9 +190,10 @@ class LcmNotify(APIView):
     def post(self, request, vnfmid, vnfInstanceId):
         logger.debug("LcmNotify--post::> %s" % request.data)
         try:
-            # req_serializer = NotifyLcmReqSerializer(data=request.data)
-            # if not req_serializer.is_valid():
-            # raise Exception(req_serializer.errors)
+            req_serializer = NotifyLcmReqSerializer(data=request.data)
+            if not req_serializer.is_valid():
+                raise Exception(req_serializer.errors)
+
             NotifyLcm(vnfmid, vnfInstanceId, request.data).do_biz()
             return Response(data={}, status=status.HTTP_201_CREATED)
         except Exception as e:
diff --git a/lcm/packages/nf_package.py b/lcm/packages/nf_package.py
deleted file mode 100644 (file)
index 17ce388..0000000
+++ /dev/null
@@ -1,437 +0,0 @@
-# Copyright 2016-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.
-
-import json
-import logging
-import os
-import sys
-import threading
-import time
-import traceback
-import uuid
-
-from lcm.pub.config.config import IMAGE_ROOT_PATH, IGNORE_DEL_IMG_WEHN_DEL_CSAR
-from lcm.pub.database.models import NfPackageModel, VnfPackageFileModel, NfInstModel
-from lcm.pub.exceptions import NSLCMException
-from lcm.pub.msapi.catalog import P_STATUS_DELETEFAILED, P_STATUS_DELETING
-from lcm.pub.msapi.catalog import P_STATUS_NORMAL, P_STATUS_ONBOARDING, P_STATUS_ONBOARDFAILED
-from lcm.pub.msapi.catalog import STATUS_ONBOARDED, P_STATUS_ENABLED
-from lcm.pub.msapi.catalog import get_download_url_from_catalog
-from lcm.pub.msapi.catalog import query_csar_from_catalog, set_csar_state
-from lcm.pub.msapi.catalog import query_rawdata_from_catalog, delete_csar_from_catalog
-from lcm.pub.msapi.extsys import get_vims
-from lcm.pub.nfvi.vim.vimadaptor import VimAdaptor
-from lcm.pub.utils import fileutil
-from lcm.pub.utils import toscautil
-from lcm.pub.utils.jobutil import JobUtil
-from lcm.pub.utils.values import ignore_case_get
-
-logger = logging.getLogger(__name__)
-
-SUPPORT_MULTI_VIM, UNSUPPORT_MULTI_VIM = 1, 0
-ZTE_PRIVATE = 0
-DEPLOY_TYPE_IAAS = 1
-IMAGE_FILE = 2
-IMAGE_STATUS_ENABLE = "Enable"
-MAX_RETRY_TIMES = 300
-SLEEP_INTERVAL_SECONDS = 2
-IMAGE_ACTIVE = 'active'
-JOB_ERROR = 255
-
-
-class NfOnBoardingThread(threading.Thread):
-    """
-    NF package onBoarding
-    """
-
-    def __init__(self, csar_id, vim_ids, lab_vim_id, job_id):
-        threading.Thread.__init__(self)
-        self.csar_id = csar_id
-        self.vim_ids = vim_ids
-        self.lab_vim_id = lab_vim_id
-        self.job_id = job_id
-
-        self.csar_info = None
-        self.nfd = None
-        self.nfd_id = None
-        self.img_save_path = os.path.join(IMAGE_ROOT_PATH, self.job_id)
-
-        self.need_rollback_when_failed = False
-
-    def run(self):
-        try:
-            self.on_boarding()
-        except NSLCMException as e:
-            self.rollback_on_boarding()
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, e.message)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-            self.rollback_on_boarding()
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, "Failed to onBoarding CSAR(%s)" % self.csar_id)
-
-    def on_boarding(self):
-        JobUtil.create_job(
-            inst_type='nf',
-            jobaction='on_boarding',
-            inst_id=self.csar_id,
-            job_id=self.job_id)
-        JobUtil.add_job_status(self.job_id, 5, "Start CSAR(%s) onBoarding." % self.csar_id)
-        self.on_boarding_pre_deal()
-        self.nf_package_save()
-        self.need_rollback_when_failed = True
-        nf_images = self.download_nf_images()
-        self.upload_nf_images(nf_images)
-        set_csar_state(self.csar_id, "onBoardState", STATUS_ONBOARDED)
-        set_csar_state(self.csar_id, "processState", P_STATUS_NORMAL)
-        set_csar_state(self.csar_id, "operationalState", P_STATUS_ENABLED)
-        JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) onBoarding successfully." % self.csar_id)
-
-    def on_boarding_pre_deal(self):
-        JobUtil.add_job_status(self.job_id, 10, "Check status of CSAR(%s) from catalog." % self.csar_id)
-
-        self.csar_info = query_csar_from_catalog(self.csar_id)
-
-        on_board_state = ignore_case_get(self.csar_info, "onBoardState")
-        if on_board_state == STATUS_ONBOARDED:
-            raise NSLCMException("CSAR(%s) already onBoarded." % self.csar_id)
-
-        process_state = ignore_case_get(self.csar_info, "processState")
-        if process_state == P_STATUS_ONBOARDING:
-            raise NSLCMException("CSAR(%s) is onBoarding now." % self.csar_id)
-
-        JobUtil.add_job_status(self.job_id, 20, "Get model of CSAR(%s) from catalog." % self.csar_id)
-
-        raw_data = query_rawdata_from_catalog(self.csar_id)
-        self.nfd = toscautil.convert_vnfd_model(raw_data["rawData"])  # convert to inner json
-        self.nfd = json.JSONDecoder().decode(self.nfd)
-        self.nfd_id = self.nfd["metadata"]["id"]
-        if NfPackageModel.objects.filter(vnfdid=self.nfd_id):
-            raise NSLCMException("NFD(%s) already exists." % self.nfd_id)
-
-    def nf_package_save(self):
-        JobUtil.add_job_status(self.job_id, 30, "Save CSAR(%s) to database." % self.csar_id)
-        vnfd_ver = self.nfd["metadata"].get("vnfd_version")
-        if not vnfd_ver:
-            vnfd_ver = self.nfd["metadata"].get("vnfdVersion")
-        NfPackageModel(
-            uuid=str(uuid.uuid4()),
-            nfpackageid=self.csar_id,
-            vnfdid=self.nfd_id,
-            vendor=self.nfd["metadata"].get("vendor", "undefined"),
-            vnfdversion=vnfd_ver,
-            vnfversion=self.nfd["metadata"].get("version", "undefined"),
-            vnfdmodel=json.JSONEncoder().encode(self.nfd)
-        ).save()
-
-    def download_nf_images(self):
-        nf_images = []
-        for image_file in self.nfd["image_files"]:
-            img_name = image_file["properties"]["name"]
-            img_relative_path = image_file["properties"]["file_url"]
-            img_type = image_file["properties"]["disk_format"]
-            img_desc = image_file.get("description", "")
-            img_url, img_local_path = get_download_url_from_catalog(self.csar_id, img_relative_path)
-            JobUtil.add_job_status(self.job_id, 50, "Start to download Image(%s)." % img_name)
-            is_download_ok, img_save_full_path = fileutil.download_file_from_http(img_url, self.img_save_path, img_name)
-            if not is_download_ok:
-                raise NSLCMException("Failed to download image from %s" % img_url)
-            logger.debug("Download Image(%s) to %s successfully.", img_name, img_save_full_path)
-            nf_images.append({
-                "image_url": img_url,
-                "img_name": img_name,
-                "img_save_full_path": img_save_full_path,
-                "img_type": img_type,
-                "img_desc": img_desc})
-        return nf_images
-
-    def upload_nf_images(self, nf_images):
-        vims = get_vims()
-        if self.lab_vim_id and (not self.vim_ids):
-            self.vim_ids = [self.lab_vim_id]
-        for vim_id in self.vim_ids:
-            sel_vim = [vim for vim in vims if vim["vimId"] == vim_id]
-            if not sel_vim:
-                logger.warn("VIMID(%s) does not exist.", vim_id)
-                continue
-            vim_api = VimAdaptor({
-                "vimid": vim_id,
-                "vimtype": sel_vim[0]["type"],
-                "url": sel_vim[0]["url"],
-                "user": sel_vim[0]["userName"],
-                "passwd": sel_vim[0]["password"],
-                "tenant": sel_vim[0]["tenant"]})
-            for nf_image in nf_images:
-                self.upload_one_nf_image(vim_api, nf_image, vim_id, sel_vim)
-        fileutil.delete_dirs(self.img_save_path)
-
-    def upload_one_nf_image(self, vim_api, nf_image, vim_id, sel_vim):
-        JobUtil.add_job_status(self.job_id, 80, "Start to upload Image(%s) to VIM(%s)." %
-                               (nf_image["img_name"], vim_id))
-        ret = vim_api.create_image({
-            "image_url": nf_image["image_url"],
-            "image_name": nf_image["img_name"],
-            "image_path": nf_image["img_save_full_path"],
-            "image_type": nf_image["img_type"]})
-        if ret[0] != 0:
-            raise NSLCMException("Failed to create image:%s" % ret[1])
-        image_id = ret[1]["id"]
-
-        self.wait_until_upload_done(vim_api, image_id)
-
-        VnfPackageFileModel(
-            vnfpid=self.csar_id,
-            filename=nf_image["img_name"],
-            filetype=IMAGE_FILE,
-            imageid=image_id,
-            vimid=vim_id,
-            vimuser=sel_vim[0]["userName"],
-            tenant=sel_vim[0]["tenant"],
-            purpose=nf_image["img_desc"],
-            status=IMAGE_STATUS_ENABLE).save()
-
-    def wait_until_upload_done(self, vim_api, image_id):
-        retry_times = 0
-        image_create_success = False
-
-        while retry_times < MAX_RETRY_TIMES:
-            retry_times += 1
-            ret = vim_api.get_image(image_id=image_id)
-            if ret[0] != 0:
-                logging.warn("Failed to query image:%s", ret[1])
-                continue
-            if ret[1]["status"] == IMAGE_ACTIVE:
-                image_create_success = True
-                break
-            time.sleep(SLEEP_INTERVAL_SECONDS)
-
-        if not image_create_success:
-            timeout_seconds = MAX_RETRY_TIMES * SLEEP_INTERVAL_SECONDS
-            raise NSLCMException("Failed to create image:timeout(%s seconds.)" % timeout_seconds)
-
-    def rollback_on_boarding(self):
-        if not self.need_rollback_when_failed:
-            return
-        try:
-            set_csar_state(self.csar_id, "processState", P_STATUS_ONBOARDFAILED)
-            NfPackageModel.objects.filter(nfpackageid=self.csar_id).delete()
-            VnfPackageFileModel.objects.filter(vnfpid=self.csar_id).delete()
-            fileutil.delete_dirs(self.img_save_path)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-
-
-######################################################################################################################
-
-
-class NfPkgDeleteThread(threading.Thread):
-    """
-    NF Package Deleting
-    """
-
-    def __init__(self, csar_id, job_id):
-        threading.Thread.__init__(self)
-        self.csar_id = csar_id
-        self.job_id = job_id
-
-    def run(self):
-        try:
-            self.delete_csar()
-        except NSLCMException as e:
-            set_csar_state(self.csar_id, "processState", P_STATUS_DELETEFAILED)
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, e.message)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-            set_csar_state(self.csar_id, "processState", P_STATUS_DELETEFAILED)
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, "Failed to delete CSAR(%s)" % self.csar_id)
-
-    def delete_csar(self):
-        JobUtil.create_job(
-            inst_type='nf',
-            jobaction='delete',
-            inst_id=self.csar_id,
-            job_id=self.job_id)
-        JobUtil.add_job_status(self.job_id, 5, "Start to delete CSAR(%s)." % self.csar_id)
-        if query_csar_from_catalog(self.csar_id, "processState") == P_STATUS_DELETING:
-            JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) is deleting now." % self.csar_id)
-            return
-
-        if NfInstModel.objects.filter(package_id=self.csar_id):
-            ret = set_csar_state(self.csar_id, "deletionPending", True)
-            JobUtil.add_job_status(self.job_id, 100, ret[1])
-            return
-
-        NfPackage().delete_csar(self.csar_id, self.job_id)
-
-
-class NfPkgDeletePendingThread(threading.Thread):
-    """
-    NF Package Delete Pending
-    """
-
-    def __init__(self, csar_id, job_id):
-        threading.Thread.__init__(self)
-        self.csar_id = csar_id
-        self.job_id = job_id
-
-    def run(self):
-        try:
-            self.delete_pending_csar()
-        except NSLCMException as e:
-            set_csar_state(self.csar_id, "processState", P_STATUS_DELETEFAILED)
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, e.message)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-            set_csar_state(self.csar_id, "processState", P_STATUS_DELETEFAILED)
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, "Failed to delete CSAR(%s)" % self.csar_id)
-
-    def delete_pending_csar(self):
-        JobUtil.create_job(
-            inst_type='nf',
-            jobaction='delete_pending',
-            inst_id=self.csar_id,
-            job_id=self.job_id)
-        JobUtil.add_job_status(self.job_id, 5, "Start to delete pending CSAR(%s)." % self.csar_id)
-
-        if not NfPackageModel.objects.filter(nfpackageid=self.csar_id):
-            JobUtil.add_job_status(self.job_id, 100, "Delete pending CSAR(%s) successfully." % self.csar_id)
-            return
-
-        csar_info = query_csar_from_catalog(self.csar_id)
-
-        process_state = ignore_case_get(csar_info, "processState")
-        if process_state == P_STATUS_DELETING:
-            JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) is deleting now." % self.csar_id)
-            return
-
-        deletion_pending = ignore_case_get(csar_info, "deletionPending")
-        if deletion_pending.lower() == "false":
-            JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) need not to be deleted." % self.csar_id)
-            return
-
-        if NfInstModel.objects.filter(package_id=self.csar_id):
-            JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) is in using, cannot be deleted." % self.csar_id)
-            return
-
-        NfPackage().delete_csar(self.csar_id, self.job_id)
-
-
-####################################################################################################################
-class NfPackage(object):
-    """
-    Actions for nf package.
-    """
-
-    def __init__(self):
-        pass
-
-    def get_csars(self):
-        ret = {"csars": []}
-        nf_pkgs = NfPackageModel.objects.filter()
-        for nf_pkg in nf_pkgs:
-            ret["csars"].append({
-                "csarId": nf_pkg.nfpackageid,
-                "vnfdId": nf_pkg.vnfdid
-            })
-        return ret
-
-    def get_csar(self, csar_id):
-        pkg_info = {}
-        nf_pkg = NfPackageModel.objects.filter(nfpackageid=csar_id)
-        if nf_pkg:
-            pkg_info["vnfdId"] = nf_pkg[0].vnfdid
-            pkg_info["vnfdProvider"] = nf_pkg[0].vendor
-            pkg_info["vnfdVersion"] = nf_pkg[0].vnfdversion
-            pkg_info["vnfVersion"] = nf_pkg[0].vnfversion
-
-        casrinfo = query_csar_from_catalog(csar_id)
-        props_of_catalog = [
-            "name", "provider", "version", "operationalState", "usageState",
-            "onBoardState", "processState", "deletionPending", "downloadUri",
-            "createTime", "modifyTime", "format", "size"]
-        for prop in props_of_catalog:
-            pkg_info[prop] = ignore_case_get(casrinfo, prop)
-
-        nf_pkg_files = VnfPackageFileModel.objects.filter(vnfpid=csar_id)
-        img_info = [{
-            "index": str(i),
-            "fileName": nf_pkg_files[i].filename,
-            "imageId": nf_pkg_files[i].imageid,
-            "vimId": nf_pkg_files[i].vimid,
-            "vimUser": nf_pkg_files[i].vimuser,
-            "tenant": nf_pkg_files[i].tenant,
-            "status": nf_pkg_files[i].status}
-            for i in range(len(nf_pkg_files))]
-
-        vnf_insts = NfInstModel.objects.filter(package_id=csar_id)
-        vnf_inst_info = [{"vnfInstanceId": vnf_inst.nfinstid,
-                          "vnfInstanceName": vnf_inst.nf_name} for vnf_inst in vnf_insts]
-
-        return [0, {"csarId": csar_id,
-                    "packageInfo": pkg_info,
-                    "imageInfo": img_info,
-                    "vnfInstanceInfo": vnf_inst_info}]
-
-    def delete_csar(self, csar_id, job_id):
-        JobUtil.add_job_status(job_id, 10, "Set processState of CSAR(%s)." % csar_id)
-        set_csar_state(csar_id, "processState", P_STATUS_DELETING)
-
-        JobUtil.add_job_status(job_id, 20, "Get package files of CSAR(%s)." % csar_id)
-        all_nf_pkg_files = VnfPackageFileModel.objects.all()
-        nf_pkg_files = VnfPackageFileModel.objects.filter(vnfpid=csar_id)
-        vims = get_vims()
-
-        for pkg_file in nf_pkg_files:
-            if IGNORE_DEL_IMG_WEHN_DEL_CSAR:
-                logger.warn("ignore delete image(%s)" % pkg_file.filename)
-                continue
-            JobUtil.add_job_status(job_id, 50, "Delete image(%s) of CSAR(%s)." %
-                                   (pkg_file.filename, csar_id))
-            if self.is_image_refed_by_other_nf_pkg(all_nf_pkg_files, pkg_file.imageid, csar_id, pkg_file.vimid):
-                logger.warn("Image(%s) is refered by CSAR(%s).", pkg_file.filename, csar_id)
-                continue
-            sel_vim = [vim for vim in vims if vim["vimId"] == pkg_file.vimid]
-            if not sel_vim:
-                logger.warn("Vim(%s) does not exist.", pkg_file.vimid)
-                continue
-            vim_api = VimAdaptor({
-                "vimid": pkg_file.vimid,
-                "vimtype": sel_vim[0]["type"],
-                "url": sel_vim[0]["url"],
-                "user": sel_vim[0]["userName"],
-                "passwd": sel_vim[0]["password"],
-                "tenant": sel_vim[0]["tenant"]})
-            ret = vim_api.delete_image(pkg_file.imageid)
-            if ret[0] != 0:
-                logger.error("Failed to delete image(%s) from vim(%s)", pkg_file.filename, pkg_file.vimid)
-
-        JobUtil.add_job_status(job_id, 70, "Delete CSAR(%s) from catalog." % csar_id)
-        ret = delete_csar_from_catalog(csar_id)
-        if ret[0] != 0:
-            raise NSLCMException(ret[1])
-
-        JobUtil.add_job_status(job_id, 90, "Delete CSAR(%s) from database." % csar_id)
-        VnfPackageFileModel.objects.filter(vnfpid=csar_id).delete()
-        NfPackageModel.objects.filter(nfpackageid=csar_id).delete()
-
-        JobUtil.add_job_status(job_id, 100, "Delete CSAR(%s) successfully." % csar_id)
-
-    def is_image_refed_by_other_nf_pkg(self, nf_pkg_files, imageid, csar_id, vim_id):
-        for f in nf_pkg_files:
-            if f.imageid == imageid and f.vimid == vim_id and f.vnfpid != csar_id:
-                return True
-        return False
diff --git a/lcm/packages/ns_package.py b/lcm/packages/ns_package.py
deleted file mode 100644 (file)
index 777256f..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-# Copyright 2016 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.
-
-import logging
-
-import traceback
-import sys
-
-from lcm.pub.database.models import NSDModel, NSInstModel
-from lcm.pub.utils.values import ignore_case_get
-from lcm.pub.msapi.catalog import query_csar_from_catalog, set_csar_state
-from lcm.pub.msapi.catalog import delete_csar_from_catalog
-from lcm.pub.exceptions import NSLCMException
-
-logger = logging.getLogger(__name__)
-
-STATUS_SUCCESS, STATUS_FAILED = "success", "failed"
-
-
-def fmt_ns_pkg_rsp(status, desc, error_code="500"):
-    return [0, {"status": status, "statusDescription": desc, "errorCode": error_code}]
-
-
-def ns_common_call(fun, csar_id, operation=""):
-    ret = None
-    try:
-        if operation == "":
-            ret = fun(csar_id)
-        else:
-            ret = fun(csar_id, operation)
-
-        if ret[0] != 0:
-            return fmt_ns_pkg_rsp(STATUS_FAILED, ret[1])
-    except NSLCMException as e:
-        return fmt_ns_pkg_rsp(STATUS_FAILED, e.message)
-    except:
-        logger.error(traceback.format_exc())
-        return fmt_ns_pkg_rsp(STATUS_FAILED, str(sys.exc_info()))
-    return fmt_ns_pkg_rsp(STATUS_SUCCESS, ret[1], "")
-
-
-def ns_delete_pending_csar(csar_id):
-    return ns_common_call(NsPackage().delete_pending_csar, csar_id)
-
-
-def ns_set_state_csar(csar_id, operation):
-    return ns_common_call(NsPackage().set_state_csar, csar_id, operation)
-
-
-###############################################################################################################
-
-
-class NsPackage(object):
-    """
-    Actions for ns package.
-    """
-
-    def __init__(self):
-        pass
-
-    def delete_csar(self, csar_id):
-        if not NSDModel.objects.filter(id=csar_id):
-            return delete_csar_from_catalog(csar_id)
-
-        if NSInstModel.objects.filter(nspackage_id=csar_id):
-            return set_csar_state(csar_id, "deletionPending", True)
-
-        ret = delete_csar_from_catalog(csar_id)
-        if ret[0] == 0:
-            NSDModel.objects.filter(id=csar_id).delete()
-        return ret
-
-    def delete_pending_csar(self, csar_id):
-        if not NSDModel.objects.filter(id=csar_id):
-            return [0, "Delete pending CSAR(%s) successfully." % csar_id]
-
-        pending = query_csar_from_catalog(csar_id, "deletionPending")
-
-        if pending.lower() == "false":
-            return [1, "CSAR(%s) need not to be deleted." % csar_id]
-
-        if NSInstModel.objects.filter(nspackage_id=csar_id):
-            return [1, "CSAR(%s) is in using, cannot be deleted." % csar_id]
-
-        ret = delete_csar_from_catalog(csar_id)
-        if ret[0] == 0:
-            NSDModel.objects.filter(id=csar_id).delete()
-        return ret
-
-    def set_state_csar(self, csar_id, operation):
-        if not NSDModel.objects.filter(id=csar_id):
-            raise NSLCMException("CSAR(%s) does not exist." % csar_id)
-
-        csar = query_csar_from_catalog(csar_id)
-        if ignore_case_get(csar, "operationalState") == operation.capitalize():
-            raise NSLCMException("CSAR(%s) already %s." % (csar_id, operation))
-        return set_csar_state(csar_id, 'operationState', operation.capitalize())
diff --git a/lcm/packages/sdc_nf_package.py b/lcm/packages/sdc_nf_package.py
deleted file mode 100644 (file)
index 0eeea4f..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-# 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.
-
-import json
-import logging
-import os
-import sys
-import threading
-import traceback
-
-from lcm.pub.config.config import CATALOG_ROOT_PATH
-from lcm.pub.database.models import NfPackageModel, NfInstModel
-from lcm.pub.exceptions import NSLCMException
-from lcm.pub.msapi import sdc, sdc_run_catalog
-from lcm.pub.utils import fileutil
-from lcm.pub.utils import toscaparser
-from lcm.pub.utils.jobutil import JobUtil
-
-logger = logging.getLogger(__name__)
-
-JOB_ERROR = 255
-
-
-def nf_get_csars():
-    ret = None
-    try:
-        ret = SdcNfPackage().get_csars()
-    except NSLCMException as e:
-        return [1, e.message]
-    except:
-        logger.error(traceback.format_exc())
-        return [1, str(sys.exc_info())]
-    return ret
-
-
-def nf_get_csar(csar_id):
-    ret = None
-    try:
-        ret = SdcNfPackage().get_csar(csar_id)
-    except NSLCMException as e:
-        return [1, e.message]
-    except:
-        logger.error(traceback.format_exc())
-        return [1, str(sys.exc_info())]
-    return ret
-
-
-#####################################################################################
-class SdcNfDistributeThread(threading.Thread):
-    """
-    Sdc NF Package Distribute
-    """
-
-    def __init__(self, csar_id, vim_ids, lab_vim_id, job_id):
-        threading.Thread.__init__(self)
-        self.csar_id = csar_id
-        self.vim_ids = vim_ids
-        self.lab_vim_id = lab_vim_id
-        self.job_id = job_id
-
-        self.csar_save_path = os.path.join(CATALOG_ROOT_PATH, csar_id)
-
-    def run(self):
-        try:
-            self.on_distribute()
-        except NSLCMException as e:
-            self.rollback_distribute()
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, e.message)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-            self.rollback_distribute()
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, "Failed to distribute CSAR(%s)" % self.csar_id)
-
-    def on_distribute(self):
-        JobUtil.create_job(
-            inst_type='nf',
-            jobaction='on_distribute',
-            inst_id=self.csar_id,
-            job_id=self.job_id)
-        JobUtil.add_job_status(self.job_id, 5, "Start CSAR(%s) distribute." % self.csar_id)
-
-        if NfPackageModel.objects.filter(nfpackageid=self.csar_id):
-            raise NSLCMException("NF CSAR(%s) already exists." % self.csar_id)
-
-        artifact = sdc.get_artifact(sdc.ASSETTYPE_RESOURCES, self.csar_id)
-        local_path = os.path.join(CATALOG_ROOT_PATH, self.csar_id)
-        local_file_name = sdc.download_artifacts(artifact["toscaModelURL"],
-                                                 local_path,
-                                                 "%s.csar" % artifact.get("name", self.csar_id))
-
-        vnfd_json = toscaparser.parse_vnfd(local_file_name)
-        vnfd = json.JSONDecoder().decode(vnfd_json)
-
-        nfd_id = vnfd["metadata"]["id"]
-        if NfPackageModel.objects.filter(vnfdid=nfd_id):
-            raise NSLCMException("NFD(%s) already exists." % nfd_id)
-
-        JobUtil.add_job_status(self.job_id, 30, "Save CSAR(%s) to database." % self.csar_id)
-
-        vnfd_ver = vnfd["metadata"].get("vnfd_version")
-        if not vnfd_ver:
-            vnfd_ver = vnfd["metadata"].get("vnfdVersion", "undefined")
-        NfPackageModel(
-            uuid=self.csar_id,
-            nfpackageid=self.csar_id,
-            vnfdid=nfd_id,
-            vendor=vnfd["metadata"].get("vendor", "undefined"),
-            vnfdversion=vnfd_ver,
-            vnfversion=vnfd["metadata"].get("version", "undefined"),
-            vnfdmodel=vnfd_json,
-            vnfd_path=local_file_name).save()
-
-        JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) distribute successfully." % self.csar_id)
-
-    def rollback_distribute(self):
-        try:
-            NfPackageModel.objects.filter(nfpackageid=self.csar_id).delete()
-            fileutil.delete_dirs(self.csar_save_path)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-
-
-######################################################################################################################
-
-
-class SdcNfPkgDeleteThread(threading.Thread):
-    """
-    Sdc NF Package Deleting
-    """
-
-    def __init__(self, csar_id, job_id, force_delete):
-        threading.Thread.__init__(self)
-        self.csar_id = csar_id
-        self.job_id = job_id
-        self.force_delete = force_delete
-
-    def run(self):
-        try:
-            self.delete_csar()
-        except NSLCMException as e:
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, e.message)
-        except:
-            logger.error(traceback.format_exc())
-            logger.error(str(sys.exc_info()))
-            JobUtil.add_job_status(self.job_id, JOB_ERROR, "Failed to delete CSAR(%s)" % self.csar_id)
-
-    def delete_csar(self):
-        JobUtil.create_job(
-            inst_type='nf',
-            jobaction='delete',
-            inst_id=self.csar_id,
-            job_id=self.job_id)
-        JobUtil.add_job_status(self.job_id, 5, "Start to delete CSAR(%s)." % self.csar_id)
-
-        if self.force_delete:
-            NfInstModel.objects.filter(package_id=self.csar_id).delete()
-        else:
-            if NfInstModel.objects.filter(package_id=self.csar_id):
-                raise NSLCMException("NfInst by csar(%s) exists, cannot delete." % self.csar_id)
-
-        JobUtil.add_job_status(self.job_id, 50, "Delete CSAR(%s) from Database." % self.csar_id)
-
-        NfPackageModel.objects.filter(nfpackageid=self.csar_id).delete()
-
-        JobUtil.add_job_status(self.job_id, 80, "Delete local CSAR(%s) file." % self.csar_id)
-
-        csar_save_path = os.path.join(CATALOG_ROOT_PATH, self.csar_id)
-        fileutil.delete_dirs(csar_save_path)
-
-        JobUtil.add_job_status(self.job_id, 100, "Delete CSAR(%s) successfully." % self.csar_id)
-
-
-######################################################################################################################
-
-class SdcNfPackage(object):
-    """
-    Actions for sdc nf package.
-    """
-
-    def __init__(self):
-        pass
-
-    def get_csars(self):
-        csars = {"csars": []}
-        nf_pkgs = NfPackageModel.objects.filter()
-        for nf_pkg in nf_pkgs:
-            csars["csars"].append({
-                "csarId": nf_pkg.nfpackageid,
-                "vnfdId": nf_pkg.vnfdid
-            })
-        return [0, csars]
-
-    def get_csar(self, csar_id):
-        """
-        pkg_info = {}
-        nf_pkg = NfPackageModel.objects.filter(nfpackageid=csar_id)
-        if nf_pkg:
-            pkg_info["vnfdId"] = nf_pkg[0].vnfdid
-            pkg_info["vnfdProvider"] = nf_pkg[0].vendor
-            pkg_info["vnfdVersion"] = nf_pkg[0].vnfdversion
-            pkg_info["vnfVersion"] = nf_pkg[0].vnfversion
-        """
-        nf_pkg = sdc_run_catalog.query_vnfpackage_by_id(csar_id)
-        pkg_info = nf_pkg["packageInfo"]
-
-        vnf_insts = NfInstModel.objects.filter(package_id=csar_id)
-        vnf_inst_info = [{"vnfInstanceId": vnf_inst.nfinstid,
-                          "vnfInstanceName": vnf_inst.nf_name} for vnf_inst in vnf_insts]
-
-        return [0, {"csarId": csar_id,
-                    "packageInfo": pkg_info,
-                    "imageInfo": [],
-                    "vnfInstanceInfo": vnf_inst_info}]
diff --git a/lcm/packages/tests/test_nf.py b/lcm/packages/tests/test_nf.py
deleted file mode 100644 (file)
index 6ebc98b..0000000
+++ /dev/null
@@ -1,770 +0,0 @@
-# Copyright 2016-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.
-
-import json
-
-import mock
-from django.test import Client
-from django.test import TestCase
-from rest_framework import status
-
-from lcm.packages.nf_package import NfOnBoardingThread, NfPkgDeletePendingThread
-from lcm.packages.nf_package import NfPkgDeleteThread
-from lcm.pub.database.models import JobStatusModel, JobModel
-from lcm.pub.database.models import NfPackageModel, VnfPackageFileModel, NfInstModel
-from lcm.pub.nfvi.vim.vimadaptor import VimAdaptor
-from lcm.pub.utils import fileutil
-from lcm.pub.utils import restcall
-
-
-class TestNfPackage(TestCase):
-    def setUp(self):
-        self.client = Client()
-        NfPackageModel.objects.filter().delete()
-        VnfPackageFileModel.objects.filter().delete()
-        NfInstModel.objects.filter().delete()
-        JobModel.objects.filter().delete()
-        JobStatusModel.objects.filter().delete()
-        self.vnfd_raw_data = {
-            "rawData": {
-                "instance": {
-                    "metadata": {
-                        "is_shared": False,
-                        "plugin_info": "vbrasplugin_1.0",
-                        "vendor": "zte",
-                        "request_reclassification": False,
-                        "name": "vbras",
-                        "version": 1,
-                        "vnf_type": "vbras",
-                        "cross_dc": False,
-                        "vnfd_version": "1.0.0",
-                        "id": "zte_vbras_1.0",
-                        "nsh_aware": True
-                    },
-                    "nodes": [
-                        {
-                            "id": "aaa_dnet_cp_0xu2j5sbigxc8h1ega3if0ld1",
-                            "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                            "template_name": "aaa_dnet_cp",
-                            "properties": {
-                                "bandwidth": {
-                                    "type_name": "integer",
-                                    "value": 0
-                                },
-                                "direction": {
-                                    "type_name": "string",
-                                    "value": "bidirectional"
-                                },
-                                "vnic_type": {
-                                    "type_name": "string",
-                                    "value": "normal"
-                                },
-                                "sfc_encapsulation": {
-                                    "type_name": "string",
-                                    "value": "mac"
-                                },
-                                "order": {
-                                    "type_name": "integer",
-                                    "value": 2
-                                }
-                            },
-                            "relationships": [
-                                {
-                                    "name": "guest_os",
-                                    "source_requirement_index": 0,
-                                    "target_node_id": "AAA_image_d8aseebr120nbm7bo1ohkj194",
-                                    "target_capability_name": "feature"
-                                }
-                            ]
-                        },
-                        {
-                            "id": "LB_Image_oj5l2ay8l2g6vcq6fsswzduha",
-                            "type_name": "tosca.nodes.nfv.ext.ImageFile",
-                            "template_name": "LB_Image",
-                            "properties": {
-                                "disk_format": {
-                                    "type_name": "string",
-                                    "value": "qcow2"
-                                },
-                                "file_url": {
-                                    "type_name": "string",
-                                    "value": "/SoftwareImages/image-lb"
-                                },
-                                "name": {
-                                    "type_name": "string",
-                                    "value": "image-lb"
-                                }
-                            }
-                        }
-                    ]
-                },
-                "model": {
-                    "metadata": {
-                        "is_shared": False,
-                        "plugin_info": "vbrasplugin_1.0",
-                        "vendor": "zte",
-                        "request_reclassification": False,
-                        "name": "vbras",
-                        "version": 1,
-                        "vnf_type": "vbras",
-                        "cross_dc": False,
-                        "vnfd_version": "1.0.0",
-                        "id": "zte_vbras_1.0",
-                        "nsh_aware": True
-                    },
-                    "node_templates": [
-                        {
-                            "name": "aaa_dnet_cp",
-                            "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                            "default_instances": 1,
-                            "min_instances": 0,
-                            "properties": {
-                                "bandwidth": {
-                                    "type_name": "integer",
-                                    "value": 0
-                                }
-                            },
-                            "requirement_templates": [
-                                {
-                                    "name": "virtualbinding",
-                                    "target_node_template_name": "AAA",
-                                    "target_capability_name": "virtualbinding"
-                                }
-                            ]
-                        }
-                    ]
-                }
-            }
-        }
-
-    def tearDown(self):
-        pass
-
-    def assert_job_result(self, job_id, job_progress, job_detail):
-        jobs = JobStatusModel.objects.filter(
-            jobid=job_id,
-            progress=job_progress,
-            descp=job_detail)
-        self.assertEqual(1, len(jobs))
-
-    @mock.patch.object(NfOnBoardingThread, 'run')
-    def test_nf_pkg_on_boarding_normal(self, mock_run):
-        resp = self.client.post("/api/nslcm/v0/vnfpackage", {
-            "csarId": "1",
-            "vimIds": ["1"]
-        }, format='json')
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_nf_pkg_on_boarding_when_on_boarded(self, mock_call_req):
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({"onBoardState": "onBoarded"}), '200']
-        NfOnBoardingThread(csar_id="1",
-                           vim_ids=["1"],
-                           lab_vim_id="",
-                           job_id="2").run()
-        self.assert_job_result("2", 255, "CSAR(1) already onBoarded.")
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_nf_pkg_on_boarding_when_on_boarding(self, mock_call_req):
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "onBoardState": "non-onBoarded",
-            "processState": "onBoarding"
-        }), '200']
-        NfOnBoardingThread(csar_id="2",
-                           vim_ids=["1"],
-                           lab_vim_id="",
-                           job_id="3").run()
-        self.assert_job_result("3", 255, "CSAR(2) is onBoarding now.")
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_nf_on_boarding_when_nfd_already_exists(self, mock_call_req):
-        mock_vals = {
-            "/api/catalog/v1/csars/2":
-                [0, json.JSONEncoder().encode({
-                    "onBoardState": "onBoardFailed", "processState": "deleteFailed"}), '200'],
-            "/api/catalog/v1/servicetemplates/queryingrawdata":
-                [0, json.JSONEncoder().encode(self.vnfd_raw_data), '200']}
-
-        def side_effect(*args):
-            return mock_vals[args[4]]
-
-        mock_call_req.side_effect = side_effect
-        NfPackageModel(uuid="1", nfpackageid="2", vnfdid="zte_vbras_1.0").save()
-        NfOnBoardingThread(csar_id="2", vim_ids=["1"], lab_vim_id="", job_id="4").run()
-        self.assert_job_result("4", 255, "NFD(zte_vbras_1.0) already exists.")
-
-    @mock.patch.object(restcall, 'call_req')
-    @mock.patch.object(fileutil, 'download_file_from_http')
-    @mock.patch.object(VimAdaptor, '__init__')
-    @mock.patch.object(VimAdaptor, 'create_image')
-    @mock.patch.object(VimAdaptor, 'get_image')
-    def test_nf_on_boarding_when_successfully(self, mock_get_image, mock_create_image,
-                                              mock__init__, mock_download_file_from_http, mock_call_req):
-        mock_download_file_from_http.return_value = True, "/root/package"
-        mock_vals = {
-            "/api/catalog/v1/csars/2":
-                [0, json.JSONEncoder().encode({
-                    "onBoardState": "onBoardFailed", "processState": "deleteFailed"}), '200'],
-            "/api/catalog/v1/servicetemplates/queryingrawdata":
-                [0, json.JSONEncoder().encode(self.vnfd_raw_data), '200'],
-            "/api/catalog/v1/csars/2/files?relativePath=/SoftwareImages/image-lb":
-                [0, json.JSONEncoder().encode({
-                    "csar_file_info": [{"downloadUri": "8"}, {"localPath": "9"}]}), '200'],
-            "/cloud-infrastructure/cloud-regions?depth=all":
-                [0, json.JSONEncoder().encode(vims_info), '200'],
-            "/api/catalog/v1/csars/2?onBoardState=onBoarded": [0, '{}', 200],
-            "/api/catalog/v1/csars/2?operationalState=Enabled": [0, '{}', 200],
-            "/api/catalog/v1/csars/2?processState=normal": [0, '{}', 200]}
-        mock_create_image.return_value = [0, {"id": "30", "name": "jerry", "res_type": 0}]
-        mock__init__.return_value = None
-        mock_get_image.return_value = [0, {"id": "30", "name": "jerry", "size": "60", "status": "active"}]
-
-        def side_effect(*args):
-            return mock_vals[args[4]]
-        mock_call_req.side_effect = side_effect
-
-        NfOnBoardingThread(csar_id="2", vim_ids=["1"], lab_vim_id="", job_id="4").run()
-        self.assert_job_result("4", 100, "CSAR(2) onBoarding successfully.")
-
-    # @mock.patch.object(restcall, 'call_req')
-    # @mock.patch.object(fileutil, 'download_file_from_http')
-    # @mock.patch.object(VimAdaptor, '__init__')
-    # @mock.patch.object(VimAdaptor, 'create_image')
-    # @mock.patch.object(VimAdaptor, 'get_image')
-    # def test_nf_on_boarding_when_timeout(self, mock_get_image, mock_create_image,
-    #                                      mock__init__, mock_download_file_from_http, mock_call_req):
-    #     nf_package.MAX_RETRY_TIMES = 2
-    #     nf_package.SLEEP_INTERVAL_SECONDS = 1
-    #     mock_download_file_from_http.return_value = True, "/root/package"
-    #     mock_vals = {
-    #         "/api/catalog/v1/csars/3":
-    #         [0, json.JSONEncoder().encode({"onBoardState": "onBoardFailed",
-    #                                        "processState": "deleteFailed"}), '200'],
-    #         "/api/catalog/v1/servicetemplates/queryingrawdata":
-    #             [0, json.JSONEncoder().encode(self.vnfd_raw_data), '200'],
-    #         "/api/catalog/v1/csars/3/files?relativePath=/SoftwareImages/image-lb":
-    #             [0, json.JSONEncoder().encode({
-    #                 "csar_file_info": [{"downloadUri": "8"}, {"localPath": "9"}]}), '200'],
-    #         "/api/catalog/v1/csars/3?processState=onBoardFailed": [0, '{}', 200],
-    #         "/cloud-infrastructure/cloud-regions?depth=all":
-    #             [0, json.JSONEncoder().encode(vims_info), 200]}
-    #     mock_create_image.return_value = [0, {"id": "30", "name": "jerry", "res_type": 0}]
-    #     mock__init__.return_value = None
-    #     mock_get_image.return_value = [0, {"id": "30", "name": "jerry", "size": "60", "status": "0"}]
-    #
-    #     def side_effect(*args):
-    #         return mock_vals[args[4]]
-    #
-    #     mock_call_req.side_effect = side_effect
-    #     NfOnBoardingThread(csar_id="3", vim_ids=["1"], lab_vim_id="", job_id="6").run()
-    #     self.assert_job_result("6", 255, "Failed to create image:timeout(2 seconds.)")
-
-    # @mock.patch.object(restcall, 'call_req')
-    # @mock.patch.object(fileutil, 'download_file_from_http')
-    # @mock.patch.object(VimAdaptor, '__init__')
-    # @mock.patch.object(VimAdaptor, 'create_image')
-    # def test_nf_on_boarding_when_failed_to_create_image(self, mock_create_image,
-    #                                                     mock__init__, mock_download_file_from_http, mock_call_req):
-    #     mock_download_file_from_http.return_value = True, "/root/package"
-    #     mock_vals = {
-    #         "/api/catalog/v1/csars/5":
-    #             [0, json.JSONEncoder().encode({
-    #                 "onBoardState": "onBoardFailed", "processState": "deleteFailed"}), '200'],
-    #         "/api/catalog/v1/servicetemplates/queryingrawdata":
-    #             [0, json.JSONEncoder().encode(self.vnfd_raw_data), '200'],
-    #         "/api/catalog/v1/csars/5/files?relativePath=/SoftwareImages/image-lb":
-    #             [0, json.JSONEncoder().encode({
-    #                 "csar_file_info": [{"downloadUri": "8"}, {"localPath": "9"}]}), '200'],
-    #         "/api/catalog/v1/csars/5?processState=onBoardFailed": [0, '{}', 200],
-    #         "/cloud-infrastructure/cloud-regions?depth=all":
-    #             [0, json.JSONEncoder().encode(vims_info), '200']}
-    #     mock_create_image.return_value = [1, 'Unsupported image format.']
-    #     mock__init__.return_value = None
-    #
-    #     def side_effect(*args):
-    #         return mock_vals[args[4]]
-    #     mock_call_req.side_effect = side_effect
-    #     NfOnBoardingThread(csar_id="5", vim_ids=["1"], lab_vim_id="", job_id="8").run()
-    #     self.assert_job_result("8", 255, "Failed to create image:Unsupported image format.")
-
-    #########################################################################
-    @mock.patch.object(restcall, 'call_req')
-    def test_get_csar_successfully(self, mock_call_req):
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "name": "1", "provider": "2", "version": "3", "operationalState": "4",
-            "usageState": "5", "onBoardState": "6", "processState": "7",
-            "deletionPending": "8", "downloadUri": "9", "createTime": "10",
-            "modifyTime": "11", "format": "12", "size": "13"
-        }), '200']
-        NfPackageModel(uuid="1", vnfdid="001", vendor="vendor",
-                       vnfdversion="1.2.0", vnfversion="1.1.0", nfpackageid="13").save()
-        VnfPackageFileModel(id="1", filename="filename", imageid="00001",
-                            vimid="1", vimuser="001", tenant="12", status="1", vnfpid="13").save()
-        NfInstModel(nfinstid="1", mnfinstid="001", nf_name="name", package_id="13").save()
-        resp = self.client.get("/api/nslcm/v0/vnfpackage/13")
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-        expect_data = {
-            "csarId": '13',
-            "packageInfo": {
-                "vnfdId": "001",
-                "vnfdProvider": "vendor",
-                "vnfdVersion": "1.2.0",
-                "vnfVersion": "1.1.0",
-                "name": "1",
-                "provider": "2",
-                "version": "3",
-                "operationalState": "4",
-                "usageState": "5",
-                "onBoardState": "6",
-                "processState": "7",
-                "deletionPending": "8",
-                "downloadUri": "9",
-                "createTime": "10",
-                "modifyTime": "11",
-                "format": "12",
-                "size": "13"},
-            "imageInfo": [{
-                "index": "0",
-                "fileName": "filename",
-                "imageId": "00001",
-                "vimId": "1",
-                "vimUser": "001",
-                "tenant": "12",
-                "status": "1"}],
-            "vnfInstanceInfo": [{
-                "vnfInstanceId": "1",
-                "vnfInstanceName": "name"}]}
-        self.assertEqual(expect_data, resp.data)
-
-    #########################################################################
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_successfully(self, mock_call_req):
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "processState": "deleting"}), "200"]
-        NfPkgDeletePendingThread(csar_id="1", job_id='2').run()
-        self.assert_job_result("2", 100, "Delete pending CSAR(1) successfully.")
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_deleting(self, mock_call_req):
-        NfPackageModel(uuid="01", nfpackageid="1").save()
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "processState": "deleting"}), "200"]
-        NfPkgDeletePendingThread(csar_id="1", job_id='2').run()
-        self.assert_job_result("2", 100, "CSAR(1) is deleting now.")
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_not_deletion_pending(self, mock_call_req):
-        NfPackageModel(uuid="01", nfpackageid="1").save()
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "deletionPending": "false"}), "200"]
-        NfPkgDeletePendingThread(csar_id="1", job_id='2').run()
-        self.assert_job_result("2", 100, "CSAR(1) need not to be deleted.")
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_in_using(self, mock_call_req):
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "processState": "normal"}), "200"]
-        NfPackageModel(uuid="01", nfpackageid="1").save()
-        NfInstModel(nfinstid="01", package_id="1").save()
-        NfPkgDeletePendingThread(csar_id="1", job_id='2').run()
-        self.assert_job_result("2", 100, "CSAR(1) is in using, cannot be deleted.")
-
-    @mock.patch.object(VimAdaptor, '__init__')
-    @mock.patch.object(VimAdaptor, 'delete_image')
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_csarr_when_exception(self, mock_call_req, mock_delete_image, mock_init_):
-        mock_vals = {
-            ("/api/catalog/v1/csars/1", "DELETE"):
-                [1, "{}", "400"],
-            ("/api/catalog/v1/csars/1?processState=deleting", "PUT"):
-                [0, "{}", "200"],
-            ("/api/catalog/v1/csars/1?processState=deleteFailed", "PUT"):
-                [0, "{}", "200"],
-            ("/api/catalog/v1/csars/1", "GET"):
-                [0, json.JSONEncoder().encode({"processState": "normal"}), "200"],
-            ("/cloud-infrastructure/cloud-regions?depth=all", "GET"):
-                [0, json.JSONEncoder().encode(vims_info), "200"]}
-        mock_delete_image.return_value = [0, "", '200']
-
-        def side_effect(*args):
-            return mock_vals[(args[4], args[5])]
-
-        mock_call_req.side_effect = side_effect
-        mock_init_.return_value = None
-        VnfPackageFileModel(vnfpid="1", imageid="001", vimid="002").save()
-        NfPackageModel(uuid="01", nfpackageid="1").save()
-        NfPkgDeletePendingThread(csar_id="1", job_id='2').run()
-        self.assert_job_result("2", 255, "Failed to delete CSAR(1) from catalog.")
-
-    @mock.patch.object(VimAdaptor, '__init__')
-    @mock.patch.object(VimAdaptor, 'delete_image')
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_csar_when_successfully(self, mock_call_req, mock_delete_image, mock_init_):
-        mock_vals = {
-            ("/api/catalog/v1/csars/1", "DELETE"):
-                [0, json.JSONEncoder().encode({"successfully": "successfully"}), "200"],
-            ("/api/catalog/v1/csars/1?processState=deleting", "PUT"):
-                [0, json.JSONEncoder().encode({"successfully": "successfully"}), "200"],
-            ("/api/catalog/v1/csars/1?processState=deleteFailed", "PUT"):
-                [0, json.JSONEncoder().encode({"successfully": "successfully"}), "200"],
-            ("/api/catalog/v1/csars/1", "GET"):
-                [0, json.JSONEncoder().encode({"notProcessState": "notProcessState"}), "200"],
-            ("/cloud-infrastructure/cloud-regions?depth=all", "GET"):
-                [0, json.JSONEncoder().encode(vims_info), "200"]}
-        mock_delete_image.return_value = [0, json.JSONEncoder().encode({"test": "test"}), '200']
-
-        def side_effect(*args):
-            return mock_vals[(args[4], args[5])]
-
-        mock_call_req.side_effect = side_effect
-        mock_init_.return_value = None
-        VnfPackageFileModel(vnfpid="1", imageid="001", vimid="002").save()
-        NfPackageModel(uuid="01", nfpackageid="1").save()
-        NfPkgDeletePendingThread(csar_id="1", job_id='2').run()
-        self.assert_job_result("2", 100, "Delete CSAR(1) successfully.")
-
-    #########################################################################
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_nf_pkg_when_deleting(self, mock_call_req):
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({"processState": "deleting"}), '200']
-        NfPkgDeleteThread(csar_id="1", job_id="2").run()
-        self.assert_job_result("2", 100, "CSAR(1) is deleting now.")
-
-    def test_get_nf_csars_normal(self):
-        NfPackageModel(uuid="01", nfpackageid="1", vnfdid="2").save()
-        resp = self.client.get("/api/nslcm/v0/vnfpackage")
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-        self.assertEqual(1, len(resp.data["csars"]))
-        self.assertEqual("1", resp.data["csars"][0]["csarId"])
-        self.assertEqual("2", resp.data["csars"][0]["vnfdId"])
-
-
-vims_info = {
-    "cloud-region": [
-        {
-            "cloud-owner": "example-cloud-owner-val-60268",
-            "cloud-region-id": "example-cloud-region-id-val-77704",
-            "cloud-type": "example-cloud-type-val-20689",
-            "owner-defined-type": "example-owner-defined-type-val-24237",
-            "cloud-region-version": "example-cloud-region-version-val-95948",
-            "identity-url": "example-identity-url-val-98336",
-            "cloud-zone": "example-cloud-zone-val-67202",
-            "complex-name": "example-complex-name-val-86264",
-            "sriov-automation": True,
-            "cloud-extra-info": "example-cloud-extra-info-val-44735",
-            "cloud-epa-caps": "example-cloud-epa-caps-val-67134",
-            "resource-version": "example-resource-version-val-47608",
-            "volume-groups": {
-                "volume-group": [
-                    {
-                        "volume-group-id": "example-volume-group-id-val-79555",
-                        "volume-group-name": "example-volume-group-name-val-21888",
-                        "heat-stack-id": "example-heat-stack-id-val-56926",
-                        "vnf-type": "example-vnf-type-val-47890",
-                        "orchestration-status": "example-orchestration-status-val-34971",
-                        "model-customization-id": "example-model-customization-id-val-7851",
-                        "vf-module-model-customization-id": "example-vf-module-model-customization-id-val-35365",
-                        "resource-version": "example-resource-version-val-66022"
-                    }
-                ]
-            },
-            "tenants": {
-                "tenant": [
-                    {
-                        "tenant-id": "example-tenant-id-val-30151",
-                        "tenant-name": "example-tenant-name-val-12231",
-                        "tenant-context": "example-tenant-context-val-80991",
-                        "resource-version": "example-resource-version-val-5033",
-                        "vservers": {
-                            "vserver": [
-                                {
-                                    "vserver-id": "example-vserver-id-val-70581",
-                                    "vserver-name": "example-vserver-name-val-63390",
-                                    "vserver-name2": "example-vserver-name2-val-70924",
-                                    "prov-status": "example-prov-status-val-24088",
-                                    "vserver-selflink": "example-vserver-selflink-val-17737",
-                                    "in-maint": True,
-                                    "is-closed-loop-disabled": True,
-                                    "resource-version": "example-resource-version-val-46166",
-                                    "volumes": {
-                                        "volume": [
-                                            {
-                                                "volume-id": "example-volume-id-val-9740",
-                                                "volume-selflink": "example-volume-selflink-val-8411",
-                                                "resource-version": "example-resource-version-val-41965"
-                                            }
-                                        ]
-                                    },
-                                    "l-interfaces": {
-                                        "l-interface": [
-                                            {
-                                                "interface-name": "example-interface-name-val-67663",
-                                                "interface-role": "example-interface-role-val-27132",
-                                                "v6-wan-link-ip": "example-v6-wan-link-ip-val-85445",
-                                                "selflink": "example-selflink-val-83317",
-                                                "interface-id": "example-interface-id-val-98716",
-                                                "macaddr": "example-macaddr-val-18235",
-                                                "network-name": "example-network-name-val-45040",
-                                                "management-option": "example-management-option-val-65761",
-                                                "interface-description": "example-interface-description-val-32615",
-                                                "is-port-mirrored": True,
-                                                "resource-version": "example-resource-version-val-10801",
-                                                "in-maint": True,
-                                                "prov-status": "example-prov-status-val-5726",
-                                                "is-ip-unnumbered": True,
-                                                "allowed-address-pairs": "example-allowed-address-pairs-val-52679",
-                                                "vlans": {
-                                                    "vlan": [
-                                                        {
-                                                            "vlan-interface": "example-vlan-interface-val-61591",
-                                                            "vlan-id-inner": 53472228,
-                                                            "vlan-id-outer": 93087267,
-                                                            "resource-version": "example-resource-version-val-52900",
-                                                            "speed-value": "example-speed-value-val-69335",
-                                                            "speed-units": "example-speed-units-val-72089",
-                                                            "vlan-description": "example-vlan-description-val-96604",
-                                                            "backdoor-connection": "example-backdoor-connection-val-42299",
-                                                            "vpn-key": "example-vpn-key-val-50517",
-                                                            "orchestration-status": "example-orchestration-status-val-66570",
-                                                            "in-maint": True,
-                                                            "prov-status": "example-prov-status-val-46495",
-                                                            "is-ip-unnumbered": True,
-                                                            "l3-interface-ipv4-address-list": [
-                                                                {
-                                                                    "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-32173",
-                                                                    "l3-interface-ipv4-prefix-length": 29740951,
-                                                                    "vlan-id-inner": 93873764,
-                                                                    "vlan-id-outer": 82615508,
-                                                                    "is-floating": True,
-                                                                    "resource-version": "example-resource-version-val-75216",
-                                                                    "neutron-network-id": "example-neutron-network-id-val-77878",
-                                                                    "neutron-subnet-id": "example-neutron-subnet-id-val-79062"
-                                                                }
-                                                            ],
-                                                            "l3-interface-ipv6-address-list": [
-                                                                {
-                                                                    "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-88548",
-                                                                    "l3-interface-ipv6-prefix-length": 89047373,
-                                                                    "vlan-id-inner": 95671681,
-                                                                    "vlan-id-outer": 88533796,
-                                                                    "is-floating": True,
-                                                                    "resource-version": "example-resource-version-val-40990",
-                                                                    "neutron-network-id": "example-neutron-network-id-val-81951",
-                                                                    "neutron-subnet-id": "example-neutron-subnet-id-val-4218"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                "sriov-vfs": {
-                                                    "sriov-vf": [
-                                                        {
-                                                            "pci-id": "example-pci-id-val-12933",
-                                                            "vf-vlan-filter": "example-vf-vlan-filter-val-90275",
-                                                            "vf-mac-filter": "example-vf-mac-filter-val-13509",
-                                                            "vf-vlan-strip": True,
-                                                            "vf-vlan-anti-spoof-check": True,
-                                                            "vf-mac-anti-spoof-check": True,
-                                                            "vf-mirrors": "example-vf-mirrors-val-59746",
-                                                            "vf-broadcast-allow": True,
-                                                            "vf-unknown-multicast-allow": True,
-                                                            "vf-unknown-unicast-allow": True,
-                                                            "vf-insert-stag": True,
-                                                            "vf-link-status": "example-vf-link-status-val-37662",
-                                                            "resource-version": "example-resource-version-val-86970",
-                                                            "neutron-network-id": "example-neutron-network-id-val-71727"
-                                                        }
-                                                    ]
-                                                },
-                                                "l-interfaces": {
-                                                    "l-interface": [
-                                                        {
-                                                            "interface-name": "example-interface-name-val-91632",
-                                                            "interface-role": "example-interface-role-val-59119",
-                                                            "v6-wan-link-ip": "example-v6-wan-link-ip-val-21039",
-                                                            "selflink": "example-selflink-val-16277",
-                                                            "interface-id": "example-interface-id-val-77457",
-                                                            "macaddr": "example-macaddr-val-49026",
-                                                            "network-name": "example-network-name-val-3483",
-                                                            "management-option": "example-management-option-val-16429",
-                                                            "interface-description": "example-interface-description-val-50889",
-                                                            "is-port-mirrored": True,
-                                                            "resource-version": "example-resource-version-val-30308",
-                                                            "in-maint": True,
-                                                            "prov-status": "example-prov-status-val-69406",
-                                                            "is-ip-unnumbered": True,
-                                                            "allowed-address-pairs": "example-allowed-address-pairs-val-49123"
-                                                        }
-                                                    ]
-                                                },
-                                                "l3-interface-ipv4-address-list": [
-                                                    {
-                                                        "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-63922",
-                                                        "l3-interface-ipv4-prefix-length": 13823411,
-                                                        "vlan-id-inner": 14316230,
-                                                        "vlan-id-outer": 66559625,
-                                                        "is-floating": True,
-                                                        "resource-version": "example-resource-version-val-30766",
-                                                        "neutron-network-id": "example-neutron-network-id-val-46636",
-                                                        "neutron-subnet-id": "example-neutron-subnet-id-val-96658"
-                                                    }
-                                                ],
-                                                "l3-interface-ipv6-address-list": [
-                                                    {
-                                                        "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-21246",
-                                                        "l3-interface-ipv6-prefix-length": 20226253,
-                                                        "vlan-id-inner": 68200128,
-                                                        "vlan-id-outer": 18442586,
-                                                        "is-floating": True,
-                                                        "resource-version": "example-resource-version-val-24602",
-                                                        "neutron-network-id": "example-neutron-network-id-val-49811",
-                                                        "neutron-subnet-id": "example-neutron-subnet-id-val-67505"
-                                                    }
-                                                ]
-                                            }
-                                        ]
-                                    }
-                                }
-                            ]
-                        }
-                    }
-                ]
-            },
-            "flavors": {
-                "flavor": [
-                    {
-                        "flavor-id": "example-flavor-id-val-15058",
-                        "flavor-name": "example-flavor-name-val-69485",
-                        "flavor-vcpus": 92601,
-                        "flavor-ram": 31468,
-                        "flavor-disk": 58744,
-                        "flavor-ephemeral": 84771,
-                        "flavor-swap": "example-flavor-swap-val-66481",
-                        "flavor-is-public": True,
-                        "flavor-selflink": "example-flavor-selflink-val-48912",
-                        "flavor-disabled": True,
-                        "resource-version": "example-resource-version-val-55131"
-                    }
-                ]
-            },
-            "group-assignments": {
-                "group-assignment": [
-                    {
-                        "group-id": "example-group-id-val-79234",
-                        "group-type": "example-group-type-val-29164",
-                        "group-name": "example-group-name-val-57605",
-                        "group-description": "example-group-description-val-52975",
-                        "resource-version": "example-resource-version-val-10280"
-                    }
-                ]
-            },
-            "snapshots": {
-                "snapshot": [
-                    {
-                        "snapshot-id": "example-snapshot-id-val-60630",
-                        "snapshot-name": "example-snapshot-name-val-90351",
-                        "snapshot-architecture": "example-snapshot-architecture-val-3225",
-                        "snapshot-os-distro": "example-snapshot-os-distro-val-31399",
-                        "snapshot-os-version": "example-snapshot-os-version-val-16981",
-                        "application": "example-application-val-34584",
-                        "application-vendor": "example-application-vendor-val-97854",
-                        "application-version": "example-application-version-val-20705",
-                        "snapshot-selflink": "example-snapshot-selflink-val-84731",
-                        "prev-snapshot-id": "example-prev-snapshot-id-val-77339",
-                        "resource-version": "example-resource-version-val-19220"
-                    }
-                ]
-            },
-            "images": {
-                "image": [
-                    {
-                        "image-id": "example-image-id-val-34721",
-                        "image-name": "example-image-name-val-64106",
-                        "image-architecture": "example-image-architecture-val-8247",
-                        "image-os-distro": "example-image-os-distro-val-98534",
-                        "image-os-version": "example-image-os-version-val-87444",
-                        "application": "example-application-val-30758",
-                        "application-vendor": "example-application-vendor-val-7048",
-                        "application-version": "example-application-version-val-79678",
-                        "image-selflink": "example-image-selflink-val-72836",
-                        "resource-version": "example-resource-version-val-79432",
-                        "metadata": {
-                            "metadatum": [
-                                {
-                                    "metaname": "example-metaname-val-75188",
-                                    "metaval": "example-metaval-val-64947",
-                                    "resource-version": "example-resource-version-val-59427"
-                                }
-                            ]
-                        }
-                    }
-                ]
-            },
-            "dvs-switches": {
-                "dvs-switch": [
-                    {
-                        "switch-name": "example-switch-name-val-21335",
-                        "vcenter-url": "example-vcenter-url-val-74348",
-                        "resource-version": "example-resource-version-val-51253"
-                    }
-                ]
-            },
-            "oam-networks": {
-                "oam-network": [
-                    {
-                        "network-uuid": "example-network-uuid-val-65686",
-                        "network-name": "example-network-name-val-94383",
-                        "cvlan-tag": 31041170,
-                        "ipv4-oam-gateway-address": "example-ipv4-oam-gateway-address-val-15815",
-                        "ipv4-oam-gateway-address-prefix-length": 65477,
-                        "resource-version": "example-resource-version-val-21712"
-                    }
-                ]
-            },
-            "availability-zones": {
-                "availability-zone": [
-                    {
-                        "availability-zone-name": "example-availability-zone-name-val-14569",
-                        "hypervisor-type": "example-hypervisor-type-val-70481",
-                        "operational-status": "example-operational-status-val-13589",
-                        "resource-version": "example-resource-version-val-78031"
-                    }
-                ]
-            },
-            "esr-system-info-list": {
-                "esr-system-info": [
-                    {
-                        "esr-system-info-id": "example-esr-system-info-id-val-58799",
-                        "system-name": "example-system-name-val-78629",
-                        "type": "example-type-val-4146",
-                        "vendor": "example-vendor-val-11916",
-                        "version": "example-version-val-60284",
-                        "service-url": "example-service-url-val-85858",
-                        "user-name": "example-user-name-val-23297",
-                        "password": "example-password-val-33729",
-                        "system-type": "example-system-type-val-54309",
-                        "protocal": "example-protocal-val-86585",
-                        "ssl-cacert": "example-ssl-cacert-val-95811",
-                        "ssl-insecure": True,
-                        "ip-address": "example-ip-address-val-62987",
-                        "port": "example-port-val-83650",
-                        "cloud-domain": "example-cloud-domain-val-9841",
-                        "default-tenant": "example-default-tenant-val-52776",
-                        "resource-version": "example-resource-version-val-61961"
-                    }
-                ]
-            }
-        }
-    ]
-}
diff --git a/lcm/packages/tests/test_ns.py b/lcm/packages/tests/test_ns.py
deleted file mode 100644 (file)
index 3a3c9ca..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-# Copyright 2016 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.
-import json
-import mock
-from rest_framework import status
-from django.test import TestCase
-from django.test import Client
-
-from lcm.pub.utils import restcall
-from lcm.pub.database.models import NSDModel, NSInstModel, NfPackageModel
-
-
-class TestNsPackage(TestCase):
-    def setUp(self):
-        self.client = Client()
-        NSDModel.objects.filter().delete()
-        NSInstModel.objects.filter().delete()
-        NfPackageModel.objects.filter().delete()
-        self.nsd_raw_data = {
-            "rawData": {
-                "instance": {
-                    "metadata": {
-                        "vendor": "ZTE",
-                        "name": "VBRAS_NS",
-                        "csarVersion": 1,
-                        "csarType": "NSAR",
-                        "csarProvider": "ZTE",
-                        "version": 1,
-                        "invariant_id": "VBRAS_NS_NO_SFC",
-                        "id": "VBRAS_NS_ZTE_1.0",
-                        "description": "VBRAS_ZTE_NS"
-                    },
-                    "nodes": [
-                        {
-                            "id": "VBras_yfye7lsgi73p8j4p2a6vbguzd",
-                            "type_name": "tosca.nodes.nfv.ext.zte.VNF.VBras",
-                            "template_name": "VBras",
-                            "properties": {
-                                "vendor": {
-                                    "type_name": "string",
-                                    "value": "zte"
-                                },
-                                "name": {
-                                    "type_name": "string",
-                                    "value": "vbras"
-                                },
-                                "version": {
-                                    "type_name": "string",
-                                    "value": "1.0"
-                                },
-                                "vnf_type": {
-                                    "type_name": "string",
-                                    "value": "vbras"
-                                },
-                                "vnfd_version": {
-                                    "type_name": "string",
-                                    "value": "1.0.0"
-                                },
-                                "id": {
-                                    "type_name": "string",
-                                    "value": "zte_vbras_1.0"
-                                }
-                            }
-                        }
-                    ]
-                },
-                "model": {
-                    "metadata": {
-                        "vendor": "ZTE",
-                        "name": "VBRAS_NS",
-                        "csarVersion": 1,
-                        "csarType": "NSAR",
-                        "csarProvider": "ZTE",
-                        "version": 1,
-                        "invariant_id": "VBRAS_NS_NO_SFC",
-                        "id": "VBRAS_NS_ZTE_1.0",
-                        "description": "VBRAS_ZTE_NS"
-                    },
-                    "node_templates": [
-                        {
-                            "name": "VBras",
-                            "type_name": "tosca.nodes.nfv.ext.zte.VNF.VBras",
-                            "default_instances": 1,
-                            "min_instances": 0,
-                            "properties": {
-                                "vendor": {
-                                    "type_name": "string",
-                                    "value": "zte"
-                                },
-                                "name": {
-                                    "type_name": "string",
-                                    "value": "vbras"
-                                },
-                                "version": {
-                                    "type_name": "string",
-                                    "value": "1.0"
-                                },
-                                "vnf_type": {
-                                    "type_name": "string",
-                                    "value": "vbras"
-                                },
-                                "vnfd_version": {
-                                    "type_name": "string",
-                                    "value": "1.0.0"
-                                },
-                                "id": {
-                                    "type_name": "string",
-                                    "value": "zte_vbras_1.0"
-                                }
-                            },
-                            "requirement_templates": [
-                                {
-                                    "name": "lb_mnet_vl_cp",
-                                    "target_node_template_name": "ext_mnet_net",
-                                    "target_capability_name": "virtual_linkable"
-                                }
-                            ]
-                        }
-                    ]
-                }
-            }
-        }
-
-    def tearDown(self):
-        pass
-
-    def set_nsd_metadata(self, key, val):
-        self.nsd_raw_data["rawData"]["instance"]["metadata"][key] = val
-
-    def set_nsd_vnf_id(self, val):
-        self.nsd_raw_data["rawData"]["instance"]["nodes"][0]["properties"]["id"]["value"] = val
-
-    ###############################################################################################################
-    def test_delete_pending_csar_when_id_not_exist(self):
-        resp = self.client.delete("/api/nslcm/v0/nspackage/9/deletionpending")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("success", resp.data["status"])
-        self.assertEqual("Delete pending CSAR(9) successfully.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_pending_is_false(self, mock_call_req):
-        mock_call_req.return_value = [0, '{"deletionPending": "false"}', '200']
-        NSDModel(id="10", nsd_id="2").save()
-        resp = self.client.delete("/api/nslcm/v0/nspackage/10/deletionpending")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("failed", resp.data["status"])
-        self.assertEqual("CSAR(10) need not to be deleted.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_refed_by_ns(self, mock_call_req):
-        mock_call_req.return_value = [0, '{"deletionPending": "true"}', '200']
-        NSDModel(id="11", nsd_id="2").save()
-        NSInstModel(id="1", nspackage_id="11").save()
-        resp = self.client.delete("/api/nslcm/v0/nspackage/11/deletionpending")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("failed", resp.data["status"])
-        self.assertEqual("CSAR(11) is in using, cannot be deleted.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_delete_pending_csar_when_delete_success(self, mock_call_req):
-        mock_call_req.side_effect = [
-            [0, '{"deletionPending": "true"}', '200'],
-            [0, "OK", '204']]
-        NSDModel(id="12", nsd_id="2").save()
-        resp = self.client.delete("/api/nslcm/v0/nspackage/12/deletionpending")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("success", resp.data["status"])
-        self.assertEqual("Delete CSAR(12) successfully.", resp.data["statusDescription"])
-
-    ###############################################################################################################
-    def test_disable_csar_when_id_not_exist_table(self):
-        resp = self.client.put("/api/nslcm/v0/nspackage/14/disabled")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("failed", resp.data["status"])
-        self.assertEqual("CSAR(14) does not exist.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_disable_csar_when_csar_is_disabled(self, mock_call_req):
-        NSDModel(id="15", nsd_id="2").save()
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({"operationalState": "Disabled"}), '200']
-        resp = self.client.put("/api/nslcm/v0/nspackage/15/disabled")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("failed", resp.data["status"])
-        self.assertEqual("CSAR(15) already disabled.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_disable_csar_successfully(self, mock_call_req):
-        NSDModel(id="16", nsd_id="2").save()
-        mock_vals = {
-            "/api/catalog/v1/csars/16":
-                [0, json.JSONEncoder().encode({"operationalState": "Enabled"}), '200'],
-            "/api/catalog/v1/csars/16?operationState=Disabled":
-                [0, "OK", '200']}
-
-        def side_effect(*args):
-            return mock_vals[args[4]]
-        mock_call_req.side_effect = side_effect
-
-        resp = self.client.put("/api/nslcm/v0/nspackage/16/disabled")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("success", resp.data["status"])
-        self.assertEqual("Set operationState to Disabled of CSAR(16) successfully.", resp.data["statusDescription"])
-
-    ###############################################################################################################
-    def test_enable_csar_when_id_not_exist_table(self):
-        resp = self.client.put("/api/nslcm/v0/nspackage/17/enabled")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("failed", resp.data["status"])
-        self.assertEqual("CSAR(17) does not exist.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_enable_csar_when_csar_is_enabled(self, mock_call_req):
-        NSDModel(id="18", nsd_id="2").save()
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({"operationalState": "Enabled"}), '200']
-        resp = self.client.put("/api/nslcm/v0/nspackage/18/enabled")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("failed", resp.data["status"])
-        self.assertEqual("CSAR(18) already enabled.", resp.data["statusDescription"])
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_enable_csar_successfully(self, mock_call_req):
-        NSDModel(id="19", nsd_id="2").save()
-        mock_vals = {
-            "/api/catalog/v1/csars/19":
-                [0, json.JSONEncoder().encode({"operationalState": "Disabled"}), '200'],
-            "/api/catalog/v1/csars/19?operationState=Enabled":
-                [0, "OK", '200']}
-
-        def side_effect(*args):
-            return mock_vals[args[4]]
-        mock_call_req.side_effect = side_effect
-
-        resp = self.client.put("/api/nslcm/v0/nspackage/19/enabled")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-        self.assertEqual("success", resp.data["status"])
-        self.assertEqual("Set operationState to Enabled of CSAR(19) successfully.", resp.data["statusDescription"])
diff --git a/lcm/packages/tests/test_sdc_nf.py b/lcm/packages/tests/test_sdc_nf.py
deleted file mode 100644 (file)
index 6c95b85..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-# 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.
-import json
-
-import mock
-from django.test import Client
-from django.test import TestCase
-from rest_framework import status
-
-from lcm.packages.sdc_nf_package import SdcNfDistributeThread, SdcNfPkgDeleteThread
-from lcm.pub.database.models import JobStatusModel, JobModel
-from lcm.pub.database.models import NfPackageModel, NfInstModel
-from lcm.pub.msapi import sdc
-from lcm.pub.utils import restcall, toscaparser
-
-
-class TestNfPackage(TestCase):
-    def setUp(self):
-        self.client = Client()
-        NfPackageModel.objects.filter().delete()
-        NfInstModel.objects.filter().delete()
-        JobModel.objects.filter().delete()
-        JobStatusModel.objects.filter().delete()
-        self.vnfd_data = {
-            "volume_storages": [
-                {
-                    "properties": {
-                        "size_of_storage": {
-                            "factor": 10,
-                            "value": 10000000000,
-                            "unit": "GB",
-                            "unit_size": 1000000000
-                        },
-                        "type_of_storage": "volume",
-                        "rdma_enabled": False,
-                        "size": "10 GB"
-                    },
-                    "volume_storage_id": "vNAT_Storage_6wdgwzedlb6sq18uzrr41sof7",
-                    "description": ""
-                }
-            ],
-            "inputs": {},
-            "vdus": [
-                {
-                    "volume_storages": [
-                        "vNAT_Storage_6wdgwzedlb6sq18uzrr41sof7"
-                    ],
-                    "description": "",
-                    "dependencies": [],
-                    "vls": [],
-                    "properties": {
-                        "name": "vNat",
-                        "configurable_properties": {
-                            "test": {
-                                "additional_vnfc_configurable_properties": {
-                                    "aaa": "1",
-                                    "bbb": "2",
-                                    "ccc": "3"
-                                }
-                            }
-                        },
-                        "description": "the virtual machine of vNat",
-                        "nfvi_constraints": [
-                            "test"
-                        ],
-                        "boot_order": [
-                            "vNAT_Storage"
-                        ]
-                    },
-                    "vdu_id": "vdu_vNat",
-                    "artifacts": [
-                        {
-                            "artifact_name": "vNatVNFImage",
-                            "type": "tosca.artifacts.nfv.SwImage",
-                            "properties": {
-                                "operating_system": "linux",
-                                "sw_image": "/swimages/vRouterVNF_ControlPlane.qcow2",
-                                "name": "vNatVNFImage",
-                                "container_format": "bare",
-                                "min_ram": "1 GB",
-                                "disk_format": "qcow2",
-                                "supported_virtualisation_environments": [
-                                    "test_0"
-                                ],
-                                "version": "1.0",
-                                "checksum": "5000",
-                                "min_disk": "10 GB",
-                                "size": "10 GB"
-                            },
-                            "file": "/swimages/vRouterVNF_ControlPlane.qcow2"
-                        }
-                    ],
-                    "nfv_compute": {
-                        "flavor_extra_specs": {
-                            "hw:cpu_sockets": "2",
-                            "sw:ovs_dpdk": "true",
-                            "hw:cpu_threads": "2",
-                            "hw:numa_mem.1": "3072",
-                            "hw:numa_mem.0": "1024",
-                            "hw:numa_nodes": "2",
-                            "hw:numa_cpus.0": "0,1",
-                            "hw:numa_cpus.1": "2,3,4,5",
-                            "hw:cpu_cores": "2",
-                            "hw:cpu_threads_policy": "isolate"
-                        },
-                        "cpu_frequency": "2.4 GHz",
-                        "num_cpus": 2,
-                        "mem_size": "10 GB"
-                    },
-                    "local_storages": [],
-                    "image_file": "vNatVNFImage",
-                    "cps": []
-                }
-            ],
-            "image_files": [
-                {
-                    "properties": {
-                        "operating_system": "linux",
-                        "sw_image": "/swimages/vRouterVNF_ControlPlane.qcow2",
-                        "name": "vNatVNFImage",
-                        "container_format": "bare",
-                        "min_ram": "1 GB",
-                        "disk_format": "qcow2",
-                        "supported_virtualisation_environments": [
-                            "test_0"
-                        ],
-                        "version": "1.0",
-                        "checksum": "5000",
-                        "min_disk": "10 GB",
-                        "size": "10 GB"
-                    },
-                    "image_file_id": "vNatVNFImage",
-                    "description": ""
-                }
-            ],
-            "routers": [],
-            "local_storages": [],
-            "vnf_exposed": {
-                "external_cps": [
-                    {
-                        "key_name": "sriov_plane",
-                        "cp_id": "SRIOV_Port"
-                    }
-                ],
-                "forward_cps": []
-            },
-            "vls": [
-                {
-                    "route_id": "",
-                    "vl_id": "sriov_link",
-                    "route_external": False,
-                    "description": "",
-                    "properties": {
-                        "vl_flavours": {
-                            "vl_id": "aaaa"
-                        },
-                        "connectivity_type": {
-                            "layer_protocol": "ipv4",
-                            "flow_pattern": "flat"
-                        },
-                        "description": "sriov_link",
-                        "test_access": [
-                            "test"
-                        ]
-                    }
-                }
-            ],
-            "cps": [
-                {
-                    "vl_id": "sriov_link",
-                    "vdu_id": "vdu_vNat",
-                    "description": "",
-                    "cp_id": "SRIOV_Port",
-                    "properties": {
-                        "address_data": [
-                            {
-                                "address_type": "ip_address",
-                                "l3_address_data": {
-                                    "ip_address_type": "ipv4",
-                                    "floating_ip_activated": False,
-                                    "number_of_ip_address": 1,
-                                    "ip_address_assignment": True
-                                }
-                            }
-                        ],
-                        "description": "sriov port",
-                        "layer_protocol": "ipv4",
-                        "virtual_network_interface_requirements": [
-                            {
-                                "requirement": {
-                                    "SRIOV": "true"
-                                },
-                                "support_mandatory": False,
-                                "name": "sriov",
-                                "description": "sriov"
-                            },
-                            {
-                                "requirement": {
-                                    "SRIOV": "False"
-                                },
-                                "support_mandatory": False,
-                                "name": "normal",
-                                "description": "normal"
-                            }
-                        ],
-                        "role": "root",
-                        "bitrate_requirement": 10
-                    }
-                }
-            ],
-            "metadata": {
-                "vnfSoftwareVersion": "1.0.0",
-                "vnfProductName": "zte",
-                "localizationLanguage": [
-                    "english",
-                    "chinese"
-                ],
-                "vnfProvider": "zte",
-                "vnfmInfo": "zte",
-                "defaultLocalizationLanguage": "english",
-                "vnfdId": "zte-hss-1.0",
-                "id": "zte-hss-1.0",
-                "vnfProductInfoDescription": "hss",
-                "vnfdVersion": "1.0.0",
-                "vnfProductInfoName": "hss"
-            }
-        }
-
-    def tearDown(self):
-        pass
-
-    def assert_job_result(self, job_id, job_progress, job_detail):
-        jobs = JobStatusModel.objects.filter(
-            jobid=job_id,
-            progress=job_progress,
-            descp=job_detail)
-        self.assertEqual(1, len(jobs))
-
-    @mock.patch.object(SdcNfDistributeThread, 'run')
-    def test_nf_pkg_distribute_normal(self, mock_run):
-        resp = self.client.post("/api/nslcm/v1/vnfpackage", {"csarId": "1", "vimIds": ["1"]}, format='json')
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-
-    def test_nf_pkg_distribute_when_csar_already_exist(self):
-        NfPackageModel(uuid="1", nfpackageid="1", vnfdid="vcpe_vfw_zte_1_0").save()
-        SdcNfDistributeThread(csar_id="1", vim_ids=["1"], lab_vim_id="", job_id="2").run()
-        self.assert_job_result("2", 255, "NF CSAR(1) already exists.")
-
-    @mock.patch.object(restcall, 'call_req')
-    @mock.patch.object(sdc, 'download_artifacts')
-    @mock.patch.object(toscaparser, 'parse_vnfd')
-    def test_nf_pkg_distribute_when_vnfd_already_exist(self, mock_parse_vnfd, mock_download_artifacts,
-                                                       mock_call_req):
-        mock_parse_vnfd.return_value = json.JSONEncoder().encode(self.vnfd_data)
-        mock_download_artifacts.return_value = "/home/hss.csar"
-        mock_call_req.return_value = [0, json.JSONEncoder().encode([{
-            "uuid": "1",
-            "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/hss.csar"
-        }]), '200']
-        NfPackageModel(uuid="2", nfpackageid="2", vnfdid="zte-hss-1.0").save()
-        SdcNfDistributeThread(csar_id="1", vim_ids=["1"], lab_vim_id="", job_id="2").run()
-        self.assert_job_result("2", 255, "NFD(zte-hss-1.0) already exists.")
-
-    @mock.patch.object(restcall, 'call_req')
-    @mock.patch.object(sdc, 'download_artifacts')
-    @mock.patch.object(toscaparser, 'parse_vnfd')
-    def test_nf_pkg_distribute_successfully(self, mock_parse_vnfd, mock_download_artifacts, mock_call_req):
-        mock_parse_vnfd.return_value = json.JSONEncoder().encode(self.vnfd_data)
-        mock_download_artifacts.return_value = "/home/hss.csar"
-        mock_call_req.return_value = [0, json.JSONEncoder().encode([{
-            "uuid": "1",
-            "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/hss.csar"
-        }]), '200']
-        SdcNfDistributeThread(csar_id="1", vim_ids=["1"], lab_vim_id="", job_id="4").run()
-        self.assert_job_result("4", 100, "CSAR(1) distribute successfully.")
-
-    ###############################################################################################################
-
-    @mock.patch.object(SdcNfPkgDeleteThread, 'run')
-    def test_nf_pkg_delete_normal(self, mock_run):
-        resp = self.client.delete("/api/nslcm/v1/vnfpackage/1")
-        self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED)
-
-    def test_nf_pkg_normal_delete(self):
-        NfPackageModel(uuid="2", nfpackageid="2", vnfdid="vcpe_vfw_zte_1_0").save()
-        SdcNfPkgDeleteThread(csar_id="2", job_id="2", force_delete=False).run()
-        self.assert_job_result("2", 100, "Delete CSAR(2) successfully.")
-
-    def test_nf_pkg_force_delete(self):
-        NfPackageModel(uuid="1", nfpackageid="1", vnfdid="vcpe_vfw_zte_1_0").save()
-        NfInstModel(nfinstid="1", package_id="1").save()
-        SdcNfPkgDeleteThread(csar_id="1", job_id="2", force_delete=True).run()
-        self.assert_job_result("2", 100, "Delete CSAR(1) successfully.")
-
-    def test_nf_pkg_delete_when_pkg_in_using(self):
-        NfPackageModel(uuid="3", nfpackageid="3", vnfdid="vcpe_vfw_zte_1_0").save()
-        NfInstModel(nfinstid="3", package_id="3").save()
-        SdcNfPkgDeleteThread(csar_id="3", job_id="2", force_delete=False).run()
-        self.assert_job_result("2", 255, "NfInst by csar(3) exists, cannot delete.")
-
-    def test_nf_pkg_get_all(self):
-        NfPackageModel(uuid="3", nfpackageid="3", vnfdid="4").save()
-
-        resp = self.client.get("/api/nslcm/v1/vnfpackage")
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-        self.assertEqual({"csars": [{"csarId": "3", "vnfdId": "4"}]}, resp.data)
-
-    @mock.patch.object(restcall, 'call_req')
-    def test_nf_pkg_get_one(self, mock_call_req):
-        NfPackageModel(uuid="4", nfpackageid="4", vnfdid="5", vendor="6", vnfdversion="7", vnfversion="8").save()
-        NfInstModel(nfinstid="1", package_id="4", nf_name="3").save()
-        mock_call_req.return_value = [0, json.JSONEncoder().encode({
-            "packageInfo": {
-                "vnfdId": "5",
-                "vnfdProvider": "6",
-                "vnfdVersion": "7",
-                "vnfVersion": "8"
-            }
-        }), '200']
-
-        resp = self.client.get("/api/nslcm/v1/vnfpackage/4")
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-        expect_data = {
-            "csarId": "4",
-            "packageInfo": {
-                "vnfdId": "5",
-                "vnfdProvider": "6",
-                "vnfdVersion": "7",
-                "vnfVersion": "8"
-            },
-            "imageInfo": [],
-            "vnfInstanceInfo": [{
-                "vnfInstanceId": "1", "vnfInstanceName": "3"
-            }]
-        }
-        self.assertEqual(expect_data, resp.data)
diff --git a/lcm/packages/urls.py b/lcm/packages/urls.py
deleted file mode 100644 (file)
index cdde953..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2016 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.
-
-from django.conf.urls import url
-from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.packages import views
-
-urlpatterns = [
-    url(r'^api/nslcm/v1/vnfpackage$', views.nf_distribute_get, name='nf_distribute_get'),
-    url(r'^api/nslcm/v1/vnfpackage/(?P<csarId>[0-9a-zA-Z\-\_]+)$', views.nf_rd_csar, name='nf_rd_csar'),
-    #########################################################################################
-    url(r'^api/nslcm/v0/nspackage/(?P<csarId>[0-9a-zA-Z\-\_]+)/deletionpending$',
-        views.ns_delete_pending_csar, name='ns_delete_pending_csar'),
-    url(r'^api/nslcm/v0/nspackage/(?P<csarId>[0-9a-zA-Z\-\_]+)/(?P<operation>(disabled|enabled))$',
-        views.ns_set_state_csar, name='ns_set_state_csar'),
-    url(r'^api/nslcm/v0/vnfpackage/(?P<csarId>[0-9a-zA-Z\-\_]+)$', views.nf_access_csar, name='nf_access_csar'),
-    url(r'^api/nslcm/v0/vnfpackage$', views.nf_on_boarding, name='nf_on_boarding'),
-    url(r'^api/nslcm/v0/vnfpackage/(?P<csarId>[0-9a-zA-Z\-\_]+)/deletionpending$',
-        views.nf_delete_pending_csar, name='nf_delete_pending_csar'), ]
-
-urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/lcm/packages/views.py b/lcm/packages/views.py
deleted file mode 100644 (file)
index 0b6af8b..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-# Copyright 2016-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.
-
-import logging
-import uuid
-
-from rest_framework import status
-from rest_framework.decorators import api_view
-from rest_framework.response import Response
-
-from lcm.pub.utils.values import ignore_case_get
-from lcm.pub.utils.syscomm import fun_name
-from lcm.packages import ns_package, nf_package, sdc_nf_package
-
-logger = logging.getLogger(__name__)
-
-
-####################################################################################################
-@api_view(http_method_names=['POST', 'GET'])
-def nf_distribute_get(request, *args, **kwargs):
-    logger.debug("Enter %s%s, method is %s", fun_name(), request.data, request.method)
-    ret, normal_status = None, None
-    if request.method == 'GET':
-        ret = sdc_nf_package.nf_get_csars()
-        normal_status = status.HTTP_200_OK
-    else:
-        csar_id = ignore_case_get(request.data, "csarId")
-        vim_ids = ignore_case_get(request.data, "vimIds")
-        lab_vim_id = ignore_case_get(request.data, "labVimId")
-        job_id = str(uuid.uuid4())
-        sdc_nf_package.SdcNfDistributeThread(csar_id, vim_ids, lab_vim_id, job_id).start()
-        ret = [0, {"jobId": job_id}]
-        normal_status = status.HTTP_202_ACCEPTED
-    logger.debug("Leave %s, Return value is %s", fun_name(), ret)
-    if ret[0] != 0:
-        return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-    return Response(data=ret[1], status=normal_status)
-
-
-@api_view(http_method_names=['GET', 'DELETE'])
-def nf_rd_csar(request, *args, **kwargs):
-    csar_id = ignore_case_get(kwargs, "csarId")
-    logger.info("Enter %s, method is %s, csar_id is %s", fun_name(), request.method, csar_id)
-    ret, normal_status = None, None
-    if request.method == 'GET':
-        ret = sdc_nf_package.nf_get_csar(csar_id)
-        normal_status = status.HTTP_200_OK
-    else:
-        force_delete = csar_id.endswith("force")
-        if force_delete:
-            csar_id = csar_id[:-5]
-        job_id = str(uuid.uuid4())
-        sdc_nf_package.SdcNfPkgDeleteThread(csar_id, job_id, force_delete).start()
-        ret = [0, {"jobId": job_id}]
-        normal_status = status.HTTP_202_ACCEPTED
-    logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-    if ret[0] != 0:
-        return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-    return Response(data=ret[1], status=normal_status)
-
-
-####################################################################################################
-
-
-@api_view(http_method_names=['DELETE'])
-def ns_delete_pending_csar(request, *args, **kwargs):
-    csar_id = ignore_case_get(kwargs, "csarId")
-    logger.info("Enter %s, method is %s, csar_id is %s", fun_name(), request.method, csar_id)
-    ret = ns_package.ns_delete_pending_csar(csar_id)
-    logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-    if ret[0] != 0:
-        return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-    return Response(data=ret[1], status=status.HTTP_202_ACCEPTED)
-
-
-@api_view(http_method_names=['PUT'])
-def ns_set_state_csar(request, *args, **kwargs):
-    csar_id = ignore_case_get(kwargs, "csarId")
-    operation = ignore_case_get(kwargs, "operation")
-    logger.info("Enter %s, method is %s, csar_id is %s, operation is %s", fun_name(), request.method, csar_id, operation)
-    ret = ns_package.ns_set_state_csar(csar_id, operation)
-    logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-    if ret[0] != 0:
-        return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-    return Response(data=ret[1], status=status.HTTP_202_ACCEPTED)
-
-
-#################################################################################################################
-@api_view(http_method_names=['POST', 'GET'])
-def nf_on_boarding(request, *args, **kwargs):
-    logger.info("Enter %s%s, method is %s", fun_name(), request.data, request.method)
-    if request.method == 'GET':
-        ret = nf_package.NfPackage().get_csars()
-        logger.debug("csars=%s", str(ret))
-        return Response(data=ret, status=status.HTTP_200_OK)
-    csar_id = ignore_case_get(request.data, "csarId")
-    vim_ids = ignore_case_get(request.data, "vimIds")
-    lab_vim_id = ignore_case_get(request.data, "labVimId")
-    job_id = str(uuid.uuid4())
-    nf_package.NfOnBoardingThread(csar_id, vim_ids, lab_vim_id, job_id).start()
-    ret = {"jobId": job_id}
-    logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-    return Response(data=ret, status=status.HTTP_202_ACCEPTED)
-
-
-@api_view(http_method_names=['GET', 'DELETE'])
-def nf_access_csar(request, *args, **kwargs):
-    logger.info("Enter %s%s, method is %s", fun_name(), args, request.method)
-    csar_id = ignore_case_get(kwargs, "csarId")
-    if request.method == 'GET':
-        ret = nf_package.NfPackage().get_csar(csar_id)
-        logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-        if ret[0] != 0:
-            return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        return Response(data=ret[1], status=status.HTTP_200_OK)
-    # NF package deleting
-    job_id = str(uuid.uuid4())
-    nf_package.NfPkgDeleteThread(csar_id, job_id).start()
-    ret = {"jobId": job_id}
-    logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-    return Response(data=ret, status=status.HTTP_202_ACCEPTED)
-
-
-@api_view(http_method_names=['DELETE'])
-def nf_delete_pending_csar(request, *args, **kwargs):
-    logger.info("Enter %s%s, method is %s", fun_name(), args, request.method)
-    csar_id = ignore_case_get(kwargs, "csarId")
-    job_id = str(uuid.uuid4())
-    nf_package.NfPkgDeletePendingThread(csar_id, job_id).start()
-    ret = {"jobId": job_id}
-    logger.info("Leave %s, Return value is %s", fun_name(), str(ret))
-    return Response(data=ret, status=status.HTTP_202_ACCEPTED)
diff --git a/lcm/pub/utils/toscaparser/__init__.py b/lcm/pub/utils/toscaparser/__init__.py
deleted file mode 100644 (file)
index 075ae27..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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.
-
-import json
-
-from lcm.pub.utils.toscaparser.nsdmodel import EtsiNsdInfoModel
-from lcm.pub.utils.toscaparser.vnfdmodel import EtsiVnfdInfoModel
-
-
-def parse_nsd(path, input_parameters=[]):
-    tosca_obj = EtsiNsdInfoModel(path, input_parameters)
-    strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
-    strResponse = strResponse.replace(': null', ': ""')
-    return strResponse
-
-
-def parse_vnfd(path, input_parameters=[]):
-    tosca_obj = EtsiVnfdInfoModel(path, input_parameters)
-    strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
-    strResponse = strResponse.replace(': null', ': ""')
-    return strResponse
diff --git a/lcm/pub/utils/toscaparser/basemodel.py b/lcm/pub/utils/toscaparser/basemodel.py
deleted file mode 100644 (file)
index 461e8e1..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-# 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.
-
-import copy
-import ftplib
-import json
-import logging
-import os
-import re
-import shutil
-import urllib
-
-import paramiko
-from toscaparser.functions import GetInput
-from toscaparser.tosca_template import ToscaTemplate
-
-from lcm.pub.utils.toscaparser.dataentityext import DataEntityExt
-
-logger = logging.getLogger(__name__)
-
-
-class BaseInfoModel(object):
-
-    def buildToscaTemplate(self, path, params):
-        file_name = None
-        try:
-            file_name = self._check_download_file(path)
-            valid_params = self._validate_input_params(file_name, params)
-            return self._create_tosca_template(file_name, valid_params)
-        finally:
-            if file_name is not None and file_name != path and os.path.exists(file_name):
-                try:
-                    os.remove(file_name)
-                except Exception as e:
-                    logger.error("Failed to parse package, error: %s", e.message)
-
-    def _validate_input_params(self, path, params):
-        valid_params = {}
-        if params and len(params) > 0:
-            tmp = self._create_tosca_template(path, None)
-            for key, value in params.items():
-                if hasattr(tmp, 'inputs') and len(tmp.inputs) > 0:
-                    for input_def in tmp.inputs:
-                        if (input_def.name == key):
-                            valid_params[key] = DataEntityExt.validate_datatype(input_def.type, value)
-
-        return valid_params
-
-    def _create_tosca_template(self, file_name, valid_params):
-        tosca_tpl = None
-        try:
-            tosca_tpl = ToscaTemplate(path=file_name,
-                                      parsed_params=valid_params,
-                                      no_required_paras_check=True,
-                                      debug_mode=True)
-        except Exception as e:
-            print e.message
-        finally:
-            if tosca_tpl is not None and hasattr(tosca_tpl, "temp_dir") and os.path.exists(tosca_tpl.temp_dir):
-                try:
-                    shutil.rmtree(tosca_tpl.temp_dir)
-                except Exception, e:
-                    logger.error("Failed to create tosca template, error: %s", e.message)
-            print "-----------------------------"
-            print '\n'.join(['%s:%s' % item for item in tosca_tpl.__dict__.items()])
-            print "-----------------------------"
-            return tosca_tpl
-
-    def _check_download_file(self, path):
-        if (path.startswith("ftp") or path.startswith("sftp")):
-            return self.downloadFileFromFtpServer(path)
-        elif (path.startswith("http")):
-            return self.download_file_from_httpserver(path)
-        return path
-
-    def download_file_from_httpserver(self, path):
-        path = path.encode("utf-8")
-        tmps = str.split(path, '/')
-        localFileName = tmps[len(tmps) - 1]
-        urllib.urlretrieve(path, localFileName)
-        return localFileName
-
-    def downloadFileFromFtpServer(self, path):
-        path = path.encode("utf-8")
-        tmp = str.split(path, '://')
-        protocol = tmp[0]
-        tmp = str.split(tmp[1], ':')
-        if len(tmp) == 2:
-            userName = tmp[0]
-            tmp = str.split(tmp[1], '@')
-            userPwd = tmp[0]
-            index = tmp[1].index('/')
-            hostIp = tmp[1][0:index]
-            remoteFileName = tmp[1][index:len(tmp[1])]
-            if protocol.lower() == 'ftp':
-                hostPort = 21
-            else:
-                hostPort = 22
-
-        if len(tmp) == 3:
-            userName = tmp[0]
-            userPwd = str.split(tmp[1], '@')[0]
-            hostIp = str.split(tmp[1], '@')[1]
-            index = tmp[2].index('/')
-            hostPort = tmp[2][0:index]
-            remoteFileName = tmp[2][index:len(tmp[2])]
-
-        localFileName = str.split(remoteFileName, '/')
-        localFileName = localFileName[len(localFileName) - 1]
-
-        if protocol.lower() == 'sftp':
-            self.sftp_get(userName, userPwd, hostIp, hostPort, remoteFileName, localFileName)
-        else:
-            self.ftp_get(userName, userPwd, hostIp, hostPort, remoteFileName, localFileName)
-        return localFileName
-
-    def sftp_get(self, userName, userPwd, hostIp, hostPort, remoteFileName, localFileName):
-        # return
-        t = None
-        try:
-            t = paramiko.Transport(hostIp, int(hostPort))
-            t.connect(username=userName, password=userPwd)
-            sftp = paramiko.SFTPClient.from_transport(t)
-            sftp.get(remoteFileName, localFileName)
-        finally:
-            if t is not None:
-                t.close()
-
-    def ftp_get(self, userName, userPwd, hostIp, hostPort, remoteFileName, localFileName):
-        f = None
-        try:
-            ftp = ftplib.FTP()
-            ftp.connect(hostIp, hostPort)
-            ftp.login(userName, userPwd)
-            f = open(localFileName, 'wb')
-            ftp.retrbinary('RETR ' + remoteFileName, f.write, 1024)
-            f.close()
-        finally:
-            if f is not None:
-                f.close()
-
-    def buidMetadata(self, tosca):
-        if 'metadata' in tosca.tpl:
-            self.metadata = copy.deepcopy(tosca.tpl['metadata'])
-
-    def buildProperties(self, nodeTemplate, parsed_params):
-        properties = {}
-        isMappingParams = parsed_params and len(parsed_params) > 0
-        for k, item in nodeTemplate.get_properties().items():
-            properties[k] = item.value
-            if isinstance(item.value, GetInput):
-                if item.value.result() and isMappingParams:
-                    properties[k] = DataEntityExt.validate_datatype(item.type, item.value.result())
-                else:
-                    tmp = {}
-                    tmp[item.value.name] = item.value.input_name
-                    properties[k] = tmp
-        if 'attributes' in nodeTemplate.entity_tpl:
-            for k, item in nodeTemplate.entity_tpl['attributes'].items():
-                properties[k] = str(item)
-        return properties
-
-    def verify_properties(self, props, inputs, parsed_params):
-        ret_props = {}
-        if (props and len(props) > 0):
-            for key, value in props.items():
-                ret_props[key] = self._verify_value(value, inputs, parsed_params)
-                #                 if isinstance(value, str):
-                #                     ret_props[key] = self._verify_string(inputs, parsed_params, value);
-                #                     continue
-                #                 if isinstance(value, list):
-                #                     ret_props[key] = map(lambda x: self._verify_dict(inputs, parsed_params, x), value)
-                #                     continue
-                #                 if isinstance(value, dict):
-                #                     ret_props[key] = self._verify_map(inputs, parsed_params, value)
-                #                     continue
-                #                 ret_props[key] = value
-        return ret_props
-
-    def build_requirements(self, node_template):
-        rets = []
-        for req in node_template.requirements:
-            for req_name, req_value in req.items():
-                if (isinstance(req_value, dict)):
-                    if ('node' in req_value and req_value['node'] not in node_template.templates):
-                        continue  # No target requirement for aria parser, not add to result.
-                rets.append({req_name: req_value})
-        return rets
-
-    def buildCapabilities(self, nodeTemplate, inputs, ret):
-        capabilities = json.dumps(nodeTemplate.entity_tpl.get('capabilities', None))
-        match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}', capabilities)
-        for m in match:
-            aa = [input_def for input_def in inputs if m == input_def.name][0]
-            capabilities = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), capabilities, 1)
-        if capabilities != 'null':
-            ret['capabilities'] = json.loads(capabilities)
-
-    def buildArtifacts(self, nodeTemplate, inputs, ret):
-        artifacts = json.dumps(nodeTemplate.entity_tpl.get('artifacts', None))
-        match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}', artifacts)
-        for m in match:
-            aa = [input_def for input_def in inputs if m == input_def.name][0]
-            artifacts = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), artifacts, 1)
-        if artifacts != 'null':
-            ret['artifacts'] = json.loads(artifacts)
-
-    def build_interfaces(self, node_template):
-        if 'interfaces' in node_template.entity_tpl:
-            return node_template.entity_tpl['interfaces']
-        return None
-
-    def isVnf(self, node):
-        # return node['nodeType'].upper().find('.VNF.') >= 0 or node['nodeType'].upper().endswith('.VNF')
-        return node['nodeType'].upper().find('.VF.') >= 0 or node['nodeType'].upper().endswith('.VF')
-
-    def isPnf(self, node):
-        return node['nodeType'].upper().find('.PNF.') >= 0 or node['nodeType'].upper().endswith('.PNF')
-
-    def isCp(self, node):
-        return node['nodeType'].upper().find('.CP.') >= 0 or node['nodeType'].upper().endswith('.CP')
-
-    def isVl(self, node):
-        isvl = node['nodeType'].upper().find('.VIRTUALLINK.') >= 0 or node['nodeType'].upper().find('.VL.') >= 0
-        isvl = isvl or node['nodeType'].upper().endswith('.VIRTUALLINK') or node['nodeType'].upper().endswith('.VL')
-        return isvl
-
-    def isService(self, node):
-        return node['nodeType'].upper().find('.SERVICE.') >= 0 or node['nodeType'].upper().endswith('.SERVICE')
-
-    def get_requirement_node_name(self, req_value):
-        return self.get_prop_from_obj(req_value, 'node')
-
-    def get_prop_from_obj(self, obj, prop):
-        if isinstance(obj, str):
-            return obj
-        if (isinstance(obj, dict) and prop in obj):
-            return obj[prop]
-        return None
-
-    def getNodeDependencys(self, node):
-        return self.getRequirementByName(node, 'dependency')
-
-    def getVirtualLinks(self, node):
-        return self.getRequirementByName(node, 'virtualLink')
-
-    def getVirtualbindings(self, node):
-        return self.getRequirementByName(node, 'virtualbinding')
-
-    def getRequirementByName(self, node, requirementName):
-        requirements = []
-        if 'requirements' in node:
-            for item in node['requirements']:
-                for key, value in item.items():
-                    if key == requirementName:
-                        requirements.append(value)
-        return requirements
-
-    def get_networks(self, node):
-        rets = []
-        if 'requirements' in node:
-            for item in node['requirements']:
-                for key, value in item.items():
-                    if key.upper().find('VIRTUALLINK') >= 0:
-                        rets.append({"key_name": key, "vl_id": self.get_requirement_node_name(value)})
-        return rets
-
-    def _verify_value(self, value, inputs, parsed_params):
-        if isinstance(value, str):
-            return self._verify_string(inputs, parsed_params, value)
-        if isinstance(value, list) or isinstance(value, dict):
-            return self._verify_object(value, inputs, parsed_params)
-        return value
-
-    def _verify_object(self, value, inputs, parsed_params):
-        s = self._verify_string(inputs, parsed_params, json.dumps(value))
-        return json.loads(s)
-
-    def _get_input_name(self, getInput):
-        input_name = getInput.split(':')[1]
-        input_name = input_name.strip()
-        return input_name.replace('"', '').replace('}', '')
-
-    def _verify_string(self, inputs, parsed_params, value):
-        getInputs = re.findall(r'{"get_input": "[a-zA-Z_0-9]+"}', value)
-        for getInput in getInputs:
-            input_name = self._get_input_name(getInput)
-            if parsed_params and input_name in parsed_params:
-                value = value.replace(getInput, json.dumps(parsed_params[input_name]))
-            else:
-                for input_def in inputs:
-                    if input_def.default and input_name == input_def.name:
-                        value = value.replace(getInput, json.dumps(input_def.default))
-        return value
-
-    def get_node_vl_id(self, node):
-        vl_ids = map(lambda x: self.get_requirement_node_name(x), self.getVirtualLinks(node))
-        if len(vl_ids) > 0:
-            return vl_ids[0]
-        return ""
-
-    def get_node_by_name(self, node_templates, name):
-        for node in node_templates:
-            if node['name'] == name:
-                return node
-        return None
-
-    def get_all_nested_ns(self, nodes):
-        nss = []
-        for node in nodes:
-            if self.is_nested_ns(node):
-                ns = {}
-                ns['ns_id'] = node['name']
-                ns['description'] = node['description']
-                ns['properties'] = node['properties']
-                ns['networks'] = self.get_networks(node)
-
-                nss.append(ns)
-        return nss
-
-    def is_nested_ns(self, node):
-        return node['nodeType'].upper().find('.NS.') >= 0 or node['nodeType'].upper().endswith('.NS')
-
-    def isVdu(self, node):
-        return node['nodeType'].upper().find('.VDU.') >= 0 or node['nodeType'].upper().endswith('.VDU')
-
-    def getCapabilityByName(self, node, capabilityName):
-        if 'capabilities' in node and capabilityName in node['capabilities']:
-            return node['capabilities'][capabilityName]
-        return None
-
-    def get_node_vdu_id(self, node):
-        vdu_ids = map(lambda x: self.get_requirement_node_name(x), self.getVirtualbindings(node))
-        if len(vdu_ids) > 0:
-            return vdu_ids[0]
-        return ""
diff --git a/lcm/pub/utils/toscaparser/dataentityext.py b/lcm/pub/utils/toscaparser/dataentityext.py
deleted file mode 100644 (file)
index 825e93b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-from toscaparser.dataentity import DataEntity
-from toscaparser.elements.constraints import Schema
-from toscaparser.common.exception import ExceptionCollector
-
-
-class DataEntityExt(object):
-    '''A complex data value entity ext.'''
-    @staticmethod
-    def validate_datatype(type, value, entry_schema=None, custom_def=None):
-        if value:
-            if (type == Schema.STRING):
-                return str(value)
-            elif type == Schema.FLOAT:
-                try:
-                    return float(value)
-                except Exception:
-                    ExceptionCollector.appendException(ValueError(('"%s" is not an float.') % value))
-            return DataEntity.validate_datatype(type, value, entry_schema, custom_def)
-        return value
diff --git a/lcm/pub/utils/toscaparser/nsdmodel.py b/lcm/pub/utils/toscaparser/nsdmodel.py
deleted file mode 100644 (file)
index 9792dd9..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-# 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.
-
-import functools
-
-from lcm.pub.utils.toscaparser.basemodel import BaseInfoModel
-
-
-class EtsiNsdInfoModel(BaseInfoModel):
-
-    def __init__(self, path, params):
-        tosca = self.buildToscaTemplate(path, params)
-        self.parseModel(tosca)
-
-    def parseModel(self, tosca):
-        self.buidMetadata(tosca)
-        if hasattr(tosca, 'topology_template') and hasattr(tosca.topology_template, 'inputs'):
-            self.inputs = self.buildInputs(tosca.topology_template.inputs)
-
-        nodeTemplates = map(functools.partial(self.buildNode, inputs=tosca.inputs, parsed_params=tosca.parsed_params),
-                            tosca.nodetemplates)
-
-        self.vnfs = self._get_all_vnf(nodeTemplates)
-        self.pnfs = self._get_all_pnf(nodeTemplates)
-        self.vls = self.get_all_vl(nodeTemplates)
-        self.cps = self.get_all_cp(nodeTemplates)
-        self.routers = self.get_all_router(nodeTemplates)
-        self.fps = self._get_all_fp(nodeTemplates)
-        self.vnffgs = self._get_all_vnffg(tosca.topology_template.groups)
-        self.server_groups = self.get_all_server_group(tosca.topology_template.groups)
-        self.ns_exposed = self.get_all_endpoint_exposed(tosca.topology_template)
-        self.policies = self._get_policies_scaling(tosca.topology_template.policies)
-        self.ns_flavours = self.get_all_flavour(tosca.topology_template.groups)
-        self.nested_ns = self.get_all_nested_ns(nodeTemplates)
-
-    def buildInputs(self, top_inputs):
-        ret = {}
-        for tmpinput in top_inputs:
-            tmp = {}
-            tmp['type'] = tmpinput.type
-            tmp['description'] = tmpinput.description
-            tmp['default'] = tmpinput.default
-
-            ret[tmpinput.name] = tmp
-        return ret
-
-    def buildNode(self, nodeTemplate, inputs, parsed_params):
-        ret = {}
-        ret['name'] = nodeTemplate.name
-        ret['nodeType'] = nodeTemplate.type
-        if 'description' in nodeTemplate.entity_tpl:
-            ret['description'] = nodeTemplate.entity_tpl['description']
-        else:
-            ret['description'] = ''
-        props = self.buildProperties(nodeTemplate, parsed_params)
-        ret['properties'] = self.verify_properties(props, inputs, parsed_params)
-        ret['requirements'] = self.build_requirements(nodeTemplate)
-        self.buildCapabilities(nodeTemplate, inputs, ret)
-        self.buildArtifacts(nodeTemplate, inputs, ret)
-        interfaces = self.build_interfaces(nodeTemplate)
-        if interfaces:
-            ret['interfaces'] = interfaces
-        return ret
-
-    def _get_all_vnf(self, nodeTemplates):
-        vnfs = []
-        for node in nodeTemplates:
-            if self.isVnf(node):
-                vnf = {}
-                vnf['vnf_id'] = node['name']
-                vnf['description'] = node['description']
-                vnf['properties'] = node['properties']
-                vnf['dependencies'] = map(lambda x: self.get_requirement_node_name(x), self.getNodeDependencys(node))
-                vnf['networks'] = self.get_networks(node)
-
-                vnfs.append(vnf)
-        return vnfs
-
-    def _get_all_pnf(self, nodeTemplates):
-        pnfs = []
-        for node in nodeTemplates:
-            if self.isPnf(node):
-                pnf = {}
-                pnf['pnf_id'] = node['name']
-                pnf['description'] = node['description']
-                pnf['properties'] = node['properties']
-                pnf['cps'] = self.getVirtalBindingCpIds(node, nodeTemplates)
-
-                pnfs.append(pnf)
-        return pnfs
-
-    def getVirtalBindingCpIds(self, node, nodeTemplates):
-        return map(lambda x: x['name'], self.getVirtalBindingCps(node, nodeTemplates))
-
-    def getVirtalBindingCps(self, node, nodeTemplates):
-        cps = []
-        for tmpnode in nodeTemplates:
-            if 'requirements' in tmpnode:
-                for item in tmpnode['requirements']:
-                    for key, value in item.items():
-                        if key.upper().startswith('VIRTUALBINDING'):
-                            req_node_name = self.get_requirement_node_name(value)
-                            if req_node_name is not None and req_node_name == node['name']:
-                                cps.append(tmpnode)
-        return cps
-
-    def get_all_vl(self, nodeTemplates):
-        vls = []
-        for node in nodeTemplates:
-            if self.isVl(node):
-                vl = {}
-                vl['vl_id'] = node['name']
-                vl['description'] = node['description']
-                vl['properties'] = node['properties']
-                vl['route_external'] = False
-                vl['route_id'] = self._get_vl_route_id(node)
-                vls.append(vl)
-            if self._isExternalVL(node):
-                vl = {}
-                vl['vl_id'] = node['name']
-                vl['description'] = node['description']
-                vl['properties'] = node['properties']
-                vl['route_external'] = True
-                vls.append(vl)
-        return vls
-
-    def _get_vl_route_id(self, node):
-        route_ids = map(lambda x: self.get_requirement_node_name(x),
-                        self.getRequirementByName(node, 'virtual_route'))
-        if len(route_ids) > 0:
-            return route_ids[0]
-        return ""
-
-    def _isExternalVL(self, node):
-        return node['nodeType'].upper().find('.ROUTEEXTERNALVL') >= 0
-
-    def get_all_cp(self, nodeTemplates):
-        cps = []
-        for node in nodeTemplates:
-            if self.isCp(node):
-                cp = {}
-                cp['cp_id'] = node['name']
-                cp['cpd_id'] = node['name']
-                cp['description'] = node['description']
-                cp['properties'] = node['properties']
-                cp['vl_id'] = self.get_node_vl_id(node)
-                binding_node_ids = map(lambda x: self.get_requirement_node_name(x), self.getVirtualbindings(node))
-                #                 cp['vnf_id'] = self._filter_vnf_id(binding_node_ids, nodeTemplates)
-                cp['pnf_id'] = self._filter_pnf_id(binding_node_ids, nodeTemplates)
-                vls = self.buil_cp_vls(node)
-                if len(vls) > 1:
-                    cp['vls'] = vls
-                cps.append(cp)
-        return cps
-
-    def buil_cp_vls(self, node):
-        return map(lambda x: self._build_cp_vl(x), self.getVirtualLinks(node))
-
-    def _build_cp_vl(self, req):
-        cp_vl = {}
-        cp_vl['vl_id'] = self.get_prop_from_obj(req, 'node')
-        relationship = self.get_prop_from_obj(req, 'relationship')
-        if relationship is not None:
-            properties = self.get_prop_from_obj(relationship, 'properties')
-            if properties is not None and isinstance(properties, dict):
-                for key, value in properties.items():
-                    cp_vl[key] = value
-        return cp_vl
-
-    def _filter_pnf_id(self, node_ids, node_templates):
-        for node_id in node_ids:
-            node = self.get_node_by_name(node_templates, node_id)
-            if self.isPnf(node):
-                return node_id
-        return ""
-
-    def get_all_router(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self._isRouter(node):
-                ret = {}
-                ret['router_id'] = node['name']
-                ret['description'] = node['description']
-                ret['properties'] = node['properties']
-                ret['external_vl_id'] = self._get_router_external_vl_id(node)
-                ret['external_ip_addresses'] = self._get_external_ip_addresses(node)
-
-                rets.append(ret)
-        return rets
-
-    def _isRouter(self, node):
-        return node['nodeType'].upper().find('.ROUTER.') >= 0 or node['nodeType'].upper().endswith('.ROUTER')
-
-    def _get_router_external_vl(self, node):
-        return self.getRequirementByName(node, 'external_virtual_link')
-
-    def _get_router_external_vl_id(self, node):
-        ids = map(lambda x: self.get_requirement_node_name(x), self._get_router_external_vl(node))
-        if len(ids) > 0:
-            return ids[0]
-        return ""
-
-    def _get_external_ip_addresses(self, node):
-        external_vls = self._get_router_external_vl(node)
-        if len(external_vls) > 0:
-            if 'relationship' in external_vls[0] and 'properties' in external_vls[0]['relationship'] and 'router_ip_address' in external_vls[0]['relationship']['properties']:
-                return external_vls[0]['relationship']['properties']['router_ip_address']
-        return []
-
-    def _get_all_fp(self, nodeTemplates):
-        fps = []
-        for node in nodeTemplates:
-            if self._isFp(node):
-                fp = {}
-                fp['fp_id'] = node['name']
-                fp['description'] = node['description']
-                fp['properties'] = node['properties']
-                fp['forwarder_list'] = self._getForwarderList(node, nodeTemplates)
-
-                fps.append(fp)
-        return fps
-
-    def _isFp(self, node):
-        return node['nodeType'].upper().find('.FP.') >= 0 or node['nodeType'].upper().find('.SFP.') >= 0 or node[
-            'nodeType'].upper().endswith('.FP') or node['nodeType'].upper().endswith('.SFP')
-
-    def _getForwarderList(self, node, node_templates):
-        forwarderList = []
-        if 'requirements' in node:
-            for item in node['requirements']:
-                for key, value in item.items():
-                    if key == 'forwarder':
-                        tmpnode = self.get_node_by_req(node_templates, value)
-                        type = 'cp' if self.isCp(tmpnode) else 'vnf'
-                        req_node_name = self.get_requirement_node_name(value)
-                        if isinstance(value, dict) and 'capability' in value:
-                            forwarderList.append(
-                                {"type": type, "node_name": req_node_name, "capability": value['capability']})
-                        else:
-                            forwarderList.append({"type": type, "node_name": req_node_name, "capability": ""})
-
-        return forwarderList
-
-    def get_node_by_req(self, node_templates, req):
-        req_node_name = self.get_requirement_node_name(req)
-        return self.get_node_by_name(node_templates, req_node_name)
-
-    def _get_all_vnffg(self, groups):
-        vnffgs = []
-        for group in groups:
-            if self._isVnffg(group):
-                vnffg = {}
-                vnffg['vnffg_id'] = group.name
-                vnffg['description'] = group.description
-                if 'properties' in group.tpl:
-                    vnffg['properties'] = group.tpl['properties']
-                vnffg['members'] = group.members
-
-                vnffgs.append(vnffg)
-        return vnffgs
-
-    def _isVnffg(self, group):
-        return group.type.upper().find('.VNFFG.') >= 0 or group.type.upper().find(
-            '.SFC.') >= 0 or group.type.upper().endswith('.VNFFG') or group.type.upper().endswith('.SFC')
-
-    def get_all_server_group(self, groups):
-        rets = []
-        for group in groups:
-            if self._isServerGroup(group):
-                ret = {}
-                ret['group_id'] = group.name
-                ret['description'] = group.description
-                if 'properties' in group.tpl:
-                    ret['properties'] = group.tpl['properties']
-                ret['members'] = group.members
-
-                rets.append(ret)
-        return rets
-
-    def _isServerGroup(self, group):
-        return group.type.upper().find('.AFFINITYORANTIAFFINITYGROUP.') >= 0 or group.type.upper().endswith(
-            '.AFFINITYORANTIAFFINITYGROUP')
-
-    def get_all_endpoint_exposed(self, topo_tpl):
-        if 'substitution_mappings' in topo_tpl.tpl:
-            external_cps = self._get_external_cps(topo_tpl.tpl['substitution_mappings'])
-            forward_cps = self._get_forward_cps(topo_tpl.tpl['substitution_mappings'])
-            return {"external_cps": external_cps, "forward_cps": forward_cps}
-        return {}
-
-    def _get_external_cps(self, subs_mappings):
-        external_cps = []
-        if 'requirements' in subs_mappings:
-            for key, value in subs_mappings['requirements'].items():
-                if isinstance(value, list) and len(value) > 0:
-                    external_cps.append({"key_name": key, "cpd_id": value[0]})
-                else:
-                    external_cps.append({"key_name": key, "cpd_id": value})
-        return external_cps
-
-    def _get_forward_cps(self, subs_mappings):
-        forward_cps = []
-        if 'capabilities' in subs_mappings:
-            for key, value in subs_mappings['capabilities'].items():
-                if isinstance(value, list) and len(value) > 0:
-                    forward_cps.append({"key_name": key, "cpd_id": value[0]})
-                else:
-                    forward_cps.append({"key_name": key, "cpd_id": value})
-        return forward_cps
-
-    def _get_policies_scaling(self, top_policies):
-        policies_scaling = []
-        scaling_policies = self.get_scaling_policies(top_policies)
-        if len(scaling_policies) > 0:
-            policies_scaling.append({"scaling": scaling_policies})
-        return policies_scaling
-
-    def get_policies_by_keyword(self, top_policies, keyword):
-        ret = []
-        for policy in top_policies:
-            if policy.type.upper().find(keyword) >= 0:
-                tmp = {}
-                tmp['policy_id'] = policy.name
-                tmp['description'] = policy.description
-                if 'properties' in policy.entity_tpl:
-                    tmp['properties'] = policy.entity_tpl['properties']
-                tmp['targets'] = policy.targets
-                ret.append(tmp)
-
-        return ret
-
-    def get_scaling_policies(self, top_policies):
-        return self.get_policies_by_keyword(top_policies, '.SCALING')
-
-    def get_all_flavour(self, groups):
-        rets = []
-        for group in groups:
-            if self._isFlavour(group):
-                ret = {}
-                ret['flavour_id'] = group.name
-                ret['description'] = group.description
-                if 'properties' in group.tpl:
-                    ret['properties'] = group.tpl['properties']
-                ret['members'] = group.members
-
-                rets.append(ret)
-        return rets
-
-    def _isFlavour(self, group):
-        return group.type.upper().find('FLAVOUR') >= 0
diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py
deleted file mode 100644 (file)
index a665efe..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-# 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.
-
-import functools
-
-from lcm.pub.utils.toscaparser import EtsiNsdInfoModel
-
-
-class EtsiVnfdInfoModel(EtsiNsdInfoModel):
-
-    def __init__(self, path, params):
-        super(EtsiVnfdInfoModel, self).__init__(path, params)
-
-    def parseModel(self, tosca):
-        self.buidMetadata(tosca)
-        if hasattr(tosca, 'topology_template') and hasattr(tosca.topology_template, 'inputs'):
-            self.inputs = self.buildInputs(tosca.topology_template.inputs)
-
-        nodeTemplates = map(functools.partial(self.buildNode, inputs=tosca.inputs, parsed_params=tosca.parsed_params),
-                            tosca.nodetemplates)
-
-        self.services = self._get_all_services(nodeTemplates)
-        self.vcloud = self._get_all_vcloud(nodeTemplates)
-        self.vcenter = self._get_all_vcenter(nodeTemplates)
-        self.image_files = self._get_all_image_file(nodeTemplates)
-        self.local_storages = self._get_all_local_storage(nodeTemplates)
-        self.volume_storages = self._get_all_volume_storage(nodeTemplates)
-        self.vdus = self._get_all_vdu(nodeTemplates)
-        self.vls = self.get_all_vl(nodeTemplates)
-        self.cps = self.get_all_cp(nodeTemplates)
-        self.plugins = self.get_all_plugin(nodeTemplates)
-        self.routers = self.get_all_router(nodeTemplates)
-        self.server_groups = self.get_all_server_group(tosca.topology_template.groups)
-        self.element_groups = self._get_all_element_group(tosca.topology_template.groups)
-        self.policies = self._get_policies(tosca.topology_template.policies)
-        self.vnf_exposed = self.get_all_endpoint_exposed(tosca.topology_template)
-        self.vnf_flavours = self.get_all_flavour(tosca.topology_template.groups)
-
-    def _get_all_services(self, nodeTemplates):
-        ret = []
-        for node in nodeTemplates:
-            if self.isService(node):
-                service = {}
-                service['serviceId'] = node['name']
-                if 'description' in node:
-                    service['description'] = node['description']
-                service['properties'] = node['properties']
-                service['dependencies'] = map(lambda x: self.get_requirement_node_name(x),
-                                              self.getNodeDependencys(node))
-                service['networks'] = map(lambda x: self.get_requirement_node_name(x), self.getVirtualLinks(node))
-
-                ret.append(service)
-        return ret
-
-    def _get_all_vcloud(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self._isVcloud(node):
-                ret = {}
-                if 'vdc_name' in node['properties']:
-                    ret['vdc_name'] = node['properties']['vdc_name']
-                else:
-                    ret['vdc_name'] = ""
-                if 'storage_clusters' in node['properties']:
-                    ret['storage_clusters'] = node['properties']['storage_clusters']
-                else:
-                    ret['storage_clusters'] = []
-
-                rets.append(ret)
-        return rets
-
-    def _isVcloud(self, node):
-        return node['nodeType'].upper().find('.VCLOUD.') >= 0 or node['nodeType'].upper().endswith('.VCLOUD')
-
-    def _get_all_vcenter(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self._isVcenter(node):
-                ret = {}
-                if 'compute_clusters' in node['properties']:
-                    ret['compute_clusters'] = node['properties']['compute_clusters']
-                else:
-                    ret['compute_clusters'] = []
-                if 'storage_clusters' in node['properties']:
-                    ret['storage_clusters'] = node['properties']['storage_clusters']
-                else:
-                    ret['storage_clusters'] = []
-                if 'network_clusters' in node['properties']:
-                    ret['network_clusters'] = node['properties']['network_clusters']
-                else:
-                    ret['network_clusters'] = []
-
-                rets.append(ret)
-        return rets
-
-    def _isVcenter(self, node):
-        return node['nodeType'].upper().find('.VCENTER.') >= 0 or node['nodeType'].upper().endswith('.VCENTER')
-
-    def _get_all_image_file(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self._isImageFile(node):
-                ret = {}
-                ret['image_file_id'] = node['name']
-                if 'description' in node:
-                    ret['description'] = node['description']
-                ret['properties'] = node['properties']
-
-                rets.append(ret)
-        return rets
-
-    def _isImageFile(self, node):
-        return node['nodeType'].upper().find('.IMAGEFILE.') >= 0 or node['nodeType'].upper().endswith('.IMAGEFILE')
-
-    def _get_all_local_storage(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self._isLocalStorage(node):
-                ret = {}
-                ret['local_storage_id'] = node['name']
-                if 'description' in node:
-                    ret['description'] = node['description']
-                ret['properties'] = node['properties']
-
-                rets.append(ret)
-        return rets
-
-    def _isLocalStorage(self, node):
-        return node['nodeType'].upper().find('.LOCALSTORAGE.') >= 0 or node['nodeType'].upper().endswith(
-            '.LOCALSTORAGE')
-
-    def _get_all_volume_storage(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self._isVolumeStorage(node):
-                ret = {}
-                ret['volume_storage_id'] = node['name']
-                if 'description' in node:
-                    ret['description'] = node['description']
-                ret['properties'] = node['properties']
-                ret['image_file'] = map(lambda x: self.get_requirement_node_name(x),
-                                        self.getRequirementByName(node, 'image_file'))
-
-                rets.append(ret)
-        return rets
-
-    def _isVolumeStorage(self, node):
-        return node['nodeType'].upper().find('.VOLUMESTORAGE.') >= 0 or node['nodeType'].upper().endswith(
-            '.VOLUMESTORAGE')
-
-    def _get_all_vdu(self, nodeTemplates):
-        rets = []
-        for node in nodeTemplates:
-            if self.isVdu(node):
-                ret = {}
-                ret['vdu_id'] = node['name']
-                if 'description' in node:
-                    ret['description'] = node['description']
-                ret['properties'] = node['properties']
-                ret['image_file'] = self.get_node_image_file(node)
-                local_storages = self.getRequirementByName(node, 'local_storage')
-                ret['local_storages'] = map(lambda x: self.get_requirement_node_name(x), local_storages)
-                volume_storages = self.getRequirementByName(node, 'volume_storage')
-                ret['volume_storages'] = map(functools.partial(self._trans_volume_storage), volume_storages)
-                ret['dependencies'] = map(lambda x: self.get_requirement_node_name(x), self.getNodeDependencys(node))
-
-                nfv_compute = self.getCapabilityByName(node, 'nfv_compute')
-                if nfv_compute is not None and 'properties' in nfv_compute:
-                    ret['nfv_compute'] = nfv_compute['properties']
-
-                ret['vls'] = self.get_linked_vl_ids(node, nodeTemplates)
-
-                scalable = self.getCapabilityByName(node, 'scalable')
-                if scalable is not None and 'properties' in scalable:
-                    ret['scalable'] = scalable['properties']
-
-                ret['cps'] = self.getVirtalBindingCpIds(node, nodeTemplates)
-                ret['artifacts'] = self._build_artifacts(node)
-
-                rets.append(ret)
-        return rets
-
-    def get_node_image_file(self, node):
-        rets = map(lambda x: self.get_requirement_node_name(x), self.getRequirementByName(node, 'guest_os'))
-        if len(rets) > 0:
-            return rets[0]
-        return ""
-
-    def _trans_volume_storage(self, volume_storage):
-        if isinstance(volume_storage, str):
-            return {"volume_storage_id": volume_storage}
-        else:
-            ret = {}
-            ret['volume_storage_id'] = self.get_requirement_node_name(volume_storage)
-            if 'relationship' in volume_storage and 'properties' in volume_storage['relationship']:
-                if 'location' in volume_storage['relationship']['properties']:
-                    ret['location'] = volume_storage['relationship']['properties']['location']
-                if 'device' in volume_storage['relationship']['properties']:
-                    ret['device'] = volume_storage['relationship']['properties']['device']
-
-            return ret
-
-    def get_linked_vl_ids(self, node, node_templates):
-        vl_ids = []
-        cps = self.getVirtalBindingCps(node, node_templates)
-        for cp in cps:
-            vl_reqs = self.getVirtualLinks(cp)
-            for vl_req in vl_reqs:
-                vl_ids.append(self.get_requirement_node_name(vl_req))
-        return vl_ids
-
-    def _build_artifacts(self, node):
-        rets = []
-        if 'artifacts' in node and len(node['artifacts']) > 0:
-            artifacts = node['artifacts']
-            for name, value in artifacts.items():
-                ret = {}
-                if isinstance(value, dict):
-                    ret['artifact_name'] = name
-                    ret['type'] = value.get('type', '')
-                    ret['file'] = value.get('file', '')
-                    ret['repository'] = value.get('repository', '')
-                    ret['deploy_path'] = value.get('deploy_path', '')
-                else:
-                    ret['artifact_name'] = name
-                    ret['type'] = ''
-                    ret['file'] = value
-                    ret['repository'] = ''
-                    ret['deploy_path'] = ''
-                rets.append(ret)
-        return rets
-
-    def get_all_cp(self, nodeTemplates):
-        cps = []
-        for node in nodeTemplates:
-            if self.isCp(node):
-                cp = {}
-                cp['cp_id'] = node['name']
-                cp['cpd_id'] = node['name']
-                cp['description'] = node['description']
-                cp['properties'] = node['properties']
-                cp['vl_id'] = self.get_node_vl_id(node)
-                cp['vdu_id'] = self.get_node_vdu_id(node)
-                vls = self.buil_cp_vls(node)
-                if len(vls) > 1:
-                    cp['vls'] = vls
-                cps.append(cp)
-        return cps
-
-    def get_all_plugin(self, node_templates):
-        plugins = []
-        for node in node_templates:
-            if self._isPlugin(node):
-                plugin = {}
-                plugin['plugin_id'] = node['name']
-                plugin['description'] = node['description']
-                plugin['properties'] = node['properties']
-                if 'interfaces' in node:
-                    plugin['interfaces'] = node['interfaces']
-
-                plugins.append(plugin)
-        return plugins
-
-    def _isPlugin(self, node):
-        return node['nodeType'].lower().find('.plugin.') >= 0 or node['nodeType'].lower().endswith('.plugin')
-
-    def _get_all_element_group(self, groups):
-        rets = []
-        for group in groups:
-            if self._isVnfdElementGroup(group):
-                ret = {}
-                ret['group_id'] = group.name
-                ret['description'] = group.description
-                if 'properties' in group.tpl:
-                    ret['properties'] = group.tpl['properties']
-                ret['members'] = group.members
-                rets.append(ret)
-        return rets
-
-    def _isVnfdElementGroup(self, group):
-        return group.type.upper().find('.VNFDELEMENTGROUP.') >= 0 or group.type.upper().endswith('.VNFDELEMENTGROUP')
-
-    def _get_policies(self, top_policies):
-        policies = []
-        scaling_policies = self.get_scaling_policies(top_policies)
-        healing_policies = self.get_healing_policies(top_policies)
-        policies.append({"scaling": scaling_policies, 'healing': healing_policies})
-        return policies
-
-    def get_healing_policies(self, top_policies):
-        return self.get_policies_by_keyword(top_policies, '.HEALING')
diff --git a/lcm/pub/utils/toscautil.py b/lcm/pub/utils/toscautil.py
deleted file mode 100644 (file)
index fd7347e..0000000
+++ /dev/null
@@ -1,2685 +0,0 @@
-# Copyright 2016-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.
-
-import json
-
-
-def safe_get(key_val, key):
-    return key_val[key] if key in key_val else ""
-
-
-def find_node_name(node_id, node_list):
-    for node in node_list:
-        if node['id'] == node_id:
-            return node['template_name']
-    raise Exception('can not find node(%s).' % node_id)
-
-
-def find_node_type(node_id, node_list):
-    for node in node_list:
-        if node['id'] == node_id:
-            return node['type_name']
-    raise Exception('can not find node(%s).' % node_id)
-
-
-def find_related_node(node_id, src_json_model, requirement_name):
-    related_nodes = []
-    for model_tpl in safe_get(src_json_model, "node_templates"):
-        for rt in safe_get(model_tpl, 'requirement_templates'):
-            if safe_get(rt, 'name') == requirement_name and safe_get(rt, 'target_node_template_name') == node_id:
-                related_nodes.append(model_tpl['name'])
-    return related_nodes
-
-
-def convert_props(src_node, dest_node):
-    if 'properties' in src_node and src_node['properties']:
-        for prop_name, prop_info in src_node['properties'].items():
-            if 'value' in prop_info:
-                dest_node['properties'][prop_name] = prop_info['value']
-
-
-def convert_metadata(src_json):
-    return src_json['metadata'] if 'metadata' in src_json else {}
-
-
-def convert_inputs(src_json):
-    inputs = {}
-    if 'inputs' in src_json:
-        src_inputs = src_json['inputs']
-        for param_name, param_info in src_inputs.items():
-            input_param = {}
-            if 'type_name' in param_info:
-                input_param['type'] = param_info['type_name']
-            if 'description' in param_info:
-                input_param['description'] = param_info['description']
-            if 'value' in param_info:
-                input_param['value'] = param_info['value']
-            inputs[param_name] = input_param
-    return inputs
-
-
-def convert_vnf_node(src_node, src_json_model):
-    vnf_node = {
-        'type': src_node['type_name'],
-        'vnf_id': src_node['template_name'],
-        'description': '',
-        'properties': {},
-        'dependencies': [],
-        'networks': []
-    }
-    convert_props(src_node, vnf_node)
-    for model_tpl in safe_get(src_json_model, "node_templates"):
-        if model_tpl['name'] != vnf_node['vnf_id']:
-            continue
-        vnf_node['dependencies'] = [
-            {
-                'key_name': requirement['name'],
-                'vl_id': requirement['target_node_template_name']
-            } for requirement in safe_get(model_tpl, 'requirement_templates')
-            if safe_get(requirement, 'target_capability_name') == 'virtual_linkable'
-        ]
-        vnf_node['networks'] = [requirement['target_node_template_name'] for
-                                requirement in safe_get(model_tpl, 'requirement_templates') if
-                                safe_get(requirement, 'name') == 'dependency']
-    return vnf_node
-
-
-def convert_pnf_node(src_node, src_json_model):
-    pnf_node = {'pnf_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, pnf_node)
-    pnf_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
-    return pnf_node
-
-
-def convert_vl_node(src_node, src_node_list):
-    vl_node = {'vl_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, vl_node)
-    vl_node['route_id'] = ''
-    for relation in safe_get(src_node, 'relationships'):
-        if safe_get(relation, 'type_name').endswith('.VirtualLinksTo'):
-            vl_node['route_id'] = find_node_name(relation['target_node_id'], src_node_list)
-            break
-    vl_node['route_external'] = (src_node['type_name'].find('.RouteExternalVL') > 0)
-    return vl_node
-
-
-def convert_cp_node(src_node, src_node_list, model_type='NSD'):
-    cp_node = {'cp_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, cp_node)
-    src_relationships = src_node['relationships']
-    for relation in src_relationships:
-        if safe_get(relation, 'name') == 'virtualLink':
-            cp_node['vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
-        elif safe_get(relation, 'name') == 'virtualbinding':
-            node_key = 'pnf_id' if model_type == 'NSD' else 'vdu_id'
-            cp_node[node_key] = find_node_name(relation['target_node_id'], src_node_list)
-    return cp_node
-
-
-def convert_router_node(src_node, src_node_list):
-    router_node = {'router_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, router_node)
-    for relation in src_node['relationships']:
-        if safe_get(relation, 'name') != 'external_virtual_link':
-            continue
-        router_node['external_vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
-        router_node['external_ip_addresses'] = []
-        if 'properties' not in relation:
-            continue
-        for prop_name, prop_info in relation['properties'].items():
-            if prop_name == 'router_ip_address':
-                router_node['external_ip_addresses'].append(prop_info['value'])
-        break
-    return router_node
-
-
-def convert_fp_node(src_node, src_node_list, src_json_model):
-    fp_node = {
-        'fp_id': src_node['template_name'],
-        'description': '',
-        'properties': {},
-        'forwarder_list': []
-    }
-    convert_props(src_node, fp_node)
-    for relation in safe_get(src_node, 'relationships'):
-        if safe_get(relation, 'name') != 'forwarder':
-            continue
-        forwarder_point = {'type': 'vnf'}
-        target_node_type = find_node_type(relation['target_node_id'], src_node_list).upper()
-        if target_node_type.find('.CP.') >= 0 or target_node_type.endswith('.CP'):
-            forwarder_point['type'] = 'cp'
-        forwarder_point['node_name'] = find_node_name(relation['target_node_id'], src_node_list)
-        forwarder_point['capability'] = ''
-        if forwarder_point['type'] == 'vnf':
-            for node_tpl in src_json_model["node_templates"]:
-                if fp_node['fp_id'] != node_tpl["name"]:
-                    continue
-                for r_tpl in safe_get(node_tpl, "requirement_templates"):
-                    if safe_get(r_tpl, "target_node_template_name") != forwarder_point['node_name']:
-                        continue
-                    forwarder_point['capability'] = safe_get(r_tpl, "target_capability_name")
-                    break
-                break
-        fp_node['forwarder_list'].append(forwarder_point)
-    return fp_node
-
-
-def convert_vnffg_group(src_group, src_group_list, src_node_list):
-    vnffg = {
-        'vnffg_id': src_group['template_name'],
-        'description': '',
-        'properties': {},
-        'members': []
-    }
-    convert_props(src_group, vnffg)
-    for member_node_id in src_group['member_node_ids']:
-        vnffg['members'].append(find_node_name(member_node_id, src_node_list))
-    return vnffg
-
-
-def convert_imagefile_node(src_node, src_node_list):
-    image_node = {
-        'image_file_id': src_node['template_name'],
-        'description': '',
-        'properties': {}
-    }
-    convert_props(src_node, image_node)
-    return image_node
-
-
-def convert_localstorage_node(src_node, src_node_list):
-    localstorage_node = {
-        'local_storage_id': src_node['template_name'],
-        'description': '',
-        'properties': {}
-    }
-    convert_props(src_node, localstorage_node)
-    return localstorage_node
-
-
-def convert_vdu_node(src_node, src_node_list, src_json_model):
-    vdu_node = {
-        'vdu_id': src_node['template_name'],
-        'description': '',
-        'properties': {},
-        'image_file': '',
-        'local_storages': [],
-        'dependencies': [],
-        'nfv_compute': {},
-        'vls': [],
-        'artifacts': []
-    }
-    convert_props(src_node, vdu_node)
-
-    for relation in src_node['relationships']:
-        r_id, r_name = safe_get(relation, 'target_node_id'), safe_get(relation, 'name')
-        if r_name == 'guest_os':
-            vdu_node['image_file'] = find_node_name(r_id, src_node_list)
-        elif r_name == 'local_storage':
-            vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
-        elif r_name.endswith('.AttachesTo'):
-            nt = find_node_type(r_id, src_node_list)
-            if nt.endswith('.BlockStorage.Local') or nt.endswith('.LocalStorage'):
-                vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
-
-    for capability in src_node['capabilities']:
-        if capability['name'] != 'nfv_compute':
-            continue
-        for prop_name, prop_info in capability['properties'].items():
-            if 'value' in prop_info:
-                vdu_node['nfv_compute'][prop_name] = prop_info['value']
-
-    vdu_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
-
-    for cp_node in vdu_node['cps']:
-        for src_cp_node in src_node_list:
-            if src_cp_node['template_name'] != cp_node:
-                continue
-            for relation in safe_get(src_cp_node, 'relationships'):
-                if relation['name'] != 'virtualLink':
-                    continue
-                vl_node_name = find_node_name(relation['target_node_id'], src_node_list)
-                if vl_node_name not in vdu_node['vls']:
-                    vdu_node['vls'].append(vl_node_name)
-
-    for item in safe_get(src_node, 'artifacts'):
-        artifact = {
-            'artifact_name': item['name'],
-            'type': item['type_name'],
-            'file': item['source_path']
-        }
-        vdu_node['artifacts'].append(artifact)
-
-    return vdu_node
-
-
-def convert_exposed_node(src_json, src_nodes, exposed):
-    for item in safe_get(safe_get(src_json, 'substitution'), 'requirements'):
-        external_cps = {
-            'key_name': item['mapped_name'],
-            "cp_id": find_node_name(item['node_id'], src_nodes)
-        }
-        exposed['external_cps'].append(external_cps)
-    for item in safe_get(safe_get(src_json, 'substitution'), 'capabilities'):
-        forward_cps = {
-            'key_name': item['mapped_name'],
-            "cp_id": find_node_name(item['node_id'], src_nodes)
-        }
-        exposed['forward_cps'].append(forward_cps)
-
-
-def convert_vnffgs(src_json_inst, src_nodes):
-    vnffgs = []
-    src_groups = safe_get(src_json_inst, 'groups')
-    for group in src_groups:
-        type_name = group['type_name'].upper()
-        if type_name.find('.VNFFG.') >= 0 or type_name.endswith('.VNFFG'):
-            vnffgs.append(convert_vnffg_group(group, src_groups, src_nodes))
-    return vnffgs
-
-
-def convert_common(src_json, target_json):
-    if isinstance(src_json, (unicode, str)):
-        src_json_dict = json.loads(src_json)
-    else:
-        src_json_dict = src_json
-    src_json_inst = src_json_dict["instance"]
-    src_json_model = src_json_dict["model"] if "model" in src_json_dict else {}
-
-    target_json['metadata'] = convert_metadata(src_json_inst)
-    target_json['inputs'] = convert_inputs(src_json_inst)
-    target_json['vls'] = []
-    target_json['cps'] = []
-    target_json['routers'] = []
-
-    return src_json_inst, src_json_model
-
-
-def convert_policy_node(src_json):
-    target_json = {
-        'name': src_json['template_name'],
-        'file_url': src_json['properties']['drl_file_url']['value']
-    }
-    return target_json
-
-
-def convert_nsd_model(src_json):
-    target_json = {
-        'vnfs': [],
-        'pnfs': [],
-        'fps': [],
-        'policies': []
-    }
-    src_json_inst, src_json_model = convert_common(src_json, target_json)
-
-    src_nodes = src_json_inst['nodes']
-    for node in src_nodes:
-        type_name = node['type_name']
-        if type_name.find('.VNF.') > 0 or type_name.endswith('.VNF'):
-            target_json['vnfs'].append(convert_vnf_node(node, src_json_model))
-        elif type_name.find('.PNF.') > 0 or type_name.endswith('.PNF'):
-            target_json['pnfs'].append(convert_pnf_node(node, src_json_model))
-        elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
-                or node['type_name'].find('.RouteExternalVL') > 0:
-            target_json['vls'].append(convert_vl_node(node, src_nodes))
-        elif type_name.find('.CP.') > 0 or type_name.endswith('.CP'):
-            target_json['cps'].append(convert_cp_node(node, src_nodes))
-        elif type_name.find('.FP.') > 0 or type_name.endswith('.FP'):
-            target_json['fps'].append(convert_fp_node(node, src_nodes, src_json_model))
-        elif type_name.endswith('.Router'):
-            target_json['routers'].append(convert_router_node(node, src_nodes))
-        elif type_name.endswith('tosca.policies.Drools'):
-            target_json['policies'].append(convert_policy_node(node))
-
-    target_json['vnffgs'] = convert_vnffgs(src_json_inst, src_nodes)
-
-    target_json['ns_exposed'] = {'external_cps': [], 'forward_cps': []}
-    convert_exposed_node(src_json_inst, src_nodes, target_json['ns_exposed'])
-    return json.dumps(target_json)
-
-
-def convert_vnfd_model(src_json):
-    target_json = {
-        'image_files': [],
-        'local_storages': [],
-        'vdus': []
-    }
-    src_json_inst, src_json_model = convert_common(src_json, target_json)
-    if "vnfdVersion" in src_json_inst.get("metadata", {}):
-        from . import toscautil_new
-        return toscautil_new.convert_vnfd_model(src_json)
-
-    src_nodes = src_json_inst['nodes']
-    for node in src_nodes:
-        type_name = node['type_name']
-        if type_name.endswith('.ImageFile'):
-            target_json['image_files'].append(convert_imagefile_node(node, src_nodes))
-        elif type_name.endswith('.BlockStorage.Local') or type_name.endswith('.LocalStorage'):
-            target_json['local_storages'].append(convert_localstorage_node(node, src_nodes))
-        elif type_name.find('.VDU.') > 0 or type_name.endswith('.VDU'):
-            target_json['vdus'].append(convert_vdu_node(node, src_nodes, src_json_model))
-        elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
-                or node['type_name'].find('.RouteExternalVL') > 0:
-            target_json['vls'].append(convert_vl_node(node, src_nodes))
-        elif type_name.find('.CP.') > 0 or type_name.endswith('.CP'):
-            target_json['cps'].append(convert_cp_node(node, src_nodes, 'VNFD'))
-        elif type_name.endswith('.Router'):
-            target_json['routers'].append(convert_router_node(node, src_nodes))
-
-    target_json['vnf_exposed'] = {'external_cps': [], 'forward_cps': []}
-    convert_exposed_node(src_json_inst, src_nodes, target_json['vnf_exposed'])
-    return json.dumps(target_json)
-
-
-if __name__ == '__main__':
-    src_json = json.dumps(
-        {
-            "instance": {
-                "metadata": {
-                    "vendor": "ZTE",
-                    "name": "VCPE_NS",
-                    "csarVersion": "v1.0",
-                    "csarType": "NSAR",
-                    "csarProvider": "ZTE",
-                    "version": 1,
-                    "invariant_id": "vcpe_ns_sff_1",
-                    "id": "VCPE_NS",
-                    "description": "vcpe_ns"
-                },
-                "policies:": [
-                    {
-                        "aaa:": {
-                            "type": "tosca.policies.Drools",
-                            "properties": {
-                                "drl_file_url": "policies/abc.drl"
-                            }
-                        }
-                    }
-                ],
-                "nodes": [
-                    {
-                        "id": "policies",
-                        "type_name": "tosca.policies.Drools",
-                        "template_name": "aaa",
-                        "properties": {
-                            "drl_file_url": {
-                                "type_name": "string",
-                                "value": "policies/abc.drl"
-                            }
-                        }
-                    },
-                    {
-                        "id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                        "type_name": "tosca.nodes.nfv.ext.FP",
-                        "template_name": "path2",
-                        "properties": {
-                            "symmetric": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "policy": {
-                                "type_name": "tosca.datatypes.nfv.ext.FPPolicy",
-                                "value": {
-                                    "type": "ACL",
-                                    "criteria": {
-                                        "dest_port_range": "1-100",
-                                        "ip_protocol": "tcp",
-                                        "source_ip_range": [
-                                            "119.1.1.1-119.1.1.10"
-                                        ],
-                                        "dest_ip_range": [
-                                            {"get_input": "NatIpRange"}
-                                        ],
-                                        "dscp": 0,
-                                        "source_port_range": "1-100"
-                                    }
-                                }
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 0,
-                                "target_node_id": "m6000_data_out_qeukdtf6g87cnparxi51fa8s6"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 1,
-                                "target_node_id": "m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 2,
-                                "target_node_id": "VNAT_cfdljtspvkp234irka59wgab0",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "path1_bv53fblv26hawr8dj4fxe2rsd",
-                        "type_name": "tosca.nodes.nfv.ext.FP",
-                        "template_name": "path1",
-                        "properties": {
-                            "symmetric": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "policy": {
-                                "type_name": "tosca.datatypes.nfv.ext.FPPolicy",
-                                "value": {
-                                    "type": "ACL",
-                                    "criteria": {
-                                        "dest_port_range": "1-100",
-                                        "ip_protocol": "tcp",
-                                        "source_ip_range": [
-                                            "1-100"
-                                        ],
-                                        "dest_ip_range": [
-                                            "1-100"
-                                        ],
-                                        "dscp": 4,
-                                        "source_port_range": "1-100"
-                                    }
-                                }
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 0,
-                                "target_node_id": "m6000_data_in_eldly5txw4frny3cc349uz3nc"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 1,
-                                "target_node_id": "m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 2,
-                                "target_node_id": "VFW_57z0ua89aiyl8ncvw7h7mjf34",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 3,
-                                "target_node_id": "VNAT_cfdljtspvkp234irka59wgab0",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 4,
-                                "target_node_id": "m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 5,
-                                "target_node_id": "m6000_data_out_qeukdtf6g87cnparxi51fa8s6"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "m6000_data_out_qeukdtf6g87cnparxi51fa8s6",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "template_name": "m6000_data_out",
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "11-22-33-22-11-44"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "xgei-0/4/1/5"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "176.1.1.2"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "virtualbinding",
-                                "source_requirement_index": 0,
-                                "target_node_id": "m6000_s_7qtzo5nuocyfmebc6kp9raq18",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "source_requirement_index": 1,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 2,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "VFW_57z0ua89aiyl8ncvw7h7mjf34",
-                        "type_name": "tosca.nodes.nfv.ext.zte.VNF.VFW",
-                        "template_name": "VFW",
-                        "properties": {
-                            "is_shared": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "plugin_info": {
-                                "type_name": "string",
-                                "value": "vbrasplugin_1.0"
-                            },
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "request_reclassification": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "vnf_extend_type": {
-                                "type_name": "string",
-                                "value": "driver"
-                            },
-                            "name": {
-                                "type_name": "string",
-                                "value": "VFW"
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "cross_dc": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "vnf_type": {
-                                "type_name": "string",
-                                "value": "VFW"
-                            },
-                            "vnfd_version": {
-                                "type_name": "string",
-                                "value": "1.0.0"
-                            },
-                            "id": {
-                                "type_name": "string",
-                                "value": "vcpe_vfw_zte_1_0"
-                            },
-                            "nsh_aware": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "adjust_vnf_capacity": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "vmnumber_overquota_alarm": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "csarProvider": {
-                                "type_name": "string",
-                                "value": "ZTE"
-                            },
-                            "csarVersion": {
-                                "type_name": "string",
-                                "value": "v1.0"
-                            },
-                            "externalPluginManageNetworkName": {
-                                "type_name": "string",
-                                "value": "vlan_4007_plugin_net"
-                            },
-                            "csarType": {
-                                "type_name": "string",
-                                "value": "NFAR"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            },
-                            {
-                                "name": "vfw_fw_inout",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "vfw_ctrl_by_manager_cp",
-                                "source_requirement_index": 0,
-                                "target_node_id": "ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "vfw_data_cp",
-                                "source_requirement_index": 1,
-                                "target_node_id": "sfc_data_network_vx3pc1oahn0k0pa5q722yafee",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "source_requirement_index": 2,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 3,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "template_name": "m600_tunnel_cp",
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "00-11-00-22-33-00"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "gei-0/4/0/13"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "191.167.100.5"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "virtualLink",
-                                "source_requirement_index": 0,
-                                "target_node_id": "ext_datanet_net_qtqzlx5dsthzs883hxjn6hyhd",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "virtualbinding",
-                                "source_requirement_index": 1,
-                                "target_node_id": "m6000_s_7qtzo5nuocyfmebc6kp9raq18",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 2,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
-                        "type_name": "tosca.nodes.nfv.ext.VL.Vmware",
-                        "template_name": "ext_mnet_net",
-                        "properties": {
-                            "name": {
-                                "type_name": "string",
-                                "value": "vlan_4008_mng_net"
-                            },
-                            "dhcp_enabled": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "location_info": {
-                                "type_name": "tosca.datatypes.nfv.ext.LocationInfo",
-                                "value": {
-                                    "tenant": "admin",
-                                    "vimid": 2,
-                                    "availability_zone": "nova"
-                                }
-                            },
-                            "ip_version": {
-                                "type_name": "integer",
-                                "value": 4
-                            },
-                            "mtu": {
-                                "type_name": "integer",
-                                "value": 1500
-                            },
-                            "network_name": {
-                                "type_name": "string",
-                                "value": "vlan_4008_mng_net"
-                            },
-                            "network_type": {
-                                "type_name": "string",
-                                "value": "vlan"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtual_linkable",
-                                "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "m6000_data_in_eldly5txw4frny3cc349uz3nc",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "template_name": "m6000_data_in",
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "11-22-33-22-11-41"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "gei-0/4/0/7"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "1.1.1.1"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            },
-                            "bond": {
-                                "type_name": "string",
-                                "value": "none"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "virtualbinding",
-                                "source_requirement_index": 0,
-                                "target_node_id": "m6000_s_7qtzo5nuocyfmebc6kp9raq18",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "source_requirement_index": 1,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 2,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "ext_datanet_net_qtqzlx5dsthzs883hxjn6hyhd",
-                        "type_name": "tosca.nodes.nfv.ext.VL.Vmware",
-                        "template_name": "ext_datanet_net",
-                        "properties": {
-                            "name": {
-                                "type_name": "string",
-                                "value": "vlan_4004_tunnel_net"
-                            },
-                            "dhcp_enabled": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "location_info": {
-                                "type_name": "tosca.datatypes.nfv.ext.LocationInfo",
-                                "value": {
-                                    "tenant": "admin",
-                                    "vimid": 2,
-                                    "availability_zone": "nova"
-                                }
-                            },
-                            "ip_version": {
-                                "type_name": "integer",
-                                "value": 4
-                            },
-                            "mtu": {
-                                "type_name": "integer",
-                                "value": 1500
-                            },
-                            "network_name": {
-                                "type_name": "string",
-                                "value": "vlan_4004_tunnel_net"
-                            },
-                            "network_type": {
-                                "type_name": "string",
-                                "value": "vlan"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtual_linkable",
-                                "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "m600_mnt_cp_l3488y2a8ilyfdn0l89ni4os7",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "template_name": "m600_mnt_cp",
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "00-11-00-22-33-11"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "gei-0/4/0/1"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "10.46.244.51"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            },
-                            "bond": {
-                                "type_name": "string",
-                                "value": "none"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "virtualLink",
-                                "source_requirement_index": 0,
-                                "target_node_id": "ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "virtualbinding",
-                                "source_requirement_index": 1,
-                                "target_node_id": "m6000_s_7qtzo5nuocyfmebc6kp9raq18",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 2,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "sfc_data_network_vx3pc1oahn0k0pa5q722yafee",
-                        "type_name": "tosca.nodes.nfv.ext.zte.VL",
-                        "template_name": "sfc_data_network",
-                        "properties": {
-                            "name": {
-                                "type_name": "string",
-                                "value": "sfc_data_network"
-                            },
-                            "dhcp_enabled": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "is_predefined": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "location_info": {
-                                "type_name": "tosca.datatypes.nfv.ext.LocationInfo",
-                                "value": {
-                                    "tenant": "admin",
-                                    "vimid": 2,
-                                    "availability_zone": "nova"
-                                }
-                            },
-                            "ip_version": {
-                                "type_name": "integer",
-                                "value": 4
-                            },
-                            "mtu": {
-                                "type_name": "integer",
-                                "value": 1500
-                            },
-                            "network_name": {
-                                "type_name": "string",
-                                "value": "sfc_data_network"
-                            },
-                            "network_type": {
-                                "type_name": "string",
-                                "value": "vlan"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtual_linkable",
-                                "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "m6000_s_7qtzo5nuocyfmebc6kp9raq18",
-                        "type_name": "tosca.nodes.nfv.ext.PNF",
-                        "template_name": "m6000_s",
-                        "properties": {
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "request_reclassification": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "pnf_type": {
-                                "type_name": "string",
-                                "value": "m6000s"
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "management_address": {
-                                "type_name": "string",
-                                "value": "111111"
-                            },
-                            "id": {
-                                "type_name": "string",
-                                "value": "m6000_s"
-                            },
-                            "nsh_aware": {
-                                "type_name": "boolean",
-                                "value": False
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtualBinding",
-                                "type_name": "tosca.capabilities.nfv.VirtualBindable"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 0,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    },
-                    {
-                        "id": "VNAT_cfdljtspvkp234irka59wgab0",
-                        "type_name": "tosca.nodes.nfv.ext.zte.VNF.VNAT",
-                        "template_name": "VNAT",
-                        "properties": {
-                            "is_shared": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "plugin_info": {
-                                "type_name": "string",
-                                "value": "vbrasplugin_1.0"
-                            },
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "request_reclassification": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "name": {
-                                "type_name": "string",
-                                "value": "VNAT"
-                            },
-                            "vnf_extend_type": {
-                                "type_name": "string",
-                                "value": "driver"
-                            },
-                            "externalPluginManageNetworkName": {
-                                "type_name": "string",
-                                "value": "vlan_4007_plugin_net"
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "cross_dc": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "vnf_type": {
-                                "type_name": "string",
-                                "value": "VNAT"
-                            },
-                            "vnfd_version": {
-                                "type_name": "string",
-                                "value": "1.0.0"
-                            },
-                            "id": {
-                                "type_name": "string",
-                                "value": "vcpe_vnat_zte_1"
-                            },
-                            "nsh_aware": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "adjust_vnf_capacity": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "vmnumber_overquota_alarm": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "csarProvider": {
-                                "type_name": "string",
-                                "value": "ZTE"
-                            },
-                            "NatIpRange": {
-                                "type_name": "string",
-                                "value": "192.167.0.10-192.168.0.20"
-                            },
-                            "csarVersion": {
-                                "type_name": "string",
-                                "value": "v1.0"
-                            },
-                            "csarType": {
-                                "type_name": "string",
-                                "value": "NFAR"
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "Standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "capabilities": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            },
-                            {
-                                "name": "vnat_fw_inout",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "relationships": [
-                            {
-                                "name": "vnat_ctrl_by_manager_cp",
-                                "source_requirement_index": 0,
-                                "target_node_id": "ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "vnat_data_cp",
-                                "source_requirement_index": 1,
-                                "target_node_id": "sfc_data_network_vx3pc1oahn0k0pa5q722yafee",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "source_requirement_index": 2,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            },
-                            {
-                                "name": "forwarder",
-                                "source_requirement_index": 3,
-                                "target_node_id": "path2_kgmfqr5ldqs9lj3oscrgxqefc",
-                                "target_capability_name": "feature"
-                            }
-                        ]
-                    }
-                ],
-                "groups": [
-                    {
-                        "id": "vnffg1_wk1aqhk6exoh5fmds2unu0uyc",
-                        "type_name": "tosca.groups.nfv.VNFFG",
-                        "template_name": "vnffg1",
-                        "properties": {
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "connection_point": {
-                                "type_name": "list",
-                                "value": [
-                                    "m6000_data_in",
-                                    "m600_tunnel_cp",
-                                    "m6000_data_out"
-                                ]
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "constituent_vnfs": {
-                                "type_name": "list",
-                                "value": [
-                                    "VFW",
-                                    "VNAT"
-                                ]
-                            },
-                            "number_of_endpoints": {
-                                "type_name": "integer",
-                                "value": 3
-                            },
-                            "dependent_virtual_link": {
-                                "type_name": "list",
-                                "value": [
-                                    "sfc_data_network",
-                                    "ext_datanet_net",
-                                    "ext_mnet_net"
-                                ]
-                            }
-                        },
-                        "interfaces": [
-                            {
-                                "name": "standard",
-                                "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                                "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                                "operations": [
-                                    {
-                                        "name": "create",
-                                        "description": "Standard lifecycle create operation."
-                                    },
-                                    {
-                                        "name": "stop",
-                                        "description": "Standard lifecycle stop operation."
-                                    },
-                                    {
-                                        "name": "start",
-                                        "description": "Standard lifecycle start operation."
-                                    },
-                                    {
-                                        "name": "delete",
-                                        "description": "Standard lifecycle delete operation."
-                                    },
-                                    {
-                                        "name": "configure",
-                                        "description": "Standard lifecycle configure operation."
-                                    }
-                                ]
-                            }
-                        ],
-                        "member_node_ids": [
-                            "path1_bv53fblv26hawr8dj4fxe2rsd",
-                            "path2_kgmfqr5ldqs9lj3oscrgxqefc"
-                        ]
-                    }
-                ],
-                "substitution": {
-                    "node_type_name": "tosca.nodes.nfv.NS.VCPE_NS"
-                },
-                "inputs": {
-                    "externalDataNetworkName": {
-                        "type_name": "string",
-                        "value": "vlan_4004_tunnel_net"
-                    },
-                    "sfc_data_network": {
-                        "type_name": "string",
-                        "value": "sfc_data_network"
-                    },
-                    "NatIpRange": {
-                        "type_name": "string",
-                        "value": "192.167.0.10-192.168.0.20"
-                    },
-                    "externalManageNetworkName": {
-                        "type_name": "string",
-                        "value": "vlan_4008_mng_net"
-                    },
-                    "externalPluginManageNetworkName": {
-                        "type_name": "string",
-                        "value": "vlan_4007_plugin_net"
-                    }
-                }
-            },
-            "model": {
-                "metadata": {
-                    "vendor": "ZTE",
-                    "name": "VCPE_NS",
-                    "csarVersion": "v1.0",
-                    "csarType": "NSAR",
-                    "csarProvider": "ZTE",
-                    "version": 1,
-                    "invariant_id": "vcpe_ns_sff_1",
-                    "id": "VCPE_NS",
-                    "description": "vcpe_ns"
-                },
-                "node_templates": [
-                    {
-                        "name": "path2",
-                        "type_name": "tosca.nodes.nfv.ext.FP",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "symmetric": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "policy": {
-                                "type_name": "tosca.datatypes.nfv.ext.FPPolicy",
-                                "value": {
-                                    "type": "ACL",
-                                    "criteria": {
-                                        "dest_port_range": "1-100",
-                                        "ip_protocol": "tcp",
-                                        "source_ip_range": [
-                                            "119.1.1.1-119.1.1.10"
-                                        ],
-                                        "dest_ip_range": [
-                                            {"get_input": "NatIpRange"}
-                                        ],
-                                        "dscp": 0,
-                                        "source_port_range": "1-100"
-                                    }
-                                }
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ed0288a10>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "m6000_data_out"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "m600_tunnel_cp"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "VNAT",
-                                "target_capability_name": "vnat_fw_inout"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "path1",
-                        "type_name": "tosca.nodes.nfv.ext.FP",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "symmetric": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "policy": {
-                                "type_name": "tosca.datatypes.nfv.ext.FPPolicy",
-                                "value": {
-                                    "type": "ACL",
-                                    "criteria": {
-                                        "dest_port_range": "1-100",
-                                        "ip_protocol": "tcp",
-                                        "source_ip_range": [
-                                            "1-100"
-                                        ],
-                                        "dest_ip_range": [
-                                            "1-100"
-                                        ],
-                                        "dscp": 4,
-                                        "source_port_range": "1-100"
-                                    }
-                                }
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec81df090>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "m6000_data_in"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "m600_tunnel_cp"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "VFW",
-                                "target_capability_name": "vfw_fw_inout"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "VNAT",
-                                "target_capability_name": "vnat_fw_inout"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "m600_tunnel_cp"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_template_name": "m6000_data_out"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "m6000_data_out",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "11-22-33-22-11-44"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "xgei-0/4/1/5"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "176.1.1.2"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec82c6610>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "virtualbinding",
-                                "target_node_template_name": "m6000_s",
-                                "target_capability_name": "virtualBinding"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "VFW",
-                        "type_name": "tosca.nodes.nfv.ext.zte.VNF.VFW",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "is_shared": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "plugin_info": {
-                                "type_name": "string",
-                                "value": "vbrasplugin_1.0"
-                            },
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "request_reclassification": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "vnf_extend_type": {
-                                "type_name": "string",
-                                "value": "driver"
-                            },
-                            "name": {
-                                "type_name": "string",
-                                "value": "VFW"
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "cross_dc": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "vnf_type": {
-                                "type_name": "string",
-                                "value": "VFW"
-                            },
-                            "vnfd_version": {
-                                "type_name": "string",
-                                "value": "1.0.0"
-                            },
-                            "id": {
-                                "type_name": "string",
-                                "value": "vcpe_vfw_zte_1_0"
-                            },
-                            "nsh_aware": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "adjust_vnf_capacity": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "vmnumber_overquota_alarm": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "csarProvider": {
-                                "type_name": "string",
-                                "value": "ZTE"
-                            },
-                            "csarVersion": {
-                                "type_name": "string",
-                                "value": "v1.0"
-                            },
-                            "externalPluginManageNetworkName": {
-                                "type_name": "string",
-                                "value": "vlan_4007_plugin_net"
-                            },
-                            "csarType": {
-                                "type_name": "string",
-                                "value": "NFAR"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec8281950>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            },
-                            {
-                                "name": "vfw_fw_inout",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "vfw_ctrl_by_manager_cp",
-                                "target_node_template_name": "ext_mnet_net",
-                                "target_capability_name": "virtual_linkable"
-                            },
-                            {
-                                "name": "vfw_data_cp",
-                                "target_node_template_name": "sfc_data_network",
-                                "target_capability_name": "virtual_linkable"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "m600_tunnel_cp",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "00-11-00-22-33-00"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "gei-0/4/0/13"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "191.167.100.5"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x1ae39d0>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "virtualLink",
-                                "target_node_template_name": "ext_datanet_net",
-                                "target_capability_name": "virtual_linkable"
-                            },
-                            {
-                                "name": "virtualbinding",
-                                "target_node_template_name": "m6000_s",
-                                "target_capability_name": "virtualBinding"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "ext_mnet_net",
-                        "type_name": "tosca.nodes.nfv.ext.VL.Vmware",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "name": {
-                                "type_name": "string",
-                                "value": "vlan_4008_mng_net"
-                            },
-                            "dhcp_enabled": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "location_info": {
-                                "type_name": "tosca.datatypes.nfv.ext.LocationInfo",
-                                "value": {
-                                    "tenant": "admin",
-                                    "vimid": 2,
-                                    "availability_zone": "nova"
-                                }
-                            },
-                            "ip_version": {
-                                "type_name": "integer",
-                                "value": 4
-                            },
-                            "mtu": {
-                                "type_name": "integer",
-                                "value": 1500
-                            },
-                            "network_name": {
-                                "type_name": "string",
-                                "value": "vlan_4008_mng_net"
-                            },
-                            "network_type": {
-                                "type_name": "string",
-                                "value": "vlan"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ed00f89d0>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtual_linkable",
-                                "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "m6000_data_in",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "11-22-33-22-11-41"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "gei-0/4/0/7"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "1.1.1.1"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            },
-                            "bond": {
-                                "type_name": "string",
-                                "value": "none"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x1745710>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "virtualbinding",
-                                "target_node_template_name": "m6000_s",
-                                "target_capability_name": "virtualBinding"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "ext_datanet_net",
-                        "type_name": "tosca.nodes.nfv.ext.VL.Vmware",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "name": {
-                                "type_name": "string",
-                                "value": "vlan_4004_tunnel_net"
-                            },
-                            "dhcp_enabled": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "location_info": {
-                                "type_name": "tosca.datatypes.nfv.ext.LocationInfo",
-                                "value": {
-                                    "tenant": "admin",
-                                    "vimid": 2,
-                                    "availability_zone": "nova"
-                                }
-                            },
-                            "ip_version": {
-                                "type_name": "integer",
-                                "value": 4
-                            },
-                            "mtu": {
-                                "type_name": "integer",
-                                "value": 1500
-                            },
-                            "network_name": {
-                                "type_name": "string",
-                                "value": "vlan_4004_tunnel_net"
-                            },
-                            "network_type": {
-                                "type_name": "string",
-                                "value": "vlan"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8eac063990>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtual_linkable",
-                                "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "m600_mnt_cp",
-                        "type_name": "tosca.nodes.nfv.ext.zte.CP",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "direction": {
-                                "type_name": "string",
-                                "value": "bidirectional"
-                            },
-                            "vnic_type": {
-                                "type_name": "string",
-                                "value": "normal"
-                            },
-                            "bandwidth": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "mac_address": {
-                                "type_name": "string",
-                                "value": "00-11-00-22-33-11"
-                            },
-                            "interface_name": {
-                                "type_name": "string",
-                                "value": "gei-0/4/0/1"
-                            },
-                            "ip_address": {
-                                "type_name": "string",
-                                "value": "10.46.244.51"
-                            },
-                            "order": {
-                                "type_name": "integer",
-                                "value": 0
-                            },
-                            "sfc_encapsulation": {
-                                "type_name": "string",
-                                "value": "mac"
-                            },
-                            "bond": {
-                                "type_name": "string",
-                                "value": "none"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec81264d0>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "virtualLink",
-                                "target_node_template_name": "ext_mnet_net",
-                                "target_capability_name": "virtual_linkable"
-                            },
-                            {
-                                "name": "virtualbinding",
-                                "target_node_template_name": "m6000_s",
-                                "target_capability_name": "virtualBinding"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "sfc_data_network",
-                        "type_name": "tosca.nodes.nfv.ext.zte.VL",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "name": {
-                                "type_name": "string",
-                                "value": "sfc_data_network"
-                            },
-                            "dhcp_enabled": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "is_predefined": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "location_info": {
-                                "type_name": "tosca.datatypes.nfv.ext.LocationInfo",
-                                "value": {
-                                    "tenant": "admin",
-                                    "vimid": 2,
-                                    "availability_zone": "nova"
-                                }
-                            },
-                            "ip_version": {
-                                "type_name": "integer",
-                                "value": 4
-                            },
-                            "mtu": {
-                                "type_name": "integer",
-                                "value": 1500
-                            },
-                            "network_name": {
-                                "type_name": "string",
-                                "value": "sfc_data_network"
-                            },
-                            "network_type": {
-                                "type_name": "string",
-                                "value": "vlan"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec813c6d0>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtual_linkable",
-                                "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "m6000_s",
-                        "type_name": "tosca.nodes.nfv.ext.PNF",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "request_reclassification": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "pnf_type": {
-                                "type_name": "string",
-                                "value": "m6000s"
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "management_address": {
-                                "type_name": "string",
-                                "value": "111111"
-                            },
-                            "id": {
-                                "type_name": "string",
-                                "value": "m6000_s"
-                            },
-                            "nsh_aware": {
-                                "type_name": "boolean",
-                                "value": False
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec8132490>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "virtualBinding",
-                                "type_name": "tosca.capabilities.nfv.VirtualBindable"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    },
-                    {
-                        "name": "VNAT",
-                        "type_name": "tosca.nodes.nfv.ext.zte.VNF.VNAT",
-                        "default_instances": 1,
-                        "min_instances": 0,
-                        "properties": {
-                            "is_shared": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "plugin_info": {
-                                "type_name": "string",
-                                "value": "vbrasplugin_1.0"
-                            },
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "request_reclassification": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "name": {
-                                "type_name": "string",
-                                "value": "VNAT"
-                            },
-                            "vnf_extend_type": {
-                                "type_name": "string",
-                                "value": "driver"
-                            },
-                            "externalPluginManageNetworkName": {
-                                "type_name": "string",
-                                "value": "vlan_4007_plugin_net"
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "cross_dc": {
-                                "type_name": "boolean",
-                                "value": False
-                            },
-                            "vnf_type": {
-                                "type_name": "string",
-                                "value": "VNAT"
-                            },
-                            "vnfd_version": {
-                                "type_name": "string",
-                                "value": "1.0.0"
-                            },
-                            "id": {
-                                "type_name": "string",
-                                "value": "vcpe_vnat_zte_1"
-                            },
-                            "nsh_aware": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "adjust_vnf_capacity": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "vmnumber_overquota_alarm": {
-                                "type_name": "boolean",
-                                "value": True
-                            },
-                            "csarProvider": {
-                                "type_name": "string",
-                                "value": "ZTE"
-                            },
-                            "NatIpRange": {
-                                "type_name": "string",
-                                "value": "192.167.0.10-192.168.0.20"
-                            },
-                            "csarVersion": {
-                                "type_name": "string",
-                                "value": "v1.0"
-                            },
-                            "csarType": {
-                                "type_name": "string",
-                                "value": "NFAR"
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x1bba810>"
-                        ],
-                        "capability_templates": [
-                            {
-                                "name": "feature",
-                                "type_name": "tosca.capabilities.Node"
-                            },
-                            {
-                                "name": "forwarder",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            },
-                            {
-                                "name": "vnat_fw_inout",
-                                "type_name": "tosca.capabilities.nfv.Forwarder"
-                            }
-                        ],
-                        "requirement_templates": [
-                            {
-                                "name": "vnat_ctrl_by_manager_cp",
-                                "target_node_template_name": "ext_mnet_net",
-                                "target_capability_name": "virtual_linkable"
-                            },
-                            {
-                                "name": "vnat_data_cp",
-                                "target_node_template_name": "sfc_data_network",
-                                "target_capability_name": "virtual_linkable"
-                            },
-                            {
-                                "name": "virtualLink",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            },
-                            {
-                                "name": "forwarder",
-                                "target_node_type_name": "tosca.nodes.Root"
-                            }
-                        ]
-                    }
-                ],
-                "group_templates": [
-                    {
-                        "name": "vnffg1",
-                        "type_name": "tosca.groups.nfv.VNFFG",
-                        "properties": {
-                            "vendor": {
-                                "type_name": "string",
-                                "value": "zte"
-                            },
-                            "connection_point": {
-                                "type_name": "list",
-                                "value": [
-                                    "m6000_data_in",
-                                    "m600_tunnel_cp",
-                                    "m6000_data_out"
-                                ]
-                            },
-                            "version": {
-                                "type_name": "string",
-                                "value": "1.0"
-                            },
-                            "constituent_vnfs": {
-                                "type_name": "list",
-                                "value": [
-                                    "VFW",
-                                    "VNAT"
-                                ]
-                            },
-                            "number_of_endpoints": {
-                                "type_name": "integer",
-                                "value": 3
-                            },
-                            "dependent_virtual_link": {
-                                "type_name": "list",
-                                "value": [
-                                    "sfc_data_network",
-                                    "ext_datanet_net",
-                                    "ext_mnet_net"
-                                ]
-                            }
-                        },
-                        "interface_templates": [
-                            "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec811cd10>"
-                        ],
-                        "member_node_template_names": [
-                            "path1",
-                            "path2"
-                        ]
-                    }
-                ],
-                "substitution_template": {
-                    "node_type_name": "tosca.nodes.nfv.NS.VCPE_NS"
-                },
-                "inputs": {
-                    "externalDataNetworkName": {
-                        "type_name": "string",
-                        "value": "vlan_4004_tunnel_net"
-                    },
-                    "sfc_data_network": {
-                        "type_name": "string",
-                        "value": "sfc_data_network"
-                    },
-                    "NatIpRange": {
-                        "type_name": "string",
-                        "value": "192.167.0.10-192.168.0.20"
-                    },
-                    "externalManageNetworkName": {
-                        "type_name": "string",
-                        "value": "vlan_4008_mng_net"
-                    },
-                    "externalPluginManageNetworkName": {
-                        "type_name": "string",
-                        "value": "vlan_4007_plugin_net"
-                    }
-                }
-            }
-        }
-    )
-    print convert_nsd_model(src_json)
diff --git a/lcm/pub/utils/toscautil_new.py b/lcm/pub/utils/toscautil_new.py
deleted file mode 100644 (file)
index 995d522..0000000
+++ /dev/null
@@ -1,1502 +0,0 @@
-# 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.
-
-import json
-
-
-def safe_get(key_val, key):
-    return key_val[key] if key in key_val else ""
-
-
-def find_node_name(node_id, node_list):
-    for node in node_list:
-        if node['id'] == node_id:
-            return node['template_name']
-    raise Exception('can not find node(%s).' % node_id)
-
-
-def find_node_type(node_id, node_list):
-    for node in node_list:
-        if node['id'] == node_id:
-            return node['type_name']
-    raise Exception('can not find node(%s).' % node_id)
-
-
-def find_related_node(node_id, src_json_model, requirement_name):
-    related_nodes = []
-    for model_tpl in safe_get(src_json_model, "node_templates"):
-        for rt in safe_get(model_tpl, 'requirement_templates'):
-            if safe_get(rt, 'name') == requirement_name and safe_get(rt, 'target_node_template_name') == node_id:
-                related_nodes.append(model_tpl['name'])
-    return related_nodes
-
-
-def convert_props(src_node, dest_node):
-    if 'properties' in src_node and src_node['properties']:
-        for prop_name, prop_info in src_node['properties'].items():
-            if 'value' in prop_info:
-                dest_node['properties'][prop_name] = prop_info['value']
-
-
-def convert_metadata(src_json):
-    return src_json['metadata'] if 'metadata' in src_json else {}
-
-
-def convert_factor_unit(value):
-    if isinstance(value, (str, unicode)):
-        return value
-    return "%s %s" % (value["factor"], value["unit"])
-
-
-def convert_inputs(src_json):
-    inputs = {}
-    if 'inputs' in src_json:
-        src_inputs = src_json['inputs']
-        for param_name, param_info in src_inputs.items():
-            input_param = {}
-            if 'type_name' in param_info:
-                input_param['type'] = param_info['type_name']
-            if 'description' in param_info:
-                input_param['description'] = param_info['description']
-            if 'value' in param_info:
-                input_param['value'] = param_info['value']
-            inputs[param_name] = input_param
-    return inputs
-
-
-def convert_vnf_node(src_node, src_json_model):
-    vnf_node = {
-        'type': src_node['type_name'],
-        'vnf_id': src_node['template_name'],
-        'description': '',
-        'properties': {},
-        'dependencies': [],
-        'networks': []
-    }
-    convert_props(src_node, vnf_node)
-    for model_tpl in safe_get(src_json_model, "node_templates"):
-        if model_tpl['name'] != vnf_node['vnf_id']:
-            continue
-        vnf_node['dependencies'] = [
-            {
-                'key_name': requirement['name'],
-                'vl_id': requirement['target_node_template_name']
-            } for requirement in safe_get(model_tpl, 'requirement_templates')
-            if safe_get(requirement, 'target_capability_name') == 'virtual_linkable'
-        ]
-        vnf_node['networks'] = [requirement['target_node_template_name'] for
-                                requirement in safe_get(model_tpl, 'requirement_templates') if
-                                safe_get(requirement, 'name') == 'dependency']
-    return vnf_node
-
-
-def convert_pnf_node(src_node, src_json_model):
-    pnf_node = {'pnf_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, pnf_node)
-    pnf_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
-    return pnf_node
-
-
-def convert_vl_node(src_node, src_node_list):
-    vl_node = {'vl_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, vl_node)
-    vl_node['route_id'] = ''
-    for relation in safe_get(src_node, 'relationships'):
-        if safe_get(relation, 'type_name').endswith('.VirtualLinksTo'):
-            vl_node['route_id'] = find_node_name(relation['target_node_id'], src_node_list)
-            break
-    vl_node['route_external'] = (src_node['type_name'].find('.RouteExternalVL') > 0)
-    return vl_node
-
-
-def convert_cp_node(src_node, src_node_list, model_type='NSD'):
-    cp_node = {'cp_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, cp_node)
-    src_relationships = src_node['relationships']
-    for relation in src_relationships:
-        if safe_get(relation, 'name') in ('virtualLink', 'virtual_link'):
-            cp_node['vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
-        elif safe_get(relation, 'name') in ('virtualbinding', 'virtual_binding'):
-            node_key = 'pnf_id' if model_type == 'NSD' else 'vdu_id'
-            cp_node[node_key] = find_node_name(relation['target_node_id'], src_node_list)
-    return cp_node
-
-
-def convert_router_node(src_node, src_node_list):
-    router_node = {'router_id': src_node['template_name'], 'description': '', 'properties': {}}
-    convert_props(src_node, router_node)
-    for relation in src_node['relationships']:
-        if safe_get(relation, 'name') != 'external_virtual_link':
-            continue
-        router_node['external_vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
-        router_node['external_ip_addresses'] = []
-        if 'properties' not in relation:
-            continue
-        for prop_name, prop_info in relation['properties'].items():
-            if prop_name == 'router_ip_address':
-                router_node['external_ip_addresses'].append(prop_info['value'])
-        break
-    return router_node
-
-
-def convert_fp_node(src_node, src_node_list, src_json_model):
-    fp_node = {
-        'fp_id': src_node['template_name'],
-        'description': '',
-        'properties': {},
-        'forwarder_list': []
-    }
-    convert_props(src_node, fp_node)
-    for relation in safe_get(src_node, 'relationships'):
-        if safe_get(relation, 'name') != 'forwarder':
-            continue
-        forwarder_point = {'type': 'vnf'}
-        target_node_type = find_node_type(relation['target_node_id'], src_node_list).upper()
-        if target_node_type.find('.CP.') >= 0 or target_node_type.endswith('.CP'):
-            forwarder_point['type'] = 'cp'
-        forwarder_point['node_name'] = find_node_name(relation['target_node_id'], src_node_list)
-        forwarder_point['capability'] = ''
-        if forwarder_point['type'] == 'vnf':
-            for node_tpl in src_json_model["node_templates"]:
-                if fp_node['fp_id'] != node_tpl["name"]:
-                    continue
-                for r_tpl in safe_get(node_tpl, "requirement_templates"):
-                    if safe_get(r_tpl, "target_node_template_name") != forwarder_point['node_name']:
-                        continue
-                    forwarder_point['capability'] = safe_get(r_tpl, "target_capability_name")
-                    break
-                break
-        fp_node['forwarder_list'].append(forwarder_point)
-    return fp_node
-
-
-def convert_vnffg_group(src_group, src_group_list, src_node_list):
-    vnffg = {
-        'vnffg_id': src_group['template_name'],
-        'description': '',
-        'properties': {},
-        'members': []
-    }
-    convert_props(src_group, vnffg)
-    for member_node_id in src_group['member_node_ids']:
-        vnffg['members'].append(find_node_name(member_node_id, src_node_list))
-    return vnffg
-
-
-def convert_imagefile_node(src_node, src_node_list):
-    image_node = {
-        'image_file_id': src_node['template_name'],
-        'description': '',
-        'properties': {}
-    }
-    convert_props(src_node, image_node)
-    return image_node
-
-
-def convert_localstorage_node(src_node, src_node_list):
-    localstorage_node = {
-        'local_storage_id': src_node['template_name'],
-        'description': '',
-        'properties': {}
-    }
-    convert_props(src_node, localstorage_node)
-    return localstorage_node
-
-
-def convert_volumestorage_node(src_node, src_node_list):
-    volumestorage_node = {
-        'volume_storage_id': src_node['id'],
-        'description': "",
-        'properties': {}}
-    convert_props(src_node, volumestorage_node)
-    volumestorage_node["properties"]["size"] = convert_factor_unit(
-        volumestorage_node["properties"]["size_of_storage"])
-    return volumestorage_node
-
-
-def convert_vdu_node(src_node, src_node_list, src_json_model):
-    vdu_node = {
-        'vdu_id': src_node['template_name'],
-        'description': '',
-        'properties': {},
-        'image_file': '',
-        'local_storages': [],
-        'dependencies': [],
-        'nfv_compute': {},
-        'vls': [],
-        'artifacts': [],
-        'volume_storages': []
-    }
-    convert_props(src_node, vdu_node)
-
-    for relation in src_node.get('relationships', ''):
-        r_id, r_name = safe_get(relation, 'target_node_id'), safe_get(relation, 'name')
-        if r_name == 'guest_os':
-            vdu_node['image_file'] = find_node_name(r_id, src_node_list)
-        elif r_name == 'local_storage':
-            vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
-        elif r_name == 'virtual_storage':
-            vdu_node['volume_storages'].append(r_id)
-        elif r_name.endswith('.AttachesTo'):
-            nt = find_node_type(r_id, src_node_list)
-            if nt.endswith('.BlockStorage.Local') or nt.endswith('.LocalStorage'):
-                vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
-
-    for capability in src_node['capabilities']:
-        if not capability['type_name'].endswith('.VirtualCompute'):
-            continue
-        vdu_node['nfv_compute']['flavor_extra_specs'] = {}
-        for prop_name, prop_info in capability['properties'].items():
-            if prop_name == "virtual_cpu":
-                vdu_node['nfv_compute']['num_cpus'] = prop_info["value"]["num_virtual_cpu"]
-                if "virtual_cpu_clock" in prop_info["value"]:
-                    vdu_node['nfv_compute']['cpu_frequency'] =\
-                        convert_factor_unit(prop_info["value"]["virtual_cpu_clock"])
-            elif prop_name == "virtual_memory":
-                vdu_node['nfv_compute']['mem_size'] = convert_factor_unit(
-                    prop_info["value"]["virtual_mem_size"])
-            elif prop_name == "requested_additional_capabilities":
-                if prop_info and "value" in prop_info:
-                    for key, val in prop_info["value"].items():
-                        vdu_node['nfv_compute']['flavor_extra_specs'].update(
-                            val["target_performance_parameters"])
-
-    vdu_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
-
-    for cp_node in vdu_node['cps']:
-        for src_cp_node in src_node_list:
-            if src_cp_node['template_name'] != cp_node:
-                continue
-            for relation in safe_get(src_cp_node, 'relationships'):
-                if relation['name'] != 'virtualLink':
-                    continue
-                vl_node_name = find_node_name(relation['target_node_id'], src_node_list)
-                if vl_node_name not in vdu_node['vls']:
-                    vdu_node['vls'].append(vl_node_name)
-
-    for item in safe_get(src_node, 'artifacts'):
-        artifact = {
-            'artifact_name': item['name'],
-            'type': item['type_name'],
-            'file': item['source_path'],
-            'properties': {}
-        }
-        convert_props(item, artifact)
-        for key in artifact['properties']:
-            if 'factor' in artifact['properties'][key] and 'unit' in artifact['properties'][key]:
-                artifact['properties'][key] = convert_factor_unit(artifact['properties'][key])
-        vdu_node['artifacts'].append(artifact)
-        if artifact["type"].endswith(".SwImage"):
-            vdu_node['image_file'] = artifact["artifact_name"]
-    return vdu_node
-
-
-def convert_exposed_node(src_json, src_nodes, exposed):
-    for item in safe_get(safe_get(src_json, 'substitution'), 'requirements'):
-        external_cps = {
-            'key_name': item['mapped_name'],
-            "cp_id": find_node_name(item['node_id'], src_nodes)
-        }
-        exposed['external_cps'].append(external_cps)
-    for item in safe_get(safe_get(src_json, 'substitution'), 'capabilities'):
-        forward_cps = {
-            'key_name': item['mapped_name'],
-            "cp_id": find_node_name(item['node_id'], src_nodes)
-        }
-        exposed['forward_cps'].append(forward_cps)
-
-
-def convert_vnffgs(src_json_inst, src_nodes):
-    vnffgs = []
-    src_groups = safe_get(src_json_inst, 'groups')
-    for group in src_groups:
-        type_name = group['type_name'].upper()
-        if type_name.find('.VNFFG.') >= 0 or type_name.endswith('.VNFFG'):
-            vnffgs.append(convert_vnffg_group(group, src_groups, src_nodes))
-    return vnffgs
-
-
-def merge_imagefile_node(img_nodes, vdu_nodes):
-    for vdu_node in vdu_nodes:
-        for artifact in vdu_node.get("artifacts", []):
-            if not artifact["type"].endswith(".SwImage"):
-                continue
-            imgids = [img["image_file_id"] for img in img_nodes]
-            if artifact["artifact_name"] in imgids:
-                continue
-            img_nodes.append({
-                "image_file_id": artifact["artifact_name"],
-                "description": "",
-                "properties": artifact["properties"]
-            })
-
-
-def convert_common(src_json, target_json):
-    if isinstance(src_json, (unicode, str)):
-        src_json_dict = json.loads(src_json)
-    else:
-        src_json_dict = src_json
-    src_json_inst = src_json_dict["instance"]
-    src_json_model = src_json_dict["model"] if "model" in src_json_dict else {}
-
-    target_json['metadata'] = convert_metadata(src_json_inst)
-    target_json['inputs'] = convert_inputs(src_json_inst)
-    target_json['vls'] = []
-    target_json['cps'] = []
-    target_json['routers'] = []
-
-    return src_json_inst, src_json_model
-
-
-def convert_nsd_model(src_json):
-    target_json = {'vnfs': [], 'pnfs': [], 'fps': []}
-    src_json_inst, src_json_model = convert_common(src_json, target_json)
-
-    src_nodes = src_json_inst['nodes']
-    for node in src_nodes:
-        type_name = node['type_name']
-        if type_name.find('.VNF.') > 0 or type_name.endswith('.VNF'):
-            target_json['vnfs'].append(convert_vnf_node(node, src_json_model))
-        elif type_name.find('.PNF.') > 0 or type_name.endswith('.PNF'):
-            target_json['pnfs'].append(convert_pnf_node(node, src_json_model))
-        elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
-                or node['type_name'].find('.RouteExternalVL') > 0:
-            target_json['vls'].append(convert_vl_node(node, src_nodes))
-        elif type_name.find('.CP.') > 0 or type_name.endswith('.CP'):
-            target_json['cps'].append(convert_cp_node(node, src_nodes))
-        elif type_name.find('.FP.') > 0 or type_name.endswith('.FP'):
-            target_json['fps'].append(convert_fp_node(node, src_nodes, src_json_model))
-        elif type_name.endswith('.Router'):
-            target_json['routers'].append(convert_router_node(node, src_nodes))
-
-    target_json['vnffgs'] = convert_vnffgs(src_json_inst, src_nodes)
-
-    target_json['ns_exposed'] = {'external_cps': [], 'forward_cps': []}
-    convert_exposed_node(src_json_inst, src_nodes, target_json['ns_exposed'])
-    return json.dumps(target_json)
-
-
-def convert_vnfd_model(src_json):
-    target_json = {'image_files': [], 'local_storages': [], 'vdus': [], 'volume_storages': []}
-    src_json_inst, src_json_model = convert_common(src_json, target_json)
-
-    src_nodes = src_json_inst['nodes']
-    for node in src_nodes:
-        type_name = node['type_name']
-        if type_name.endswith('.ImageFile'):
-            target_json['image_files'].append(convert_imagefile_node(node, src_nodes))
-        elif type_name.endswith('.BlockStorage.Local') or type_name.endswith('.LocalStorage'):
-            target_json['local_storages'].append(convert_localstorage_node(node, src_nodes))
-        elif type_name.endswith('VDU.VirtualStorage'):
-            target_json['volume_storages'].append(convert_volumestorage_node(node, src_nodes))
-        elif type_name.endswith('VDU.Compute'):
-            target_json['vdus'].append(convert_vdu_node(node, src_nodes, src_json_model))
-        elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
-                or type_name.endswith('.VnfVirtualLinkDesc') \
-                or type_name.endswith('.RouteExternalVL'):
-            target_json['vls'].append(convert_vl_node(node, src_nodes))
-        elif type_name.find('.CP.') > 0 or type_name.endswith('.CP') or type_name.endswith(".VduCpd"):
-            target_json['cps'].append(convert_cp_node(node, src_nodes, 'VNFD'))
-        elif type_name.endswith('.Router'):
-            target_json['routers'].append(convert_router_node(node, src_nodes))
-
-    target_json['vnf_exposed'] = {'external_cps': [], 'forward_cps': []}
-    convert_exposed_node(src_json_inst, src_nodes, target_json['vnf_exposed'])
-    merge_imagefile_node(target_json['image_files'], target_json['vdus'])
-    return json.dumps(target_json)
-
-
-if __name__ == '__main__':
-    src_json = json.dumps({
-        "instance": {
-            "metadata": {
-                "vnfSoftwareVersion": "1.0.0",
-                "vnfProductName": "zte",
-                "localizationLanguage": [
-                    "english",
-                    "chinese"
-                ],
-                "vnfProvider": "zte",
-                "vnfmInfo": "zte",
-                "defaultLocalizationLanguage": "english",
-                "vnfdId": "zte-hss-1.0",
-                "vnfProductInfoDescription": "hss",
-                "vnfdVersion": "1.0.0",
-                "vnfProductInfoName": "hss"
-            },
-            "nodes": [
-                {
-                    "id": "vNAT_Storage_6wdgwzedlb6sq18uzrr41sof7",
-                    "type_name": "tosca.nodes.nfv.VDU.VirtualStorage",
-                    "template_name": "vNAT_Storage",
-                    "properties": {
-                        "size_of_storage": {
-                            "type_name": "scalar-unit.size",
-                            "value": {
-                                "value": 10000000000,
-                                "factor": 10,
-                                "unit": "GB",
-                                "unit_size": 1000000000
-                            }
-                        },
-                        "type_of_storage": {
-                            "type_name": "string",
-                            "value": "volume"
-                        },
-                        "rdma_enabled": {
-                            "type_name": "boolean",
-                            "value": False
-                        }
-                    },
-                    "interfaces": [
-                        {
-                            "name": "Standard",
-                            "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                            "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                            "operations": [
-                                {
-                                    "name": "create",
-                                    "description": "Standard lifecycle create operation."
-                                },
-                                {
-                                    "name": "stop",
-                                    "description": "Standard lifecycle stop operation."
-                                },
-                                {
-                                    "name": "start",
-                                    "description": "Standard lifecycle start operation."
-                                },
-                                {
-                                    "name": "delete",
-                                    "description": "Standard lifecycle delete operation."
-                                },
-                                {
-                                    "name": "configure",
-                                    "description": "Standard lifecycle configure operation."
-                                }
-                            ]
-                        }
-                    ],
-                    "capabilities": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        },
-                        {
-                            "name": "virtual_storage",
-                            "type_name": "tosca.capabilities.nfv.VirtualStorage"
-                        }
-                    ]
-                },
-                {
-                    "id": "sriov_link_2610d7gund4e645wo39dvp238",
-                    "type_name": "tosca.nodes.nfv.VnfVirtualLinkDesc",
-                    "template_name": "sriov_link",
-                    "properties": {
-                        "vl_flavours": {
-                            "type_name": "map",
-                            "value": {
-                                "vl_id": "aaaa"
-                            }
-                        },
-                        "connectivity_type": {
-                            "type_name": "tosca.datatypes.nfv.ConnectivityType",
-                            "value": {
-                                "layer_protocol": "ipv4",
-                                "flow_pattern": "flat"
-                            }
-                        },
-                        "description": {
-                            "type_name": "string",
-                            "value": "sriov_link"
-                        },
-                        "test_access": {
-                            "type_name": "list",
-                            "value": [
-                                "test"
-                            ]
-                        }
-                    },
-                    "interfaces": [
-                        {
-                            "name": "Standard",
-                            "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                            "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                            "operations": [
-                                {
-                                    "name": "create",
-                                    "description": "Standard lifecycle create operation."
-                                },
-                                {
-                                    "name": "stop",
-                                    "description": "Standard lifecycle stop operation."
-                                },
-                                {
-                                    "name": "start",
-                                    "description": "Standard lifecycle start operation."
-                                },
-                                {
-                                    "name": "delete",
-                                    "description": "Standard lifecycle delete operation."
-                                },
-                                {
-                                    "name": "configure",
-                                    "description": "Standard lifecycle configure operation."
-                                }
-                            ]
-                        }
-                    ],
-                    "capabilities": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        },
-                        {
-                            "name": "virtual_linkable",
-                            "type_name": "tosca.capabilities.nfv.VirtualLinkable"
-                        }
-                    ]
-                },
-                {
-                    "id": "vdu_vNat_7ozwkcr86sa87fmd2nue2ww07",
-                    "type_name": "tosca.nodes.nfv.VDU.Compute",
-                    "template_name": "vdu_vNat",
-                    "properties": {
-                        "configurable_properties": {
-                            "type_name": "map",
-                            "value": {
-                                "test": {
-                                    "additional_vnfc_configurable_properties": {
-                                        "aaa": "1",
-                                        "bbb": "2",
-                                        "ccc": "3"
-                                    }
-                                }
-                            }
-                        },
-                        "boot_order": {
-                            "type_name": "list",
-                            "value": [
-                                "vNAT_Storage"
-                            ]
-                        },
-                        "name": {
-                            "type_name": "string",
-                            "value": "vNat"
-                        },
-                        "nfvi_constraints": {
-                            "type_name": "list",
-                            "value": [
-                                "test"
-                            ]
-                        },
-                        "description": {
-                            "type_name": "string",
-                            "value": "the virtual machine of vNat"
-                        }
-                    },
-                    "interfaces": [
-                        {
-                            "name": "Standard",
-                            "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                            "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                            "operations": [
-                                {
-                                    "name": "create",
-                                    "description": "Standard lifecycle create operation."
-                                },
-                                {
-                                    "name": "stop",
-                                    "description": "Standard lifecycle stop operation."
-                                },
-                                {
-                                    "name": "start",
-                                    "description": "Standard lifecycle start operation."
-                                },
-                                {
-                                    "name": "delete",
-                                    "description": "Standard lifecycle delete operation."
-                                },
-                                {
-                                    "name": "configure",
-                                    "description": "Standard lifecycle configure operation."
-                                }
-                            ]
-                        }
-                    ],
-                    "artifacts": [
-                        {
-                            "name": "vNatVNFImage",
-                            "type_name": "tosca.artifacts.nfv.SwImage",
-                            "source_path": "/swimages/vRouterVNF_ControlPlane.qcow2",
-                            "properties": {
-                                "operating_system": {
-                                    "type_name": "string",
-                                    "value": "linux"
-                                },
-                                "sw_image": {
-                                    "type_name": "string",
-                                    "value": "/swimages/vRouterVNF_ControlPlane.qcow2"
-                                },
-                                "name": {
-                                    "type_name": "string",
-                                    "value": "vNatVNFImage"
-                                },
-                                "checksum": {
-                                    "type_name": "string",
-                                    "value": "5000"
-                                },
-                                "min_ram": {
-                                    "type_name": "scalar-unit.size",
-                                    "value": {
-                                        "value": 1000000000,
-                                        "factor": 1,
-                                        "unit": "GB",
-                                        "unit_size": 1000000000
-                                    }
-                                },
-                                "disk_format": {
-                                    "type_name": "string",
-                                    "value": "qcow2"
-                                },
-                                "version": {
-                                    "type_name": "string",
-                                    "value": "1.0"
-                                },
-                                "container_format": {
-                                    "type_name": "string",
-                                    "value": "bare"
-                                },
-                                "min_disk": {
-                                    "type_name": "scalar-unit.size",
-                                    "value": {
-                                        "value": 10000000000,
-                                        "factor": 10,
-                                        "unit": "GB",
-                                        "unit_size": 1000000000
-                                    }
-                                },
-                                "supported_virtualisation_environments": {
-                                    "type_name": "list",
-                                    "value": [
-                                        "test_0"
-                                    ]
-                                },
-                                "size": {
-                                    "type_name": "scalar-unit.size",
-                                    "value": {
-                                        "value": 10000000000,
-                                        "factor": 10,
-                                        "unit": "GB",
-                                        "unit_size": 1000000000
-                                    }
-                                }
-                            }
-                        }
-                    ],
-                    "capabilities": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        },
-                        {
-                            "name": "os",
-                            "type_name": "tosca.capabilities.OperatingSystem",
-                            "properties": {
-                                "distribution": {
-                                    "type_name": "string",
-                                    "description": "The Operating System (OS) distribution. Examples of valid values for a \"type\" of \"Linux\" would include: debian, fedora, rhel and ubuntu."
-                                },
-                                "version": {
-                                    "type_name": "version",
-                                    "description": "The Operating System version."
-                                },
-                                "type": {
-                                    "type_name": "string",
-                                    "description": "The Operating System (OS) type. Examples of valid values include: linux, aix, mac, windows, etc."
-                                },
-                                "architecture": {
-                                    "type_name": "string",
-                                    "description": "The Operating System (OS) architecture. Examples of valid values include: x86_32, x86_64, etc."
-                                }
-                            }
-                        },
-                        {
-                            "name": "host",
-                            "type_name": "tosca.capabilities.Container",
-                            "properties": {
-                                "cpu_frequency": {
-                                    "type_name": "scalar-unit.frequency",
-                                    "description": "Specifies the operating frequency of CPU's core. This property expresses the expected frequency of one (1) CPU as provided by the property \"num_cpus\"."
-                                },
-                                "mem_size": {
-                                    "type_name": "scalar-unit.size",
-                                    "description": "Size of memory available to applications running on the Compute node (default unit is MB)."
-                                },
-                                "num_cpus": {
-                                    "type_name": "integer",
-                                    "description": "Number of (actual or virtual) CPUs associated with the Compute node."
-                                },
-                                "disk_size": {
-                                    "type_name": "scalar-unit.size",
-                                    "description": "Size of the local disk available to applications running on the Compute node (default unit is MB)."
-                                }
-                            }
-                        },
-                        {
-                            "name": "binding",
-                            "type_name": "tosca.capabilities.network.Bindable"
-                        },
-                        {
-                            "name": "scalable",
-                            "type_name": "tosca.capabilities.Scalable",
-                            "properties": {
-                                "min_instances": {
-                                    "type_name": "integer",
-                                    "value": 1,
-                                    "description": "This property is used to indicate the minimum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
-                                },
-                                "default_instances": {
-                                    "type_name": "integer",
-                                    "description": "An optional property that indicates the requested default number of instances that should be the starting number of instances a TOSCA orchestrator should attempt to allocate. Note: The value for this property MUST be in the range between the values set for \"min_instances\" and \"max_instances\" properties."
-                                },
-                                "max_instances": {
-                                    "type_name": "integer",
-                                    "value": 1,
-                                    "description": "This property is used to indicate the maximum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
-                                }
-                            }
-                        },
-                        {
-                            "name": "virtual_compute",
-                            "type_name": "tosca.capabilities.nfv.VirtualCompute",
-                            "properties": {
-                                "requested_additional_capabilities": {
-                                    "type_name": "map",
-                                    "value": {
-                                        "ovs_dpdk": {
-                                            "requested_additional_capability_name": "ovs_dpdk",
-                                            "min_requested_additional_capability_version": "1.0",
-                                            "support_mandatory": True,
-                                            "target_performance_parameters": {
-                                                "sw:ovs_dpdk": "true"
-                                            },
-                                            "preferred_requested_additional_capability_version": "1.0"
-                                        },
-                                        "hyper_threading": {
-                                            "requested_additional_capability_name": "hyper_threading",
-                                            "min_requested_additional_capability_version": "1.0",
-                                            "support_mandatory": True,
-                                            "target_performance_parameters": {
-                                                "hw:cpu_cores": "2",
-                                                "hw:cpu_threads": "2",
-                                                "hw:cpu_threads_policy": "isolate",
-                                                "hw:cpu_sockets": "2"
-                                            },
-                                            "preferred_requested_additional_capability_version": "1.0"
-                                        },
-                                        "numa": {
-                                            "requested_additional_capability_name": "numa",
-                                            "min_requested_additional_capability_version": "1.0",
-                                            "support_mandatory": True,
-                                            "target_performance_parameters": {
-                                                "hw:numa_cpus.0": "0,1",
-                                                "hw:numa_cpus.1": "2,3,4,5",
-                                                "hw:numa_nodes": "2",
-                                                "hw:numa_mem.1": "3072",
-                                                "hw:numa_mem.0": "1024"
-                                            },
-                                            "preferred_requested_additional_capability_version": "1.0"
-                                        }
-                                    }
-                                },
-                                "virtual_cpu": {
-                                    "type_name": "tosca.datatypes.nfv.VirtualCpu",
-                                    "value": {
-                                        "num_virtual_cpu": 2,
-                                        "virtual_cpu_clock": {
-                                            "value": 2400000000,
-                                            "factor": 2.4,
-                                            "unit": "GHz",
-                                            "unit_size": 1000000000
-                                        },
-                                        "cpu_architecture": "X86",
-                                        "virtual_cpu_oversubscription_policy": "test",
-                                        "virtual_cpu_pinning": {
-                                            "cpu_pinning_map": {
-                                                "cpu_pinning_0": "1"
-                                            },
-                                            "cpu_pinning_policy": "static"
-                                        }
-                                    }
-                                },
-                                "virtual_memory": {
-                                    "type_name": "tosca.datatypes.nfv.VirtualMemory",
-                                    "value": {
-                                        "virtual_mem_oversubscription_policy": "mem_policy_test",
-                                        "numa_enabled": True,
-                                        "virtual_mem_size": {
-                                            "value": 10000000000,
-                                            "factor": 10,
-                                            "unit": "GB",
-                                            "unit_size": 1000000000
-                                        }
-                                    }
-                                }
-                            }
-                        },
-                        {
-                            "name": "virtual_binding",
-                            "type_name": "tosca.capabilities.nfv.VirtualBindable"
-                        }
-                    ],
-                    "relationships": [
-                        {
-                            "name": "virtual_storage",
-                            "source_requirement_index": 0,
-                            "target_node_id": "vNAT_Storage_6wdgwzedlb6sq18uzrr41sof7",
-                            "properties": {
-                                "location": {
-                                    "type_name": "string",
-                                    "value": "/mnt/volume_0",
-                                    "description": "The relative location (e.g., path on the file system), which provides the root location to address an attached node. e.g., a mount point / path such as '/usr/data'. Note: The user must provide it and it cannot be \"root\"."
-                                }
-                            },
-                            "source_interfaces": [
-                                {
-                                    "name": "Configure",
-                                    "description": "The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support.",
-                                    "type_name": "tosca.interfaces.relationship.Configure",
-                                    "operations": [
-                                        {
-                                            "name": "add_source",
-                                            "description": "Operation to notify the target node of a source node which is now available via a relationship."
-                                        },
-                                        {
-                                            "name": "pre_configure_target",
-                                            "description": "Operation to pre-configure the target endpoint."
-                                        },
-                                        {
-                                            "name": "post_configure_source",
-                                            "description": "Operation to post-configure the source endpoint."
-                                        },
-                                        {
-                                            "name": "target_changed",
-                                            "description": "Operation to notify source some property or attribute of the target changed"
-                                        },
-                                        {
-                                            "name": "pre_configure_source",
-                                            "description": "Operation to pre-configure the source endpoint."
-                                        },
-                                        {
-                                            "name": "post_configure_target",
-                                            "description": "Operation to post-configure the target endpoint."
-                                        },
-                                        {
-                                            "name": "remove_target",
-                                            "description": "Operation to remove a target node."
-                                        },
-                                        {
-                                            "name": "add_target",
-                                            "description": "Operation to notify the source node of a target node being added via a relationship."
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                },
-                {
-                    "id": "SRIOV_Port_leu1j6rfdt4c8vta6aec1xe39",
-                    "type_name": "tosca.nodes.nfv.VduCpd",
-                    "template_name": "SRIOV_Port",
-                    "properties": {
-                        "address_data": {
-                            "type_name": "list",
-                            "value": [
-                                {
-                                    "address_type": "ip_address",
-                                    "l3_address_data": {
-                                        "ip_address_type": "ipv4",
-                                        "floating_ip_activated": False,
-                                        "number_of_ip_address": 1,
-                                        "ip_address_assignment": True
-                                    }
-                                }
-                            ]
-                        },
-                        "description": {
-                            "type_name": "string",
-                            "value": "sriov port"
-                        },
-                        "layer_protocol": {
-                            "type_name": "string",
-                            "value": "ipv4"
-                        },
-                        "virtual_network_interface_requirements": {
-                            "type_name": "list",
-                            "value": [
-                                {
-                                    "requirement": {
-                                        "SRIOV": "true"
-                                    },
-                                    "support_mandatory": False,
-                                    "name": "sriov",
-                                    "description": "sriov"
-                                },
-                                {
-                                    "requirement": {
-                                        "SRIOV": "false"
-                                    },
-                                    "support_mandatory": False,
-                                    "name": "normal",
-                                    "description": "normal"
-                                }
-                            ]
-                        },
-                        "role": {
-                            "type_name": "string",
-                            "value": "root"
-                        },
-                        "bitrate_requirement": {
-                            "type_name": "integer",
-                            "value": 10
-                        }
-                    },
-                    "interfaces": [
-                        {
-                            "name": "Standard",
-                            "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
-                            "type_name": "tosca.interfaces.node.lifecycle.Standard",
-                            "operations": [
-                                {
-                                    "name": "create",
-                                    "description": "Standard lifecycle create operation."
-                                },
-                                {
-                                    "name": "stop",
-                                    "description": "Standard lifecycle stop operation."
-                                },
-                                {
-                                    "name": "start",
-                                    "description": "Standard lifecycle start operation."
-                                },
-                                {
-                                    "name": "delete",
-                                    "description": "Standard lifecycle delete operation."
-                                },
-                                {
-                                    "name": "configure",
-                                    "description": "Standard lifecycle configure operation."
-                                }
-                            ]
-                        }
-                    ],
-                    "capabilities": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        }
-                    ],
-                    "relationships": [
-                        {
-                            "name": "virtual_binding",
-                            "source_requirement_index": 0,
-                            "target_node_id": "vdu_vNat_7ozwkcr86sa87fmd2nue2ww07",
-                            "source_interfaces": [
-                                {
-                                    "name": "Configure",
-                                    "description": "The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support.",
-                                    "type_name": "tosca.interfaces.relationship.Configure",
-                                    "operations": [
-                                        {
-                                            "name": "add_source",
-                                            "description": "Operation to notify the target node of a source node which is now available via a relationship."
-                                        },
-                                        {
-                                            "name": "pre_configure_target",
-                                            "description": "Operation to pre-configure the target endpoint."
-                                        },
-                                        {
-                                            "name": "post_configure_source",
-                                            "description": "Operation to post-configure the source endpoint."
-                                        },
-                                        {
-                                            "name": "target_changed",
-                                            "description": "Operation to notify source some property or attribute of the target changed"
-                                        },
-                                        {
-                                            "name": "pre_configure_source",
-                                            "description": "Operation to pre-configure the source endpoint."
-                                        },
-                                        {
-                                            "name": "post_configure_target",
-                                            "description": "Operation to post-configure the target endpoint."
-                                        },
-                                        {
-                                            "name": "remove_target",
-                                            "description": "Operation to remove a target node."
-                                        },
-                                        {
-                                            "name": "add_target",
-                                            "description": "Operation to notify the source node of a target node being added via a relationship."
-                                        }
-                                    ]
-                                }
-                            ]
-                        },
-                        {
-                            "name": "virtual_link",
-                            "source_requirement_index": 1,
-                            "target_node_id": "sriov_link_2610d7gund4e645wo39dvp238",
-                            "target_capability_name": "feature",
-                            "source_interfaces": [
-                                {
-                                    "name": "Configure",
-                                    "description": "The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support.",
-                                    "type_name": "tosca.interfaces.relationship.Configure",
-                                    "operations": [
-                                        {
-                                            "name": "add_source",
-                                            "description": "Operation to notify the target node of a source node which is now available via a relationship."
-                                        },
-                                        {
-                                            "name": "pre_configure_target",
-                                            "description": "Operation to pre-configure the target endpoint."
-                                        },
-                                        {
-                                            "name": "post_configure_source",
-                                            "description": "Operation to post-configure the source endpoint."
-                                        },
-                                        {
-                                            "name": "target_changed",
-                                            "description": "Operation to notify source some property or attribute of the target changed"
-                                        },
-                                        {
-                                            "name": "pre_configure_source",
-                                            "description": "Operation to pre-configure the source endpoint."
-                                        },
-                                        {
-                                            "name": "post_configure_target",
-                                            "description": "Operation to post-configure the target endpoint."
-                                        },
-                                        {
-                                            "name": "remove_target",
-                                            "description": "Operation to remove a target node."
-                                        },
-                                        {
-                                            "name": "add_target",
-                                            "description": "Operation to notify the source node of a target node being added via a relationship."
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                }
-            ],
-            "substitution": {
-                "node_type_name": "tosca.nodes.nfv.VNF.vOpenNAT",
-                "requirements": [
-                    {
-                        "mapped_name": "sriov_plane",
-                        "node_id": "SRIOV_Port_leu1j6rfdt4c8vta6aec1xe39",
-                        "name": "virtual_link"
-                    }
-                ]
-            }
-        },
-        "model": {
-            "metadata": {
-                "vnfSoftwareVersion": "1.0.0",
-                "vnfProductName": "openNAT",
-                "localizationLanguage": [
-                    "english",
-                    "chinese"
-                ],
-                "vnfProvider": "intel",
-                "vnfmInfo": "GVNFM",
-                "defaultLocalizationLanguage": "english",
-                "vnfdId": "openNAT-1.0",
-                "vnfProductInfoDescription": "openNAT",
-                "vnfdVersion": "1.0.0",
-                "vnfProductInfoName": "openNAT"
-            },
-            "node_templates": [
-                {
-                    "name": "vNAT_Storage",
-                    "type_name": "tosca.nodes.nfv.VDU.VirtualStorage",
-                    "default_instances": 1,
-                    "min_instances": 0,
-                    "properties": {
-                        "size_of_storage": {
-                            "type_name": "scalar-unit.size",
-                            "value": {
-                                "value": 10000000000,
-                                "factor": 10,
-                                "unit": "GB",
-                                "unit_size": 1000000000
-                            }
-                        },
-                        "type_of_storage": {
-                            "type_name": "string",
-                            "value": "volume"
-                        },
-                        "rdma_enabled": {
-                            "type_name": "boolean",
-                            "value": False
-                        }
-                    },
-                    "interface_templates": [
-                        ""
-                    ],
-                    "capability_templates": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        },
-                        {
-                            "name": "virtual_storage",
-                            "type_name": "tosca.capabilities.nfv.VirtualStorage"
-                        }
-                    ]
-                },
-                {
-                    "name": "vdu_vNat",
-                    "type_name": "tosca.nodes.nfv.VDU.Compute",
-                    "default_instances": 1,
-                    "min_instances": 0,
-                    "properties": {
-                        "configurable_properties": {
-                            "type_name": "map",
-                            "value": {
-                                "test": {
-                                    "additional_vnfc_configurable_properties": {
-                                        "aaa": "1",
-                                        "bbb": "2",
-                                        "ccc": "3"
-                                    }
-                                }
-                            }
-                        },
-                        "boot_order": {
-                            "type_name": "list",
-                            "value": [
-                                "vNAT_Storage"
-                            ]
-                        },
-                        "name": {
-                            "type_name": "string",
-                            "value": "vNat"
-                        },
-                        "nfvi_constraints": {
-                            "type_name": "list",
-                            "value": [
-                                "test"
-                            ]
-                        },
-                        "description": {
-                            "type_name": "string",
-                            "value": "the virtual machine of vNat"
-                        }
-                    },
-                    "interface_templates": [
-                        ""
-                    ],
-                    "artifact_templates": [
-                        ""
-                    ],
-                    "capability_templates": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        },
-                        {
-                            "name": "os",
-                            "type_name": "tosca.capabilities.OperatingSystem",
-                            "properties": {
-                                "distribution": {
-                                    "type_name": "string",
-                                    "description": "The Operating System (OS) distribution. Examples of valid values for a \"type\" of \"Linux\" would include: debian, fedora, rhel and ubuntu."
-                                },
-                                "version": {
-                                    "type_name": "version",
-                                    "description": "The Operating System version."
-                                },
-                                "type": {
-                                    "type_name": "string",
-                                    "description": "The Operating System (OS) type. Examples of valid values include: linux, aix, mac, windows, etc."
-                                },
-                                "architecture": {
-                                    "type_name": "string",
-                                    "description": "The Operating System (OS) architecture. Examples of valid values include: x86_32, x86_64, etc."
-                                }
-                            }
-                        },
-                        {
-                            "name": "host",
-                            "type_name": "tosca.capabilities.Container",
-                            "valid_source_node_type_names": [
-                                "tosca.nodes.SoftwareComponent"
-                            ],
-                            "properties": {
-                                "cpu_frequency": {
-                                    "type_name": "scalar-unit.frequency",
-                                    "description": "Specifies the operating frequency of CPU's core. This property expresses the expected frequency of one (1) CPU as provided by the property \"num_cpus\"."
-                                },
-                                "mem_size": {
-                                    "type_name": "scalar-unit.size",
-                                    "description": "Size of memory available to applications running on the Compute node (default unit is MB)."
-                                },
-                                "num_cpus": {
-                                    "type_name": "integer",
-                                    "description": "Number of (actual or virtual) CPUs associated with the Compute node."
-                                },
-                                "disk_size": {
-                                    "type_name": "scalar-unit.size",
-                                    "description": "Size of the local disk available to applications running on the Compute node (default unit is MB)."
-                                }
-                            }
-                        },
-                        {
-                            "name": "binding",
-                            "type_name": "tosca.capabilities.network.Bindable"
-                        },
-                        {
-                            "name": "scalable",
-                            "type_name": "tosca.capabilities.Scalable",
-                            "properties": {
-                                "min_instances": {
-                                    "type_name": "integer",
-                                    "value": 1,
-                                    "description": "This property is used to indicate the minimum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
-                                },
-                                "default_instances": {
-                                    "type_name": "integer",
-                                    "description": "An optional property that indicates the requested default number of instances that should be the starting number of instances a TOSCA orchestrator should attempt to allocate. Note: The value for this property MUST be in the range between the values set for \"min_instances\" and \"max_instances\" properties."
-                                },
-                                "max_instances": {
-                                    "type_name": "integer",
-                                    "value": 1,
-                                    "description": "This property is used to indicate the maximum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
-                                }
-                            }
-                        },
-                        {
-                            "name": "virtual_compute",
-                            "type_name": "tosca.capabilities.nfv.VirtualCompute",
-                            "properties": {
-                                "requested_additional_capabilities": {
-                                    "type_name": "map",
-                                    "value": {
-                                        "ovs_dpdk": {
-                                            "requested_additional_capability_name": "ovs_dpdk",
-                                            "min_requested_additional_capability_version": "1.0",
-                                            "support_mandatory": True,
-                                            "target_performance_parameters": {
-                                                "sw:ovs_dpdk": "true"
-                                            },
-                                            "preferred_requested_additional_capability_version": "1.0"
-                                        },
-                                        "hyper_threading": {
-                                            "requested_additional_capability_name": "hyper_threading",
-                                            "min_requested_additional_capability_version": "1.0",
-                                            "support_mandatory": True,
-                                            "target_performance_parameters": {
-                                                "hw:cpu_cores": "2",
-                                                "hw:cpu_threads": "2",
-                                                "hw:cpu_threads_policy": "isolate",
-                                                "hw:cpu_sockets": "2"
-                                            },
-                                            "preferred_requested_additional_capability_version": "1.0"
-                                        },
-                                        "numa": {
-                                            "requested_additional_capability_name": "numa",
-                                            "min_requested_additional_capability_version": "1.0",
-                                            "support_mandatory": True,
-                                            "target_performance_parameters": {
-                                                "hw:numa_cpus.0": "0,1",
-                                                "hw:numa_cpus.1": "2,3,4,5",
-                                                "hw:numa_nodes": "2",
-                                                "hw:numa_mem.1": "3072",
-                                                "hw:numa_mem.0": "1024"
-                                            },
-                                            "preferred_requested_additional_capability_version": "1.0"
-                                        }
-                                    }
-                                },
-                                "virtual_cpu": {
-                                    "type_name": "tosca.datatypes.nfv.VirtualCpu",
-                                    "value": {
-                                        "num_virtual_cpu": 2,
-                                        "virtual_cpu_clock": {
-                                            "value": 2400000000,
-                                            "factor": 2.4,
-                                            "unit": "GHz",
-                                            "unit_size": 1000000000
-                                        },
-                                        "cpu_architecture": "X86",
-                                        "virtual_cpu_oversubscription_policy": "test",
-                                        "virtual_cpu_pinning": {
-                                            "cpu_pinning_map": {
-                                                "cpu_pinning_0": "1"
-                                            },
-                                            "cpu_pinning_policy": "static"
-                                        }
-                                    }
-                                },
-                                "virtual_memory": {
-                                    "type_name": "tosca.datatypes.nfv.VirtualMemory",
-                                    "value": {
-                                        "virtual_mem_oversubscription_policy": "mem_policy_test",
-                                        "numa_enabled": True,
-                                        "virtual_mem_size": {
-                                            "value": 10000000000,
-                                            "factor": 10,
-                                            "unit": "GB",
-                                            "unit_size": 1000000000
-                                        }
-                                    }
-                                }
-                            }
-                        },
-                        {
-                            "name": "virtual_binding",
-                            "type_name": "tosca.capabilities.nfv.VirtualBindable"
-                        }
-                    ],
-                    "requirement_templates": [
-                        {
-                            "name": "virtual_storage",
-                            "target_node_template_name": "vNAT_Storage",
-                            "relationship_template": {
-                                "type_name": "tosca.relationships.nfv.VDU.AttachedTo",
-                                "properties": {
-                                    "location": {
-                                        "type_name": "string",
-                                        "value": "/mnt/volume_0",
-                                        "description": "The relative location (e.g., path on the file system), which provides the root location to address an attached node. e.g., a mount point / path such as '/usr/data'. Note: The user must provide it and it cannot be \"root\"."
-                                    }
-                                },
-                                "source_interface_templates": [
-                                    ""
-                                ]
-                            }
-                        }
-                    ]
-                },
-                {
-                    "name": "SRIOV_Port",
-                    "type_name": "tosca.nodes.nfv.VduCpd",
-                    "default_instances": 1,
-                    "min_instances": 0,
-                    "properties": {
-                        "address_data": {
-                            "type_name": "list",
-                            "value": [
-                                {
-                                    "address_type": "ip_address",
-                                    "l3_address_data": {
-                                        "ip_address_type": "ipv4",
-                                        "floating_ip_activated": False,
-                                        "number_of_ip_address": 1,
-                                        "ip_address_assignment": True
-                                    }
-                                }
-                            ]
-                        },
-                        "description": {
-                            "type_name": "string",
-                            "value": "sriov port"
-                        },
-                        "layer_protocol": {
-                            "type_name": "string",
-                            "value": "ipv4"
-                        },
-                        "virtual_network_interface_requirements": {
-                            "type_name": "list",
-                            "value": [
-                                {
-                                    "requirement": {
-                                        "SRIOV": "true"
-                                    },
-                                    "support_mandatory": False,
-                                    "name": "sriov",
-                                    "description": "sriov"
-                                },
-                                {
-                                    "requirement": {
-                                        "SRIOV": "false"
-                                    },
-                                    "support_mandatory": False,
-                                    "name": "normal",
-                                    "description": "normal"
-                                }
-                            ]
-                        },
-                        "role": {
-                            "type_name": "string",
-                            "value": "root"
-                        },
-                        "bitrate_requirement": {
-                            "type_name": "integer",
-                            "value": 10
-                        }
-                    },
-                    "interface_templates": [
-                        ""
-                    ],
-                    "capability_templates": [
-                        {
-                            "name": "feature",
-                            "type_name": "tosca.capabilities.Node"
-                        }
-                    ],
-                    "requirement_templates": [
-                        {
-                            "name": "virtual_binding",
-                            "target_node_template_name": "vdu_vNat",
-                            "relationship_template": {
-                                "type_name": "tosca.relationships.nfv.VirtualBindsTo",
-                                "source_interface_templates": [
-                                    ""
-                                ]
-                            }
-                        },
-                        {
-                            "name": "virtual_link",
-                            "target_node_type_name": "tosca.nodes.nfv.VnfVirtualLinkDesc",
-                            "relationship_template": {
-                                "type_name": "tosca.relationships.nfv.VirtualLinksTo",
-                                "source_interface_templates": [
-                                    ""
-                                ]
-                            }
-                        }
-                    ]
-                }
-            ],
-            "substitution_template": {
-                "node_type_name": "tosca.nodes.nfv.VNF.vOpenNAT",
-                "requirement_templates": [
-                    {
-                        "mapped_name": "sriov_plane",
-                        "node_template_name": "SRIOV_Port",
-                        "name": "virtual_link"
-                    }
-                ]
-            }
-        }
-    })
-    print convert_vnfd_model(src_json)
index 0c79a81..67711bb 100644 (file)
@@ -14,6 +14,7 @@
 
 import os
 import sys
+import platform
 
 import redisco
 
@@ -48,6 +49,7 @@ INSTALLED_APPS = [
     'django.contrib.staticfiles',
     'rest_framework',
     'lcm.pub.database',
+    'lcm.swagger',
     'drf_yasg'
 ]
 
@@ -131,40 +133,42 @@ pub_config.CATALOG_ROOT_PATH = os.path.join(STATICFILES_DIRS[0], "catalog")
 pub_config.CATALOG_URL_PATH = "static/catalog"
 pub_config.AAI_BASE_URL = "http://%s:%s/aai/v11" % (pub_config.MSB_SERVICE_IP, pub_config.MSB_SERVICE_PORT)
 pub_config.SDC_BASE_URL = "http://%s:%s/api" % (pub_config.MSB_SERVICE_IP, pub_config.MSB_SERVICE_PORT)
-#
-# LOGGING = {
-#     'version': 1,
-#     'disable_existing_loggers': True,
-#     'formatters': {
-#         'standard': {
-#             'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
-#         },
-#     },
-#     'filters': {
-#     },
-#     'handlers': {
-#         'lcm_handler': {
-#             'level': 'DEBUG',
-#             'class': 'logging.handlers.RotatingFileHandler',
-#             'filename': os.path.join(BASE_DIR, 'logs/runtime_lcm.log'),
-#             'formatter': 'standard',
-#             'maxBytes': 1024 * 1024 * 50,
-#             'backupCount': 5,
-#         },
-#     },
-#
-#     'loggers': {
-#         'lcm': {
-#             'handlers': ['lcm_handler'],
-#             'level': 'DEBUG',
-#             'propagate': False
-#         },
-#     }
-# }
-LOGGING_CONFIG = None
-# yaml configuration of logging
-LOGGING_FILE = os.path.join(BASE_DIR, 'lcm/log.yml')
-log_config.yamlConfig(filepath=LOGGING_FILE, watchDog=True)
+
+if platform.system() == 'Windows' or 'test' in sys.argv:
+    LOGGING = {
+        'version': 1,
+        'disable_existing_loggers': True,
+        'formatters': {
+            'standard': {
+                'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
+            },
+        },
+        'filters': {
+        },
+        'handlers': {
+            'lcm_handler': {
+                'level': 'DEBUG',
+                'class': 'logging.handlers.RotatingFileHandler',
+                'filename': os.path.join(BASE_DIR, 'logs/runtime_lcm.log'),
+                'formatter': 'standard',
+                'maxBytes': 1024 * 1024 * 50,
+                'backupCount': 5,
+            },
+        },
+
+        'loggers': {
+            'lcm': {
+                'handlers': ['lcm_handler'],
+                'level': 'DEBUG',
+                'propagate': False
+            },
+        }
+    }
+else:
+    LOGGING_CONFIG = None
+    # yaml configuration of logging
+    LOGGING_FILE = os.path.join(BASE_DIR, 'lcm/log.yml')
+    log_config.yamlConfig(filepath=LOGGING_FILE, watchDog=True)
 
 if 'test' in sys.argv:
     pub_config.REG_TO_MSB_WHEN_START = False
@@ -175,7 +179,6 @@ if 'test' in sys.argv:
         'NAME': ':memory:',
     }
     REST_FRAMEWORK = {}
-    import platform
 
     if platform.system() == 'Linux':
         TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'
similarity index 94%
rename from lcm/packages/__init__.py
rename to lcm/swagger/management/__init__.py
index 5580cc3..342c2a8 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2016 ZTE Corporation.
+# Copyright 2018 ZTE Corporation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
similarity index 94%
rename from lcm/packages/tests/__init__.py
rename to lcm/swagger/management/commands/__init__.py
index 5580cc3..342c2a8 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2016 ZTE Corporation.
+# Copyright 2018 ZTE Corporation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/lcm/swagger/management/commands/export_swagger.py b/lcm/swagger/management/commands/export_swagger.py
new file mode 100644 (file)
index 0000000..6caa7aa
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright 2018 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.
+import json
+
+from django.core.management.base import BaseCommand
+from django.test import Client
+
+
+class Command(BaseCommand):
+    def add_arguments(self, parser):
+        parser.add_argument(
+            '-f',
+            '--name',
+            action='store',
+            dest='name',
+            default='swagger.json',
+            help='name of swagger file.',
+        )
+
+    def handle(self, *args, **options):
+        self.client = Client()
+        response = self.client.get("/api/nslcm/v1/swagger.json")
+        with open(options['name'], 'w') as swagger_file:
+            swagger_file.write(json.dumps(response.data))
+        print "swagger api is written to %s" % options['name']
index af5e7f6..729057f 100644 (file)
@@ -20,7 +20,6 @@ from lcm.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG
 
 urlpatterns = [
     url(r'^', include('lcm.samples.urls')),
-    url(r'^', include('lcm.packages.urls')),
     url(r'^', include('lcm.ns.vnfs.urls')),
     url(r'^', include('lcm.ns.vls.urls')),
     url(r'^', include('lcm.ns.sfcs.urls')),
diff --git a/static/catalog/empty.txt b/static/catalog/empty.txt
deleted file mode 100644 (file)
index e69de29..0000000