aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaopengzhang <zhang.maopeng1@zte.com.cn>2018-08-28 19:54:06 +0800
committermaopengzhang <zhang.maopeng1@zte.com.cn>2018-08-28 20:40:49 +0800
commited23714e412e6e0db51d5377a4217c15024a8bca (patch)
treed30f2520454ee78ba8a6e647da034cda92345e19
parent6045219449a0a8e1071276cfbadb64600655e022 (diff)
SOL003 API Align
SOL003 API ALign - adjust lcm code structure and merge v2 into ns Change-Id: I1ff345fd688ce706be5e8bc5abeb71eec8261fd9 Issue-ID: VFC-635 Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r--README.md21
-rw-r--r--lcm/ns/biz/__init__.py (renamed from lcm/v2/__init__.py)26
-rw-r--r--lcm/ns/biz/ns_create.py (renamed from lcm/ns/ns_create.py)0
-rw-r--r--lcm/ns/biz/ns_delete.py (renamed from lcm/ns/ns_delete.py)0
-rw-r--r--lcm/ns/biz/ns_get.py (renamed from lcm/ns/ns_get.py)0
-rw-r--r--lcm/ns/biz/ns_heal.py (renamed from lcm/ns/ns_heal.py)6
-rw-r--r--lcm/ns/biz/ns_instant.py (renamed from lcm/ns/ns_instant.py)12
-rw-r--r--lcm/ns/biz/ns_manual_scale.py (renamed from lcm/ns/ns_manual_scale.py)4
-rw-r--r--lcm/ns/biz/ns_terminate.py (renamed from lcm/ns/ns_terminate.py)0
-rw-r--r--lcm/ns/biz/scaleaspect.py (renamed from lcm/ns/scaleaspect.py)8
-rw-r--r--lcm/ns/serializers/__init__.py (renamed from lcm/ns/vls/__init__.py)26
-rw-r--r--lcm/ns/serializers/ns_serializers.py (renamed from lcm/ns/serializers.py)0
-rw-r--r--lcm/ns/tests/test_ns_create.py2
-rw-r--r--lcm/ns/tests/test_ns_heal.py15
-rw-r--r--lcm/ns/tests/test_ns_instant.py19
-rw-r--r--lcm/ns/tests/test_ns_manual_scale.py11
-rw-r--r--lcm/ns/tests/test_scaleaspect.py8
-rw-r--r--lcm/ns/tests/tests_ns_terminate.py8
-rw-r--r--lcm/ns/urls.py7
-rw-r--r--lcm/ns/views/__init__.py (renamed from lcm/ns/vnfs/__init__.py)26
-rw-r--r--lcm/ns/views/views.py (renamed from lcm/ns/views.py)34
-rw-r--r--lcm/ns_sfcs/__init__.py (renamed from lcm/ns/sfcs/__init__.py)0
-rw-r--r--lcm/ns_sfcs/biz/__init__.py13
-rw-r--r--lcm/ns_sfcs/biz/create_flowcla.py (renamed from lcm/ns/sfcs/create_flowcla.py)2
-rw-r--r--lcm/ns_sfcs/biz/create_port_chain.py (renamed from lcm/ns/sfcs/create_port_chain.py)0
-rw-r--r--lcm/ns_sfcs/biz/create_portpairgp.py (renamed from lcm/ns/sfcs/create_portpairgp.py)4
-rw-r--r--lcm/ns_sfcs/biz/create_sfc_worker.py (renamed from lcm/ns/sfcs/create_sfc_worker.py)9
-rw-r--r--lcm/ns_sfcs/biz/delete_sfcs.py (renamed from lcm/ns/sfcs/delete_sfcs.py)0
-rw-r--r--lcm/ns_sfcs/biz/get_sfcs.py (renamed from lcm/ns/sfcs/get_sfcs.py)0
-rw-r--r--lcm/ns_sfcs/biz/sfc_instance.py (renamed from lcm/ns/sfcs/sfc_instance.py)0
-rw-r--r--lcm/ns_sfcs/biz/utils.py (renamed from lcm/ns/sfcs/utils.py)0
-rw-r--r--lcm/ns_sfcs/serializers/__init__.py13
-rw-r--r--lcm/ns_sfcs/serializers/serializers.py (renamed from lcm/ns/sfcs/serializers.py)0
-rw-r--r--lcm/ns_sfcs/tests/__init__.py (renamed from lcm/ns/tests/vnfs/__init__.py)26
-rw-r--r--lcm/ns_sfcs/tests/test_create_flow_classifier.py (renamed from lcm/ns/tests/sfcs/test_create_flow_classifier.py)0
-rw-r--r--lcm/ns_sfcs/tests/test_create_port_chain.py (renamed from lcm/ns/tests/sfcs/test_create_port_chain.py)0
-rw-r--r--lcm/ns_sfcs/tests/test_create_port_pair_group.py (renamed from lcm/ns/tests/sfcs/test_create_port_pair_group.py)0
-rw-r--r--lcm/ns_sfcs/tests/test_data.py (renamed from lcm/ns/tests/sfcs/test_data.py)36
-rw-r--r--lcm/ns_sfcs/tests/test_sfc.py (renamed from lcm/ns/tests/sfcs/test_sfc.py)4
-rw-r--r--lcm/ns_sfcs/tests/test_sfc_instance.py (renamed from lcm/ns/tests/sfcs/test_sfc_instance.py)0
-rw-r--r--lcm/ns_sfcs/tests/test_sfcdetailview.py (renamed from lcm/ns/tests/sfcs/test_sfcdetailview.py)2
-rw-r--r--lcm/ns_sfcs/tests/tests.py (renamed from lcm/ns/tests/sfcs/tests.py)2
-rw-r--r--lcm/ns_sfcs/urls.py (renamed from lcm/ns/sfcs/urls.py)4
-rw-r--r--lcm/ns_sfcs/views/__init__.py13
-rw-r--r--lcm/ns_sfcs/views/detail_views.py (renamed from lcm/ns/sfcs/detail_views.py)10
-rw-r--r--lcm/ns_sfcs/views/views.py (renamed from lcm/ns/sfcs/views.py)26
-rw-r--r--lcm/ns_vls/__init__.py (renamed from lcm/ns/tests/sfcs/__init__.py)0
-rw-r--r--lcm/ns_vls/biz/__init__.py0
-rw-r--r--lcm/ns_vls/biz/create_vls.py (renamed from lcm/ns/vls/create_vls.py)2
-rw-r--r--lcm/ns_vls/biz/delete_vls.py (renamed from lcm/ns/vls/delete_vls.py)0
-rw-r--r--lcm/ns_vls/biz/get_vls.py (renamed from lcm/ns/vls/get_vls.py)0
-rw-r--r--lcm/ns_vls/serializers/__init__.py0
-rw-r--r--lcm/ns_vls/serializers/serializers.py (renamed from lcm/ns/vls/serializers.py)0
-rw-r--r--lcm/ns_vls/tests/__init__.py0
-rw-r--r--lcm/ns_vls/tests/tests.py (renamed from lcm/ns/tests/vls/tests.py)12
-rw-r--r--lcm/ns_vls/urls.py (renamed from lcm/ns/vls/urls.py)2
-rw-r--r--lcm/ns_vls/views/__init__.py0
-rw-r--r--lcm/ns_vls/views/views.py (renamed from lcm/ns/vls/views.py)18
-rw-r--r--lcm/ns_vnfs/__init__.py (renamed from lcm/ns/tests/vls/__init__.py)0
-rw-r--r--lcm/ns_vnfs/biz/__init__.py13
-rw-r--r--lcm/ns_vnfs/biz/create_vnfs.py (renamed from lcm/ns/vnfs/create_vnfs.py)12
-rw-r--r--lcm/ns_vnfs/biz/get_vnfs.py (renamed from lcm/ns/vnfs/get_vnfs.py)0
-rw-r--r--lcm/ns_vnfs/biz/grant_vnf.py (renamed from lcm/v2/grant_vnf.py)0
-rw-r--r--lcm/ns_vnfs/biz/grant_vnfs.py (renamed from lcm/ns/vnfs/grant_vnfs.py)0
-rw-r--r--lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py (renamed from lcm/v2/handle_vnflcmooc_notification.py)12
-rw-r--r--lcm/ns_vnfs/biz/heal_vnfs.py (renamed from lcm/ns/vnfs/heal_vnfs.py)10
-rw-r--r--lcm/ns_vnfs/biz/notify_lcm.py (renamed from lcm/ns/vnfs/notify_lcm.py)12
-rw-r--r--lcm/ns_vnfs/biz/place_vnfs.py (renamed from lcm/ns/vnfs/place_vnfs.py)0
-rw-r--r--lcm/ns_vnfs/biz/scale_vnfs.py (renamed from lcm/ns/vnfs/scale_vnfs.py)4
-rw-r--r--lcm/ns_vnfs/biz/terminate_nfs.py (renamed from lcm/ns/vnfs/terminate_nfs.py)17
-rw-r--r--lcm/ns_vnfs/biz/verify_vnfs.py (renamed from lcm/ns/vnfs/verify_vnfs.py)6
-rw-r--r--lcm/ns_vnfs/biz/verify_vnfs_config.json (renamed from lcm/ns/vnfs/verify_vnfs_config.json)0
-rw-r--r--lcm/ns_vnfs/biz/wait_job.py (renamed from lcm/ns/vnfs/wait_job.py)0
-rw-r--r--lcm/ns_vnfs/const.py (renamed from lcm/ns/vnfs/const.py)0
-rw-r--r--lcm/ns_vnfs/serializers/__init__.py13
-rw-r--r--lcm/ns_vnfs/serializers/grant_vnf_serializer.py (renamed from lcm/v2/serializers.py)0
-rw-r--r--lcm/ns_vnfs/serializers/serializers.py (renamed from lcm/ns/vnfs/serializers.py)0
-rw-r--r--lcm/ns_vnfs/tests/__init__.py13
-rw-r--r--lcm/ns_vnfs/tests/grant_vnf_test.py (renamed from lcm/v2/tests.py)6
-rw-r--r--lcm/ns_vnfs/tests/tests.py (renamed from lcm/ns/tests/vnfs/tests.py)12
-rw-r--r--lcm/ns_vnfs/tests/verify_test.py (renamed from lcm/ns/tests/vnfs/verify_test.py)0
-rw-r--r--lcm/ns_vnfs/urls.py (renamed from lcm/ns/vnfs/urls.py)16
-rw-r--r--lcm/ns_vnfs/views/__init__.py13
-rw-r--r--lcm/ns_vnfs/views/grant_vnf_views.py (renamed from lcm/v2/views.py)14
-rw-r--r--lcm/ns_vnfs/views/views.py (renamed from lcm/ns/vnfs/views.py)50
-rw-r--r--lcm/pub/utils/tests.py2
-rw-r--r--lcm/urls.py7
-rw-r--r--lcm/v2/urls.py24
88 files changed, 395 insertions, 292 deletions
diff --git a/README.md b/README.md
index 7b59118f..75e5e502 100644
--- a/README.md
+++ b/README.md
@@ -13,3 +13,24 @@
# limitations under the License.
# Micro service of network service life cycle management.
+
+1. Code structure guide
+ ./ nslcm project files
+ ./docker nslcm docker related scripts
+ ./logs nslcm log file
+ ./lcm NS life cycle management
+ ./ns NS life cycle API& logic
+ ./ API url and const
+ ./views API related NS views, each operation is a view
+ ./serializers API related request and response parametes.
+ Suggest related to sol003/sol005, each datatype is a file.
+ Common datatypes are put into the common file
+ ./biz NS LCM mangement busyness logic files
+ ./tests all the test case. At least each API should have a test case
+ ./ns_sfcs SFC of NS API & logic
+ ./ns_vls vl in NS API & logic
+ ./ns_vnfs vnf in NS API & logic, which is used to integrate with VNFM drivers.
+ ./jobs nslcm related job
+ ./pub common class, including database model, external micro service API, utils, and config parameters.
+ ./samples project micro service health check
+ ./swagger auto-generate nslcm swagger
diff --git a/lcm/v2/__init__.py b/lcm/ns/biz/__init__.py
index 342c2a8c..ca9a1945 100644
--- a/lcm/v2/__init__.py
+++ b/lcm/ns/biz/__init__.py
@@ -1,13 +1,13 @@
-# 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.
+# 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.
diff --git a/lcm/ns/ns_create.py b/lcm/ns/biz/ns_create.py
index 1f99f22b..1f99f22b 100644
--- a/lcm/ns/ns_create.py
+++ b/lcm/ns/biz/ns_create.py
diff --git a/lcm/ns/ns_delete.py b/lcm/ns/biz/ns_delete.py
index 2d251907..2d251907 100644
--- a/lcm/ns/ns_delete.py
+++ b/lcm/ns/biz/ns_delete.py
diff --git a/lcm/ns/ns_get.py b/lcm/ns/biz/ns_get.py
index 4193bfae..4193bfae 100644
--- a/lcm/ns/ns_get.py
+++ b/lcm/ns/biz/ns_get.py
diff --git a/lcm/ns/ns_heal.py b/lcm/ns/biz/ns_heal.py
index 3efa5884..e1356785 100644
--- a/lcm/ns/ns_heal.py
+++ b/lcm/ns/biz/ns_heal.py
@@ -11,18 +11,18 @@
# 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 datetime
import logging
import threading
-import traceback
-import datetime
import time
+import traceback
from lcm.ns.const import NS_INST_STATUS
from lcm.pub.database.models import JobModel, NSInstModel
-from lcm.ns.vnfs.heal_vnfs import NFHealService
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils.jobutil import JobUtil, JOB_MODEL_STATUS
from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.biz.heal_vnfs import NFHealService
JOB_ERROR = 255
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/ns_instant.py b/lcm/ns/biz/ns_instant.py
index 698e77e2..527a35ee 100644
--- a/lcm/ns/ns_instant.py
+++ b/lcm/ns/biz/ns_instant.py
@@ -79,7 +79,7 @@ class InstantNSService(object):
# start
params_vnf = []
plan_dict = json.JSONDecoder().decode(dst_plan)
- for vnf in ignore_case_get(plan_dict, "vnfs"):
+ for vnf in ignore_case_get(plan_dict, "ns_vnfs"):
vnfd_id = vnf['properties']['id']
vnfm_type = vnf['properties'].get("nf_type", "undefined")
vimid = self.get_vnf_vim_id(vim_id, location_constraints, vnfd_id)
@@ -202,11 +202,11 @@ class InstantNSService(object):
@staticmethod
def set_vl_vim_id(vim_id, location_constraints, plan_dict):
- if "vls" not in plan_dict:
+ if "ns_vls" not in plan_dict:
logger.debug("No vl is found in nsd.")
return
vl_vnf = {}
- for vnf in ignore_case_get(plan_dict, "vnfs"):
+ for vnf in ignore_case_get(plan_dict, "ns_vnfs"):
if "dependencies" in vnf:
for depend in vnf["dependencies"]:
vl_vnf[depend["vl_id"]] = vnf['properties']['id']
@@ -215,7 +215,7 @@ class InstantNSService(object):
if "vnfProfileId" in location:
vnfd_id = location["vnfProfileId"]
vnf_vim[vnfd_id] = location["locationConstraints"]["vimId"]
- for vl in plan_dict["vls"]:
+ for vl in plan_dict["ns_vls"]:
vnfdid = ignore_case_get(vl_vnf, vl["vl_id"])
vimid = ignore_case_get(vnf_vim, vnfdid)
if not vimid:
@@ -229,7 +229,7 @@ class InstantNSService(object):
@staticmethod
def get_model_count(context):
data = json.JSONDecoder().decode(context)
- vls = len(data.get('vls', []))
+ vls = len(data.get('ns_vls', []))
sfcs = len(data.get('fps', []))
- vnfs = len(data.get('vnfs', []))
+ vnfs = len(data.get('ns_vnfs', []))
return {'vlCount': str(vls), 'sfcCount': str(sfcs), 'vnfCount': str(vnfs)}
diff --git a/lcm/ns/ns_manual_scale.py b/lcm/ns/biz/ns_manual_scale.py
index 5bcee526..e7121461 100644
--- a/lcm/ns/ns_manual_scale.py
+++ b/lcm/ns/biz/ns_manual_scale.py
@@ -17,13 +17,13 @@ import threading
import time
import traceback
+from lcm.ns.biz.scaleaspect import get_scale_vnf_data_info_list
from lcm.ns.const import NS_INST_STATUS
-from lcm.ns.vnfs.scale_vnfs import NFManualScaleService
from lcm.pub.database.models import JobModel, NSInstModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils.jobutil import JobUtil, JOB_MODEL_STATUS
from lcm.pub.utils.values import ignore_case_get
-from lcm.ns.scaleaspect import get_scale_vnf_data_info_list
+from lcm.ns_vnfs.biz.scale_vnfs import NFManualScaleService
JOB_ERROR = 255
SCALE_TYPE = ("SCALE_NS", "SCALE_VNF")
diff --git a/lcm/ns/ns_terminate.py b/lcm/ns/biz/ns_terminate.py
index 5b93f58d..5b93f58d 100644
--- a/lcm/ns/ns_terminate.py
+++ b/lcm/ns/biz/ns_terminate.py
diff --git a/lcm/ns/scaleaspect.py b/lcm/ns/biz/scaleaspect.py
index c70d5fd7..0d6a0338 100644
--- a/lcm/ns/scaleaspect.py
+++ b/lcm/ns/biz/scaleaspect.py
@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import copy
import json
import logging
import os
-import copy
-from lcm.pub.database.models import NfInstModel
+
from lcm.pub.database.models import NSInstModel
-from lcm.ns.vnfs.const import VNF_STATUS
+from lcm.pub.database.models import NfInstModel
from lcm.pub.utils.values import ignore_case_get
-
+from lcm.ns_vnfs.const import VNF_STATUS
logger = logging.getLogger(__name__)
SCALE_TYPE = ("SCALE_NS", "SCALE_VNF")
diff --git a/lcm/ns/vls/__init__.py b/lcm/ns/serializers/__init__.py
index 5580cc3d..ca9a1945 100644
--- a/lcm/ns/vls/__init__.py
+++ b/lcm/ns/serializers/__init__.py
@@ -1,13 +1,13 @@
-# 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.
+# 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.
diff --git a/lcm/ns/serializers.py b/lcm/ns/serializers/ns_serializers.py
index 91c19c40..91c19c40 100644
--- a/lcm/ns/serializers.py
+++ b/lcm/ns/serializers/ns_serializers.py
diff --git a/lcm/ns/tests/test_ns_create.py b/lcm/ns/tests/test_ns_create.py
index adddb47f..db14da3c 100644
--- a/lcm/ns/tests/test_ns_create.py
+++ b/lcm/ns/tests/test_ns_create.py
@@ -19,7 +19,7 @@ from django.test import TestCase, Client
from rest_framework import status
from rest_framework.test import APIClient
-from lcm.ns.ns_create import CreateNSService
+from lcm.ns.biz.ns_create import CreateNSService
from lcm.pub.database.models import NSInstModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils import restcall
diff --git a/lcm/ns/tests/test_ns_heal.py b/lcm/ns/tests/test_ns_heal.py
index de810503..72d51f96 100644
--- a/lcm/ns/tests/test_ns_heal.py
+++ b/lcm/ns/tests/test_ns_heal.py
@@ -12,18 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
import json
-from rest_framework import status
-from django.test import TestCase
+import mock
from django.test import Client
-from lcm.pub.database.models import NSInstModel, NfInstModel
-from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
+from django.test import TestCase
+from rest_framework import status
+
+from lcm.ns.biz.ns_heal import NSHealService
from lcm.ns.const import NS_INST_STATUS
+from lcm.pub.database.models import NSInstModel, NfInstModel
from lcm.pub.exceptions import NSLCMException
-from lcm.ns.ns_heal import NSHealService
-from lcm.ns.vnfs.heal_vnfs import NFHealService
+from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
+from lcm.ns_vnfs.biz.heal_vnfs import NFHealService
class TestHealNsViews(TestCase):
diff --git a/lcm/ns/tests/test_ns_instant.py b/lcm/ns/tests/test_ns_instant.py
index 7034b703..d5ced462 100644
--- a/lcm/ns/tests/test_ns_instant.py
+++ b/lcm/ns/tests/test_ns_instant.py
@@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from rest_framework import status
+import json
+
+import mock
from django.test import TestCase
+from rest_framework import status
from rest_framework.test import APIClient
-import mock
-import json
+from lcm.ns.biz.ns_instant import BuildInWorkflowThread
+from lcm.ns.biz.ns_instant import InstantNSService
from lcm.pub.database.models import NSInstModel
-from lcm.ns.ns_instant import InstantNSService
-from lcm.ns.ns_instant import BuildInWorkflowThread
from lcm.pub.utils import restcall
@@ -42,7 +43,7 @@ class TestNsInstant(TestCase):
}
self.nsd_model = json.dumps({
"model": json.dumps({
- "vnfs": [{
+ "ns_vnfs": [{
"vnf_id": "vnf1",
"properties": {
"id": "vnfd1",
@@ -52,14 +53,14 @@ class TestNsInstant(TestCase):
"vl_id": "5"
}]
}],
- "vls": [{
+ "ns_vls": [{
"vl_id": "5",
"properties": {}
}]
})
})
self.updated_nsd_model = {
- "vnfs": [{
+ "ns_vnfs": [{
"dependencies": [{
"vl_id": "5"
}],
@@ -69,7 +70,7 @@ class TestNsInstant(TestCase):
"id": "vnfd1"
}
}],
- "vls": [{
+ "ns_vls": [{
"vl_id": "5",
"properties": {
"location_info": {
diff --git a/lcm/ns/tests/test_ns_manual_scale.py b/lcm/ns/tests/test_ns_manual_scale.py
index aff180fd..4d32d98e 100644
--- a/lcm/ns/tests/test_ns_manual_scale.py
+++ b/lcm/ns/tests/test_ns_manual_scale.py
@@ -12,21 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import uuid
import os
+import uuid
+
import mock
from django.test import Client
from django.test import TestCase
+from lcm.ns.biz.scaleaspect import get_json_data
from rest_framework import status
+
+from lcm.ns.biz.ns_manual_scale import NSManualScaleService
from lcm.ns.const import NS_INST_STATUS
-from lcm.ns.ns_manual_scale import NSManualScaleService
from lcm.pub.database.models import NSInstModel, JobModel, NfInstModel
from lcm.pub.exceptions import NSLCMException
+from lcm.pub.msapi import catalog
from lcm.pub.utils import restcall
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE, JOB_MODEL_STATUS
-from lcm.pub.msapi import catalog
-from lcm.ns.scaleaspect import get_json_data
-
SCALING_JSON = {
"scale_options": [
diff --git a/lcm/ns/tests/test_scaleaspect.py b/lcm/ns/tests/test_scaleaspect.py
index 401d249b..a235c9d3 100644
--- a/lcm/ns/tests/test_scaleaspect.py
+++ b/lcm/ns/tests/test_scaleaspect.py
@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+
from django.test import TestCase
-from lcm.ns.scaleaspect import get_json_data
-from lcm.pub.database.models import NfInstModel
+
+from lcm.ns.biz.scaleaspect import get_json_data
from lcm.pub.database.models import NSInstModel
+from lcm.pub.database.models import NfInstModel
from lcm.pub.utils.timeutil import now_time
-import os
class TestScaleAspect(TestCase):
diff --git a/lcm/ns/tests/tests_ns_terminate.py b/lcm/ns/tests/tests_ns_terminate.py
index d7091882..774fd609 100644
--- a/lcm/ns/tests/tests_ns_terminate.py
+++ b/lcm/ns/tests/tests_ns_terminate.py
@@ -18,10 +18,10 @@ import mock
from django.test import TestCase, Client
from rest_framework import status
+from lcm.ns.biz.ns_terminate import TerminateNsService
from lcm.pub.database.models import NfInstModel, NSInstModel
from lcm.pub.utils import restcall
from lcm.pub.utils.jobutil import JOB_MODEL_STATUS
-from lcm.ns.ns_terminate import TerminateNsService
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
@@ -66,11 +66,11 @@ class TestTerminateNsViews(TestCase):
job_id = JobUtil.create_job("VNF", JOB_TYPE.TERMINATE_VNF, self.nf_inst_id)
mock_vals = {
- "/api/nslcm/v1/ns/vls/1":
+ "/api/nslcm/v1/ns/ns_vls/1":
[0, json.JSONEncoder().encode({"jobId": self.job_id}), '200'],
- "/api/nslcm/v1/ns/sfcs/1":
+ "/api/nslcm/v1/ns/ns_sfcs/1":
[0, json.JSONEncoder().encode({"jobId": self.job_id}), '200'],
- "/api/nslcm/v1/ns/vnfs/1":
+ "/api/nslcm/v1/ns/ns_vnfs/1":
[0, json.JSONEncoder().encode({}), '200'],
"/api/ztevnfmdriver/v1/jobs/" + self.job_id + "&responseId=0":
[0, json.JSONEncoder().encode({"jobid": self.job_id,
diff --git a/lcm/ns/urls.py b/lcm/ns/urls.py
index 6fa06587..eff23ac7 100644
--- a/lcm/ns/urls.py
+++ b/lcm/ns/urls.py
@@ -14,10 +14,12 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.ns.views import CreateNSView, NSInstView, TerminateNSView, NSDetailView, NSInstPostDealView, \
+from lcm.ns.views.views import CreateNSView, NSInstView, TerminateNSView, NSDetailView, NSInstPostDealView, \
NSManualScaleView, NSHealView
urlpatterns = [
+ # API will be deprecated in the future release
+
url(r'^api/nslcm/v1/ns$', CreateNSView.as_view()),
url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/instantiate$', NSInstView.as_view()),
url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/terminate$', TerminateNSView.as_view()),
@@ -25,6 +27,9 @@ urlpatterns = [
url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/postdeal$', NSInstPostDealView.as_view()),
url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/scale$', NSManualScaleView.as_view()),
url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/heal$', NSHealView.as_view())
+
+ # SOL005 URL API definition TODO
+
]
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/lcm/ns/vnfs/__init__.py b/lcm/ns/views/__init__.py
index 5580cc3d..ca9a1945 100644
--- a/lcm/ns/vnfs/__init__.py
+++ b/lcm/ns/views/__init__.py
@@ -1,13 +1,13 @@
-# 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.
+# 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.
diff --git a/lcm/ns/views.py b/lcm/ns/views/views.py
index 11790e14..f76aa2b8 100644
--- a/lcm/ns/views.py
+++ b/lcm/ns/views/views.py
@@ -15,31 +15,31 @@ import json
import logging
import traceback
+from drf_yasg.utils import swagger_auto_schema
+from lcm.ns.biz.ns_create import CreateNSService
+from lcm.ns.biz.ns_get import GetNSInfoService
+from lcm.ns.biz.ns_heal import NSHealService
+from lcm.ns.biz.ns_instant import InstantNSService
+from lcm.ns.biz.ns_manual_scale import NSManualScaleService
+from lcm.ns.biz.ns_terminate import TerminateNsService
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from drf_yasg.utils import swagger_auto_schema
-from lcm.ns.ns_create import CreateNSService
-from lcm.ns.ns_delete import DeleteNsService
-from lcm.ns.ns_get import GetNSInfoService
-from lcm.ns.ns_heal import NSHealService
-from lcm.ns.ns_instant import InstantNSService
-from lcm.ns.ns_manual_scale import NSManualScaleService
-from lcm.ns.ns_terminate import TerminateNsService
+from lcm.ns.biz.ns_delete import DeleteNsService
+from lcm.ns.serializers.ns_serializers import CreateNsReqSerializer, CreateNsRespSerializer
+from lcm.ns.serializers.ns_serializers import HealNsReqSerializer
+from lcm.ns.serializers.ns_serializers import InstNsPostDealReqSerializer
+from lcm.ns.serializers.ns_serializers import InstantNsReqSerializer
+from lcm.ns.serializers.ns_serializers import ManualScaleNsReqSerializer
+from lcm.ns.serializers.ns_serializers import NsOperateJobSerializer
+from lcm.ns.serializers.ns_serializers import QueryNsRespSerializer
+from lcm.ns.serializers.ns_serializers import TerminateNsReqSerializer
from lcm.pub.database.models import NSInstModel, ServiceBaseInfoModel
+from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
from lcm.pub.utils.restcall import req_by_msb
from lcm.pub.utils.values import ignore_case_get
-from lcm.ns.serializers import CreateNsReqSerializer, CreateNsRespSerializer
-from lcm.ns.serializers import QueryNsRespSerializer
-from lcm.ns.serializers import NsOperateJobSerializer
-from lcm.ns.serializers import InstantNsReqSerializer
-from lcm.ns.serializers import TerminateNsReqSerializer
-from lcm.ns.serializers import HealNsReqSerializer
-from lcm.ns.serializers import InstNsPostDealReqSerializer
-from lcm.ns.serializers import ManualScaleNsReqSerializer
-from lcm.pub.exceptions import NSLCMException
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/sfcs/__init__.py b/lcm/ns_sfcs/__init__.py
index 5580cc3d..5580cc3d 100644
--- a/lcm/ns/sfcs/__init__.py
+++ b/lcm/ns_sfcs/__init__.py
diff --git a/lcm/ns_sfcs/biz/__init__.py b/lcm/ns_sfcs/biz/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_sfcs/biz/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/ns/sfcs/create_flowcla.py b/lcm/ns_sfcs/biz/create_flowcla.py
index 214f2d99..a0e95646 100644
--- a/lcm/ns/sfcs/create_flowcla.py
+++ b/lcm/ns_sfcs/biz/create_flowcla.py
@@ -15,10 +15,10 @@
import logging
-from lcm.ns.sfcs.utils import get_fp_model_by_fp_inst_id
from lcm.pub.database.models import FPInstModel
from lcm.pub.msapi import extsys
from lcm.pub.msapi import sdncdriver
+from lcm.ns_sfcs.biz.utils import get_fp_model_by_fp_inst_id
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/sfcs/create_port_chain.py b/lcm/ns_sfcs/biz/create_port_chain.py
index 3ea502a1..3ea502a1 100644
--- a/lcm/ns/sfcs/create_port_chain.py
+++ b/lcm/ns_sfcs/biz/create_port_chain.py
diff --git a/lcm/ns/sfcs/create_portpairgp.py b/lcm/ns_sfcs/biz/create_portpairgp.py
index b42cd900..532deb62 100644
--- a/lcm/ns/sfcs/create_portpairgp.py
+++ b/lcm/ns_sfcs/biz/create_portpairgp.py
@@ -16,10 +16,10 @@
import json
import logging
-from lcm.ns.sfcs.utils import get_fp_model_by_fp_inst_id
from lcm.pub.database.models import FPInstModel, NfInstModel, CPInstModel, PortInstModel, VNFCInstModel
from lcm.pub.msapi import extsys
from lcm.pub.msapi import sdncdriver
+from lcm.ns_sfcs.biz.utils import get_fp_model_by_fp_inst_id
logger = logging.getLogger(__name__)
@@ -261,7 +261,7 @@ class CreatePortPairGroup(object):
return cp_model_info
def get_vnf_model_info_by_vnf_id(self, vnfid):
- for vnf_model_info in self.ns_model_data["vnfs"]:
+ for vnf_model_info in self.ns_model_data["ns_vnfs"]:
if (vnf_model_info["vnf_id"] == vnfid):
return vnf_model_info
diff --git a/lcm/ns/sfcs/create_sfc_worker.py b/lcm/ns_sfcs/biz/create_sfc_worker.py
index e0c65d61..04216eea 100644
--- a/lcm/ns/sfcs/create_sfc_worker.py
+++ b/lcm/ns_sfcs/biz/create_sfc_worker.py
@@ -17,12 +17,13 @@ import logging
import traceback
from threading import Thread
-from lcm.ns.sfcs.create_flowcla import CreateFlowClassifier
-from lcm.ns.sfcs.create_port_chain import CreatePortChain
-from lcm.ns.sfcs.create_portpairgp import CreatePortPairGroup
-from lcm.ns.sfcs.utils import update_fp_status
+from lcm.ns_sfcs.biz.create_flowcla import CreateFlowClassifier
+from lcm.ns_sfcs.biz.create_port_chain import CreatePortChain
+from lcm.ns_sfcs.biz.create_portpairgp import CreatePortPairGroup
+
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils.jobutil import JobUtil
+from lcm.ns_sfcs.biz.utils import update_fp_status
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/sfcs/delete_sfcs.py b/lcm/ns_sfcs/biz/delete_sfcs.py
index 23fed4c2..23fed4c2 100644
--- a/lcm/ns/sfcs/delete_sfcs.py
+++ b/lcm/ns_sfcs/biz/delete_sfcs.py
diff --git a/lcm/ns/sfcs/get_sfcs.py b/lcm/ns_sfcs/biz/get_sfcs.py
index 653f8f68..653f8f68 100644
--- a/lcm/ns/sfcs/get_sfcs.py
+++ b/lcm/ns_sfcs/biz/get_sfcs.py
diff --git a/lcm/ns/sfcs/sfc_instance.py b/lcm/ns_sfcs/biz/sfc_instance.py
index b63b13cb..b63b13cb 100644
--- a/lcm/ns/sfcs/sfc_instance.py
+++ b/lcm/ns_sfcs/biz/sfc_instance.py
diff --git a/lcm/ns/sfcs/utils.py b/lcm/ns_sfcs/biz/utils.py
index 61ccd0b0..61ccd0b0 100644
--- a/lcm/ns/sfcs/utils.py
+++ b/lcm/ns_sfcs/biz/utils.py
diff --git a/lcm/ns_sfcs/serializers/__init__.py b/lcm/ns_sfcs/serializers/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_sfcs/serializers/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/ns/sfcs/serializers.py b/lcm/ns_sfcs/serializers/serializers.py
index 1284f2f3..1284f2f3 100644
--- a/lcm/ns/sfcs/serializers.py
+++ b/lcm/ns_sfcs/serializers/serializers.py
diff --git a/lcm/ns/tests/vnfs/__init__.py b/lcm/ns_sfcs/tests/__init__.py
index 5580cc3d..05135e79 100644
--- a/lcm/ns/tests/vnfs/__init__.py
+++ b/lcm/ns_sfcs/tests/__init__.py
@@ -1,13 +1,13 @@
-# 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.
+# 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.
diff --git a/lcm/ns/tests/sfcs/test_create_flow_classifier.py b/lcm/ns_sfcs/tests/test_create_flow_classifier.py
index 1f69931d..1f69931d 100644
--- a/lcm/ns/tests/sfcs/test_create_flow_classifier.py
+++ b/lcm/ns_sfcs/tests/test_create_flow_classifier.py
diff --git a/lcm/ns/tests/sfcs/test_create_port_chain.py b/lcm/ns_sfcs/tests/test_create_port_chain.py
index 978d5f6a..978d5f6a 100644
--- a/lcm/ns/tests/sfcs/test_create_port_chain.py
+++ b/lcm/ns_sfcs/tests/test_create_port_chain.py
diff --git a/lcm/ns/tests/sfcs/test_create_port_pair_group.py b/lcm/ns_sfcs/tests/test_create_port_pair_group.py
index 490a9994..490a9994 100644
--- a/lcm/ns/tests/sfcs/test_create_port_pair_group.py
+++ b/lcm/ns_sfcs/tests/test_create_port_pair_group.py
diff --git a/lcm/ns/tests/sfcs/test_data.py b/lcm/ns_sfcs/tests/test_data.py
index 72f0b430..246b570a 100644
--- a/lcm/ns/tests/sfcs/test_data.py
+++ b/lcm/ns_sfcs/tests/test_data.py
@@ -26,7 +26,7 @@ nsd_model = {
"param2": "22",
},
- "vnfs": [
+ "ns_vnfs": [
{
"type": "tosca.nodes.nfv.ext.VNF.FireWall",
"vnf_id": "vnf_1",
@@ -129,7 +129,7 @@ nsd_model = {
}
],
- "vls": [
+ "ns_vls": [
{
"vl_id": "vldId1",
"description": "",
@@ -520,7 +520,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -571,7 +571,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -622,7 +622,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -673,7 +673,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -724,7 +724,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -775,7 +775,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -826,7 +826,7 @@ vnfd_model_dict1 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -905,7 +905,7 @@ vnfd_model_dict1 = {
'image_file_id': u'sss'
}
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -974,7 +974,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1025,7 +1025,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1076,7 +1076,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1127,7 +1127,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1178,7 +1178,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1229,7 +1229,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1280,7 +1280,7 @@ vnfd_model_dict2 = {
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
@@ -1359,7 +1359,7 @@ vnfd_model_dict2 = {
'image_file_id': u'sss'
}
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
diff --git a/lcm/ns/tests/sfcs/test_sfc.py b/lcm/ns_sfcs/tests/test_sfc.py
index 9eeff0dc..d4c35a58 100644
--- a/lcm/ns/tests/sfcs/test_sfc.py
+++ b/lcm/ns_sfcs/tests/test_sfc.py
@@ -110,7 +110,7 @@ class TestSfc(TestCase):
# 'fpinstid': str(uuid.uuid4()),
# "sdnControllerId": "sdnControllerId_1"
# }
- # resp = self.client.post("/api/nslcm/v1/ns/sfcs", data, format='json')
+ # resp = self.client.post("/api/nslcm/v1/ns/ns_sfcs", data, format='json')
# self.assertEqual(resp.status_code, status.HTTP_200_OK, resp.data)
def update_fp_inst_data(self):
@@ -1166,7 +1166,7 @@ nsd_model = {
"param2": "22",
},
- "vnfs": [
+ "ns_vnfs": [
{
"type": "tosca.nodes.nfv.ext.VNF.FireWall",
"vnf_id": "vnf_1",
diff --git a/lcm/ns/tests/sfcs/test_sfc_instance.py b/lcm/ns_sfcs/tests/test_sfc_instance.py
index f2e7d391..f2e7d391 100644
--- a/lcm/ns/tests/sfcs/test_sfc_instance.py
+++ b/lcm/ns_sfcs/tests/test_sfc_instance.py
diff --git a/lcm/ns/tests/sfcs/test_sfcdetailview.py b/lcm/ns_sfcs/tests/test_sfcdetailview.py
index 8059007c..72ae3ef3 100644
--- a/lcm/ns/tests/sfcs/test_sfcdetailview.py
+++ b/lcm/ns_sfcs/tests/test_sfcdetailview.py
@@ -65,7 +65,7 @@ class TestSfcDetailViews(TestCase):
def test_sfc_get_failed(self):
sfc_inst_id = "10"
- response = self.client.get("/api/nslcm/v1/ns/sfcs/%s" % sfc_inst_id)
+ response = self.client.get("/api/nslcm/v1/ns/ns_sfcs/%s" % sfc_inst_id)
self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code)
def test_sfc_get_success(self):
diff --git a/lcm/ns/tests/sfcs/tests.py b/lcm/ns_sfcs/tests/tests.py
index 8bf813c0..45720b60 100644
--- a/lcm/ns/tests/sfcs/tests.py
+++ b/lcm/ns_sfcs/tests/tests.py
@@ -101,5 +101,5 @@ class TestSfcDetailViews(TestCase):
'sfcName': "xxx"}
self.assertEqual(expect_resp_data, response.data)
- response = self.client.get("/api/nslcm/v1/ns/sfcs/%s" % "notExist")
+ response = self.client.get("/api/nslcm/v1/ns/ns_sfcs/%s" % "notExist")
self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code)
diff --git a/lcm/ns/sfcs/urls.py b/lcm/ns_sfcs/urls.py
index cfca2c30..827979bf 100644
--- a/lcm/ns/sfcs/urls.py
+++ b/lcm/ns_sfcs/urls.py
@@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf.urls import url
+from lcm.ns_sfcs.views.detail_views import SfcDetailView
from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.ns.sfcs.detail_views import SfcDetailView
-from lcm.ns.sfcs.views import SfcView, SfcInstanceView, PortPairGpView, FlowClaView, PortChainView
+from lcm.ns_sfcs.views.views import SfcView, SfcInstanceView, PortPairGpView, FlowClaView, PortChainView
urlpatterns = [
url(r'^api/nslcm/v1/ns/sfcs$', SfcView.as_view()),
diff --git a/lcm/ns_sfcs/views/__init__.py b/lcm/ns_sfcs/views/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_sfcs/views/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/ns/sfcs/detail_views.py b/lcm/ns_sfcs/views/detail_views.py
index 6d92f39d..e32831c0 100644
--- a/lcm/ns/sfcs/detail_views.py
+++ b/lcm/ns_sfcs/views/detail_views.py
@@ -13,15 +13,15 @@
# limitations under the License.
import logging
+from drf_yasg.utils import swagger_auto_schema
+from lcm.ns_sfcs.biz.get_sfcs import GetSfcs
+from lcm.ns_sfcs.serializers.serializers import DeleteSfcRespSerializer
+from lcm.ns_sfcs.serializers.serializers import GetSfcRespSerializer
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from drf_yasg.utils import swagger_auto_schema
-from lcm.ns.sfcs.delete_sfcs import DeleteSfcs
-from lcm.ns.sfcs.get_sfcs import GetSfcs
-from lcm.ns.sfcs.serializers import GetSfcRespSerializer
-from lcm.ns.sfcs.serializers import DeleteSfcRespSerializer
+from lcm.ns_sfcs.biz.delete_sfcs import DeleteSfcs
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/sfcs/views.py b/lcm/ns_sfcs/views/views.py
index 4403ffe6..67257001 100644
--- a/lcm/ns/sfcs/views.py
+++ b/lcm/ns_sfcs/views/views.py
@@ -15,26 +15,26 @@
import json
import logging
+import time
import traceback
import uuid
-import time
+from drf_yasg.utils import swagger_auto_schema
+from lcm.ns_sfcs.biz.create_flowcla import CreateFlowClassifier
+from lcm.ns_sfcs.biz.create_port_chain import CreatePortChain
+from lcm.ns_sfcs.biz.create_portpairgp import CreatePortPairGroup
+from lcm.ns_sfcs.biz.create_sfc_worker import CreateSfcWorker
+from lcm.ns_sfcs.serializers.serializers import CreateFlowClaSerializer
+from lcm.ns_sfcs.serializers.serializers import CreatePortChainSerializer
+from lcm.ns_sfcs.serializers.serializers import CreatePortPairGpSerializer
+from lcm.ns_sfcs.serializers.serializers import CreateSfcInstReqSerializer, CreateSfcInstRespSerializer
+from lcm.ns_sfcs.serializers.serializers import CreateSfcReqSerializer, CreateSfcRespSerializer
+from lcm.ns_sfcs.biz.sfc_instance import SfcInstance
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from drf_yasg.utils import swagger_auto_schema
-from lcm.ns.sfcs.create_flowcla import CreateFlowClassifier
-from lcm.ns.sfcs.create_port_chain import CreatePortChain
-from lcm.ns.sfcs.create_portpairgp import CreatePortPairGroup
-from lcm.ns.sfcs.create_sfc_worker import CreateSfcWorker
-from lcm.ns.sfcs.sfc_instance import SfcInstance
-from lcm.ns.sfcs.utils import get_fp_id, ignorcase_get
-from lcm.ns.sfcs.serializers import CreateSfcInstReqSerializer, CreateSfcInstRespSerializer
-from lcm.ns.sfcs.serializers import CreateSfcReqSerializer, CreateSfcRespSerializer
-from lcm.ns.sfcs.serializers import CreatePortPairGpSerializer
-from lcm.ns.sfcs.serializers import CreateFlowClaSerializer
-from lcm.ns.sfcs.serializers import CreatePortChainSerializer
+from lcm.ns_sfcs.biz.utils import get_fp_id, ignorcase_get
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/tests/sfcs/__init__.py b/lcm/ns_vls/__init__.py
index 5580cc3d..5580cc3d 100644
--- a/lcm/ns/tests/sfcs/__init__.py
+++ b/lcm/ns_vls/__init__.py
diff --git a/lcm/ns_vls/biz/__init__.py b/lcm/ns_vls/biz/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/ns_vls/biz/__init__.py
diff --git a/lcm/ns/vls/create_vls.py b/lcm/ns_vls/biz/create_vls.py
index 06ef78b4..f23ca4dd 100644
--- a/lcm/ns/vls/create_vls.py
+++ b/lcm/ns_vls/biz/create_vls.py
@@ -74,7 +74,7 @@ class CreateVls(object):
def get_data(self):
if isinstance(self.context, (unicode, str)):
self.context = json.JSONDecoder().decode(self.context)
- vl_info = self.get_vl_info(ignore_case_get(self.context, "vls"))
+ vl_info = self.get_vl_info(ignore_case_get(self.context, "ns_vls"))
self.vld_id = ignore_case_get(vl_info, "vl_id")
self.description = ignore_case_get(vl_info, "description")
self.vl_properties = ignore_case_get(vl_info, "properties")
diff --git a/lcm/ns/vls/delete_vls.py b/lcm/ns_vls/biz/delete_vls.py
index 1ae5e66c..1ae5e66c 100644
--- a/lcm/ns/vls/delete_vls.py
+++ b/lcm/ns_vls/biz/delete_vls.py
diff --git a/lcm/ns/vls/get_vls.py b/lcm/ns_vls/biz/get_vls.py
index 37692c5a..37692c5a 100644
--- a/lcm/ns/vls/get_vls.py
+++ b/lcm/ns_vls/biz/get_vls.py
diff --git a/lcm/ns_vls/serializers/__init__.py b/lcm/ns_vls/serializers/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/ns_vls/serializers/__init__.py
diff --git a/lcm/ns/vls/serializers.py b/lcm/ns_vls/serializers/serializers.py
index 70437ac2..70437ac2 100644
--- a/lcm/ns/vls/serializers.py
+++ b/lcm/ns_vls/serializers/serializers.py
diff --git a/lcm/ns_vls/tests/__init__.py b/lcm/ns_vls/tests/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/ns_vls/tests/__init__.py
diff --git a/lcm/ns/tests/vls/tests.py b/lcm/ns_vls/tests/tests.py
index 28910685..ef670a3d 100644
--- a/lcm/ns/tests/vls/tests.py
+++ b/lcm/ns_vls/tests/tests.py
@@ -19,10 +19,10 @@ import mock
from django.test import TestCase, Client
from rest_framework import status
-from lcm.ns.tests.vnfs.tests import vim_info
from lcm.pub.database.models import VLInstModel, NSInstModel, VNFFGInstModel
from lcm.pub.nfvi.vim import vimadaptor
from lcm.pub.utils import restcall
+from lcm.ns_vnfs.tests.tests import vim_info
class TestVlViews(TestCase):
@@ -39,8 +39,8 @@ class TestVlViews(TestCase):
"end_ip": "190.168.100.100", "gateway_ip": "190.168.100.1", "start_ip": "190.168.100.2",
"cidr": "190.168.100.0/24", "mtu": 1500, "network_name": "sub_mnet", "ip_version": 4}
self.context = {
- "vls": [{"vl_id": self.vl_id_1, "description": "", "properties": properties, "route_external": False},
- {"vl_id": self.vl_id_2, "description": "", "properties": properties, "route_external": False}],
+ "ns_vls": [{"vl_id": self.vl_id_1, "description": "", "properties": properties, "route_external": False},
+ {"vl_id": self.vl_id_2, "description": "", "properties": properties, "route_external": False}],
"vnffgs": [{"vnffg_id": self.vnffg_id, "description": "",
"properties": {"vendor": "zte", "version": "1.1.2", "number_of_endpoints": 7,
"dependent_virtual_link": [self.vl_id_2, self.vl_id_1],
@@ -87,7 +87,7 @@ class TestVlViews(TestCase):
"nsInstanceId": self.ns_inst_id,
"context": json.JSONEncoder().encode(self.context),
"vlIndex": vl_id}
- response = self.client.post("/api/nslcm/v1/ns/vls", data=req_data)
+ response = self.client.post("/api/nslcm/v1/ns/ns_vls", data=req_data)
self.assertEqual(status.HTTP_201_CREATED, response.status_code)
self.assertEqual(0, response.data["result"], response.data)
@@ -103,7 +103,7 @@ class TestVlViews(TestCase):
mock_uuid4.return_value = '999'
mock_req_by_rest.return_value = [0, json.JSONEncoder().encode(vim_info), '200']
mock_create_network.return_value = [1, (1)]
- response = self.client.post("/api/nslcm/v1/ns/vls", data=req_data)
+ response = self.client.post("/api/nslcm/v1/ns/ns_vls", data=req_data)
retinfo = {"detail": "vl instantiation failed, detail message: Send post vl request to vim failed."}
self.assertEqual(retinfo["detail"], response.data["detail"])
'''
@@ -153,5 +153,5 @@ class TestVlDetailViews(TestCase):
expect_resp_data = {'vlId': self.vl_inst_id, 'vlName': self.vl_name, 'vlStatus': "active"}
self.assertEqual(expect_resp_data, response.data)
- response = self.client.get("/api/nslcm/v1/ns/vls/%s" % "notExist")
+ response = self.client.get("/api/nslcm/v1/ns/ns_vls/%s" % "notExist")
self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code)
diff --git a/lcm/ns/vls/urls.py b/lcm/ns_vls/urls.py
index 597404d8..281ea148 100644
--- a/lcm/ns/vls/urls.py
+++ b/lcm/ns_vls/urls.py
@@ -15,7 +15,7 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.ns.vls.views import VlView, VlDetailView
+from lcm.ns_vls.views.views import VlView, VlDetailView
urlpatterns = [
url(r'^api/nslcm/v1/ns/vls$', VlView.as_view()),
diff --git a/lcm/ns_vls/views/__init__.py b/lcm/ns_vls/views/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/ns_vls/views/__init__.py
diff --git a/lcm/ns/vls/views.py b/lcm/ns_vls/views/views.py
index 33b6bb20..ce8c3338 100644
--- a/lcm/ns/vls/views.py
+++ b/lcm/ns_vls/views/views.py
@@ -12,19 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import logging
+
+from drf_yasg.utils import swagger_auto_schema
+from lcm.ns_vls.biz.delete_vls import DeleteVls
+from lcm.ns_vls.biz.get_vls import GetVls
+from lcm.ns_vls.serializers.serializers import CreateVlReqSerializer, CreateVlRespSerializer
+from lcm.ns_vls.serializers.serializers import DeleteVlRespSerializer
+from lcm.ns_vls.serializers.serializers import GetVlRespSerializer
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from drf_yasg.utils import swagger_auto_schema
-
-from lcm.ns.vls.create_vls import CreateVls
-from lcm.ns.vls.delete_vls import DeleteVls
-from lcm.ns.vls.get_vls import GetVls
-from lcm.ns.vls.serializers import CreateVlReqSerializer, CreateVlRespSerializer
-from lcm.ns.vls.serializers import GetVlRespSerializer
-from lcm.ns.vls.serializers import DeleteVlRespSerializer
-import logging
+from lcm.ns_vls.biz.create_vls import CreateVls
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/tests/vls/__init__.py b/lcm/ns_vnfs/__init__.py
index 5580cc3d..5580cc3d 100644
--- a/lcm/ns/tests/vls/__init__.py
+++ b/lcm/ns_vnfs/__init__.py
diff --git a/lcm/ns_vnfs/biz/__init__.py b/lcm/ns_vnfs/biz/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_vnfs/biz/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/ns/vnfs/create_vnfs.py b/lcm/ns_vnfs/biz/create_vnfs.py
index 631063fd..ac1847ec 100644
--- a/lcm/ns/vnfs/create_vnfs.py
+++ b/lcm/ns_vnfs/biz/create_vnfs.py
@@ -18,8 +18,6 @@ import uuid
from threading import Thread
from lcm.ns.const import OWNER_TYPE
-from lcm.ns.vnfs.const import VNF_STATUS, NFVO_VNF_INST_TIMEOUT_SECOND, INST_TYPE, INST_TYPE_NAME
-from lcm.ns.vnfs.wait_job import wait_job_finish
from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.database.models import NfInstModel, NSInstModel, VmInstModel, VNFFGInstModel, VLInstModel
from lcm.pub.exceptions import NSLCMException
@@ -32,6 +30,8 @@ from lcm.pub.utils.jobutil import JOB_MODEL_STATUS, JobUtil, JOB_TYPE
from lcm.pub.utils.share_lock import do_biz_with_share_lock
from lcm.pub.utils.timeutil import now_time
from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.const import VNF_STATUS, NFVO_VNF_INST_TIMEOUT_SECOND, INST_TYPE, INST_TYPE_NAME
+from lcm.ns_vnfs.biz.wait_job import wait_job_finish
logger = logging.getLogger(__name__)
@@ -109,14 +109,14 @@ class CreateVnfs(Thread):
def get_vnfd_id(self):
if self.vnfd_id:
logger.debug("need not get vnfd_id")
- self.nsd_model = {'vnfs': [], 'vls': [], 'vnffgs': []}
+ self.nsd_model = {'ns_vnfs': [], 'ns_vls': [], 'vnffgs': []}
self.vnf_inst_name = self.vnfd_id + str(uuid.uuid4())
self.vnf_inst_name = self.vnf_inst_name[:30]
return
ns_inst_info = NSInstModel.objects.get(id=self.ns_inst_id)
self.ns_inst_name = ns_inst_info.name
self.nsd_model = json.loads(ns_inst_info.nsd_model)
- for vnf_info in self.nsd_model['vnfs']:
+ for vnf_info in self.nsd_model['ns_vnfs']:
if self.vnf_id == vnf_info['vnf_id']:
self.vnfd_id = vnf_info['properties']['id']
if 'name' not in vnf_info['properties']:
@@ -138,7 +138,7 @@ class CreateVnfs(Thread):
def get_virtual_link_info(self, vnf_id):
virtual_link_list, ext_virtual_link = [], []
- for vnf_info in self.nsd_model['vnfs']:
+ for vnf_info in self.nsd_model['ns_vnfs']:
if vnf_info['vnf_id'] != vnf_id:
continue
for network_info in vnf_info['networks']:
@@ -172,7 +172,7 @@ class CreateVnfs(Thread):
return ""
def get_network_info_of_vl(self, vl_id):
- for vnf_info in self.nsd_model['vls']:
+ for vnf_info in self.nsd_model['ns_vls']:
if vnf_info['vl_id'] == vl_id:
return vnf_info['properties']['vl_profile']['networkName'], vnf_info['properties']['vl_profile']['initiationParameters']['name']
return '', ''
diff --git a/lcm/ns/vnfs/get_vnfs.py b/lcm/ns_vnfs/biz/get_vnfs.py
index 0ca8e66e..0ca8e66e 100644
--- a/lcm/ns/vnfs/get_vnfs.py
+++ b/lcm/ns_vnfs/biz/get_vnfs.py
diff --git a/lcm/v2/grant_vnf.py b/lcm/ns_vnfs/biz/grant_vnf.py
index 47348500..47348500 100644
--- a/lcm/v2/grant_vnf.py
+++ b/lcm/ns_vnfs/biz/grant_vnf.py
diff --git a/lcm/ns/vnfs/grant_vnfs.py b/lcm/ns_vnfs/biz/grant_vnfs.py
index e64bfd1c..e64bfd1c 100644
--- a/lcm/ns/vnfs/grant_vnfs.py
+++ b/lcm/ns_vnfs/biz/grant_vnfs.py
diff --git a/lcm/v2/handle_vnflcmooc_notification.py b/lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py
index 4b13a246..5e6ebedb 100644
--- a/lcm/v2/handle_vnflcmooc_notification.py
+++ b/lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py
@@ -12,22 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import uuid
import logging
import traceback
+import uuid
from rest_framework import status
from rest_framework.response import Response
-from lcm.ns.vnfs.const import INST_TYPE
+
from lcm.pub.config.config import REPORT_TO_AAI
-from lcm.pub.exceptions import NSLCMException
from lcm.pub.database.models import VNFCInstModel, VLInstModel, NfInstModel, VmInstModel, PortInstModel, CPInstModel
+from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.aai import create_network_aai, query_network_aai, delete_network_aai, query_vserver_aai, \
delete_vserver_aai
-from lcm.pub.utils.values import ignore_case_get
-from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
from lcm.pub.msapi.aai import create_vserver_aai
-
+from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
+from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.const import INST_TYPE
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/vnfs/heal_vnfs.py b/lcm/ns_vnfs/biz/heal_vnfs.py
index b9520adc..31dbc966 100644
--- a/lcm/ns/vnfs/heal_vnfs.py
+++ b/lcm/ns_vnfs/biz/heal_vnfs.py
@@ -17,16 +17,16 @@ import logging
import threading
import traceback
-from lcm.ns.vnfs.const import VNF_STATUS
-from lcm.ns.vnfs.wait_job import wait_job_finish
+from lcm.pub.config.config import MR_IP
+from lcm.pub.config.config import MR_PORT
from lcm.pub.database.models import NfInstModel, VNFCInstModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.vnfmdriver import send_nf_heal_request
+from lcm.pub.utils import restcall
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE, JOB_MODEL_STATUS
from lcm.pub.utils.values import ignore_case_get
-from lcm.pub.config.config import MR_IP
-from lcm.pub.config.config import MR_PORT
-from lcm.pub.utils import restcall
+from lcm.ns_vnfs.const import VNF_STATUS
+from lcm.ns_vnfs.biz.wait_job import wait_job_finish
JOB_ERROR = 255
diff --git a/lcm/ns/vnfs/notify_lcm.py b/lcm/ns_vnfs/biz/notify_lcm.py
index 62911c58..4f7ac300 100644
--- a/lcm/ns/vnfs/notify_lcm.py
+++ b/lcm/ns_vnfs/biz/notify_lcm.py
@@ -11,22 +11,22 @@
# 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 uuid
import logging
import traceback
+import uuid
from rest_framework import status
from rest_framework.response import Response
-from lcm.ns.vnfs.const import INST_TYPE
+
from lcm.pub.config.config import REPORT_TO_AAI
-from lcm.pub.exceptions import NSLCMException
from lcm.pub.database.models import VNFCInstModel, VLInstModel, NfInstModel, PortInstModel, CPInstModel, VmInstModel
+from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.aai import create_network_aai, query_network_aai, delete_network_aai, query_vserver_aai, \
delete_vserver_aai
-from lcm.pub.utils.values import ignore_case_get
-from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
from lcm.pub.msapi.aai import create_vserver_aai
-
+from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
+from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.const import INST_TYPE
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/vnfs/place_vnfs.py b/lcm/ns_vnfs/biz/place_vnfs.py
index 0e54a121..0e54a121 100644
--- a/lcm/ns/vnfs/place_vnfs.py
+++ b/lcm/ns_vnfs/biz/place_vnfs.py
diff --git a/lcm/ns/vnfs/scale_vnfs.py b/lcm/ns_vnfs/biz/scale_vnfs.py
index 718813ea..bac181ec 100644
--- a/lcm/ns/vnfs/scale_vnfs.py
+++ b/lcm/ns_vnfs/biz/scale_vnfs.py
@@ -16,13 +16,13 @@ import logging
import threading
import traceback
-from lcm.ns.vnfs.const import VNF_STATUS
-from lcm.ns.vnfs.wait_job import wait_job_finish
from lcm.pub.database.models import NfInstModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.vnfmdriver import send_nf_scaling_request
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE, JOB_MODEL_STATUS
from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.const import VNF_STATUS
+from lcm.ns_vnfs.biz.wait_job import wait_job_finish
JOB_ERROR = 255
SCALE_TYPE = ("SCALE_OUT", "SCALE_IN")
diff --git a/lcm/ns/vnfs/terminate_nfs.py b/lcm/ns_vnfs/biz/terminate_nfs.py
index 7db2d7c3..98bc7d20 100644
--- a/lcm/ns/vnfs/terminate_nfs.py
+++ b/lcm/ns_vnfs/biz/terminate_nfs.py
@@ -12,23 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import logging
-import traceback
import json
-
+import logging
import threading
+import traceback
-from lcm.ns.vnfs.wait_job import wait_job_finish
from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.database.models import NfInstModel, VmInstModel
-from lcm.ns.vnfs.const import VNF_STATUS, NFVO_VNF_INST_TIMEOUT_SECOND, INST_TYPE
+from lcm.pub.exceptions import NSLCMException
+from lcm.pub.msapi import resmgr
from lcm.pub.msapi.aai import query_vnf_aai, delete_vnf_aai, query_vserver_aai, delete_vserver_aai
from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
-from lcm.pub.utils.values import ignore_case_get
-from lcm.pub.utils.jobutil import JOB_MODEL_STATUS, JobUtil
-from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.vnfmdriver import send_nf_terminate_request
-from lcm.pub.msapi import resmgr
+from lcm.pub.utils.jobutil import JOB_MODEL_STATUS, JobUtil
+from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.const import VNF_STATUS, NFVO_VNF_INST_TIMEOUT_SECOND, INST_TYPE
+from lcm.ns_vnfs.biz.wait_job import wait_job_finish
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/vnfs/verify_vnfs.py b/lcm/ns_vnfs/biz/verify_vnfs.py
index 2cc55a29..7c23dd59 100644
--- a/lcm/ns/vnfs/verify_vnfs.py
+++ b/lcm/ns_vnfs/biz/verify_vnfs.py
@@ -79,7 +79,7 @@ class VerifyVnfs(threading.Thread):
"additionalParamForVnf": vnf_param,
"vnfIndex": "1"
}
- ret = req_by_msb("/api/nslcm/v1/ns/vnfs", "POST", json.JSONEncoder().encode(inst_data))
+ ret = req_by_msb("/api/nslcm/v1/ns/ns_vnfs", "POST", json.JSONEncoder().encode(inst_data))
if ret[0] != 0:
raise NSLCMException("Failed to call inst vnf: %s" % ret[1])
rsp_data = json.JSONDecoder().decode(ret[1])
@@ -115,7 +115,7 @@ class VerifyVnfs(threading.Thread):
"terminationType": "forceful",
"gracefulTerminationTimeout": "600"
}
- ret = req_by_msb("/api/nslcm/v1/ns/vnfs/%s" % self.vnf_inst_id, "POST", json.JSONEncoder().encode(term_data))
+ ret = req_by_msb("/api/nslcm/v1/ns/ns_vnfs/%s" % self.vnf_inst_id, "POST", json.JSONEncoder().encode(term_data))
if ret[0] != 0:
raise NSLCMException("Failed to call term vnf: %s" % ret[1])
rsp_data = json.JSONDecoder().decode(ret[1])
@@ -211,7 +211,7 @@ class VerifyVnfs(threading.Thread):
return job_end_normal
def load_config(self):
- json_file = os.path.join(os.path.dirname(__file__), 'verify_vnfs_config.json')
+ json_file = os.path.join(os.path.dirname(__file__), '../biz/verify_vnfs_config.json')
f = open(json_file)
json_data = json.JSONDecoder().decode(f.read())
f.close()
diff --git a/lcm/ns/vnfs/verify_vnfs_config.json b/lcm/ns_vnfs/biz/verify_vnfs_config.json
index 712a070f..712a070f 100644
--- a/lcm/ns/vnfs/verify_vnfs_config.json
+++ b/lcm/ns_vnfs/biz/verify_vnfs_config.json
diff --git a/lcm/ns/vnfs/wait_job.py b/lcm/ns_vnfs/biz/wait_job.py
index a1788ef7..a1788ef7 100644
--- a/lcm/ns/vnfs/wait_job.py
+++ b/lcm/ns_vnfs/biz/wait_job.py
diff --git a/lcm/ns/vnfs/const.py b/lcm/ns_vnfs/const.py
index bc0047f3..bc0047f3 100644
--- a/lcm/ns/vnfs/const.py
+++ b/lcm/ns_vnfs/const.py
diff --git a/lcm/ns_vnfs/serializers/__init__.py b/lcm/ns_vnfs/serializers/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_vnfs/serializers/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/v2/serializers.py b/lcm/ns_vnfs/serializers/grant_vnf_serializer.py
index 557c603c..557c603c 100644
--- a/lcm/v2/serializers.py
+++ b/lcm/ns_vnfs/serializers/grant_vnf_serializer.py
diff --git a/lcm/ns/vnfs/serializers.py b/lcm/ns_vnfs/serializers/serializers.py
index 3019ad28..3019ad28 100644
--- a/lcm/ns/vnfs/serializers.py
+++ b/lcm/ns_vnfs/serializers/serializers.py
diff --git a/lcm/ns_vnfs/tests/__init__.py b/lcm/ns_vnfs/tests/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_vnfs/tests/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/v2/tests.py b/lcm/ns_vnfs/tests/grant_vnf_test.py
index e988b98f..ce655de9 100644
--- a/lcm/v2/tests.py
+++ b/lcm/ns_vnfs/tests/grant_vnf_test.py
@@ -220,7 +220,7 @@ class VnfGrantViewTest(unittest.TestCase):
"external_cps": [],
"forward_cps": []
},
- "vls": [],
+ "ns_vls": [],
"cps": [],
"metadata": {
"designer": "sdno",
@@ -275,7 +275,7 @@ class VnfGrantViewTest(unittest.TestCase):
self.assertEqual(expect_resp_data, resp_data)
def test_get_notify_vnf_normal(self):
- response = self.client.get("/api/nslcm/v2/ns/1/vnfs/1/Notify")
+ response = self.client.get("/api/nslcm/v2/ns/1/ns_vnfs/1/Notify")
self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content)
def test_notify_vnf_normal(self):
@@ -414,5 +414,5 @@ class VnfGrantViewTest(unittest.TestCase):
NfInstModel.objects.create(nfinstid='22',
mnfinstid='2',
vnfm_inst_id='1')
- response = self.client.post("/api/nslcm/v2/ns/1/vnfs/2/Notify", data=data, format='json')
+ response = self.client.post("/api/nslcm/v2/ns/1/ns_vnfs/2/Notify", data=data, format='json')
self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content)
diff --git a/lcm/ns/tests/vnfs/tests.py b/lcm/ns_vnfs/tests/tests.py
index 2e3e4f14..37add61b 100644
--- a/lcm/ns/tests/vnfs/tests.py
+++ b/lcm/ns_vnfs/tests/tests.py
@@ -18,12 +18,6 @@ import mock
from django.test import TestCase, Client
from rest_framework import status
-from lcm.ns.vnfs import create_vnfs
-from lcm.ns.vnfs.const import VNF_STATUS, INST_TYPE
-from lcm.ns.vnfs.create_vnfs import CreateVnfs
-from lcm.ns.vnfs.heal_vnfs import NFHealService
-from lcm.ns.vnfs.scale_vnfs import NFManualScaleService
-from lcm.ns.vnfs.terminate_nfs import TerminateVnfs
from lcm.pub.database.models import NfInstModel, JobModel, NSInstModel, VmInstModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils import restcall
@@ -31,6 +25,12 @@ from lcm.pub.utils.jobutil import JOB_MODEL_STATUS
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
from lcm.pub.utils.timeutil import now_time
from lcm.pub.utils.values import ignore_case_get
+from lcm.ns_vnfs.biz.create_vnfs import CreateVnfs
+from lcm.ns_vnfs.biz.heal_vnfs import NFHealService
+from lcm.ns_vnfs.biz.scale_vnfs import NFManualScaleService
+from lcm.ns_vnfs.biz.terminate_nfs import TerminateVnfs
+from lcm.ns_vnfs.const import VNF_STATUS, INST_TYPE
+from lcm.ns_vnfs.biz import create_vnfs
class TestGetVnfViews(TestCase):
diff --git a/lcm/ns/tests/vnfs/verify_test.py b/lcm/ns_vnfs/tests/verify_test.py
index 532d5c1b..532d5c1b 100644
--- a/lcm/ns/tests/vnfs/verify_test.py
+++ b/lcm/ns_vnfs/tests/verify_test.py
diff --git a/lcm/ns/vnfs/urls.py b/lcm/ns_vnfs/urls.py
index 40d3230b..dd555bf5 100644
--- a/lcm/ns/vnfs/urls.py
+++ b/lcm/ns_vnfs/urls.py
@@ -14,20 +14,26 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.ns.vnfs.views import NfView, NfDetailView, NfGrant, NfPlacement
-from lcm.ns.vnfs.views import LcmNotify, NfScaleView, NfVerifyView
-from lcm.ns.vnfs.views import NfVnfmInfoView, NfVimInfoView
+from lcm.ns_vnfs.views.views import LcmNotify, NfScaleView, NfVerifyView
+from lcm.ns_vnfs.views.views import NfView, NfDetailView, NfGrant, NfPlacement
+from lcm.ns_vnfs.views.views import NfVnfmInfoView, NfVimInfoView
+from lcm.ns_vnfs.views.grant_vnf_views import VnfGrantView, VnfNotifyView
urlpatterns = [
url(r'^api/nslcm/v1/ns/vnfs$', NfView.as_view()),
url(r'^api/nslcm/v1/ns/vnfs/(?P<vnfinstid>[0-9a-zA-Z_-]+)$', NfDetailView.as_view()),
url(r'^api/nslcm/v1/ns/grantvnf$', NfGrant.as_view()),
url(r'^api/nslcm/v1/ns/placevnf$', NfPlacement.as_view()),
- url(r'^api/nslcm/v1/ns/(?P<vnfmid>[0-9a-zA-Z_-]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$', LcmNotify.as_view()),
- url(r'^api/nslcm/v1/ns/vnfs/(?P<vnfinstid>[0-9a-zA-Z_-]+)/scaling$', NfScaleView.as_view()),
+ url(r'^api/nslcm/v1/ns/(?P<vnfmid>[0-9a-zA-Z_-]+)/ns_vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$', LcmNotify.as_view()),
+ url(r'^api/nslcm/v1/ns/ns_vnfs/(?P<vnfinstid>[0-9a-zA-Z_-]+)/scaling$', NfScaleView.as_view()),
url(r'^api/nslcm/v1/vnfonboarding$', NfVerifyView.as_view()),
url(r'^api/nslcm/v1/vnfms/(?P<vnfmid>[0-9a-zA-Z_-]+)', NfVnfmInfoView.as_view()),
url(r'^api/nslcm/v1/vims/(?P<vimid>[0-9a-zA-Z_-]+)', NfVimInfoView.as_view()),
+
+ # move form v2
+ url(r'^api/nslcm/v2/grants$', VnfGrantView.as_view()),
+ url(r'^api/nslcm/v2/ns/(?P<vnfmId>[0-9a-zA-Z_-]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$',
+ VnfNotifyView.as_view()),
]
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/lcm/ns_vnfs/views/__init__.py b/lcm/ns_vnfs/views/__init__.py
new file mode 100644
index 00000000..ca9a1945
--- /dev/null
+++ b/lcm/ns_vnfs/views/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/v2/views.py b/lcm/ns_vnfs/views/grant_vnf_views.py
index 9c953c19..aa4fd32e 100644
--- a/lcm/v2/views.py
+++ b/lcm/ns_vnfs/views/grant_vnf_views.py
@@ -14,16 +14,16 @@
import logging
import traceback
+from drf_yasg.utils import swagger_auto_schema
+from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from rest_framework import status
-from drf_yasg.utils import swagger_auto_schema
-from lcm.v2.serializers import GrantRequestSerializer
-from lcm.v2.serializers import GrantSerializer
-from lcm.v2.serializers import VnfLcmOperationOccurrenceNotificationSerializer
-from lcm.v2.grant_vnf import GrantVnf
-from lcm.v2.handle_vnflcmooc_notification import HandleVnfLcmOocNotification
+from lcm.ns_vnfs.biz.grant_vnf import GrantVnf
+from lcm.ns_vnfs.biz.handle_vnflcmooc_notification import HandleVnfLcmOocNotification
+from lcm.ns_vnfs.serializers.grant_vnf_serializer import GrantRequestSerializer
+from lcm.ns_vnfs.serializers.grant_vnf_serializer import GrantSerializer
+from lcm.ns_vnfs.serializers.grant_vnf_serializer import VnfLcmOperationOccurrenceNotificationSerializer
logger = logging.getLogger(__name__)
diff --git a/lcm/ns/vnfs/views.py b/lcm/ns_vnfs/views/views.py
index c5bc25e1..517238b3 100644
--- a/lcm/ns/vnfs/views.py
+++ b/lcm/ns_vnfs/views/views.py
@@ -15,39 +15,39 @@ import logging
import traceback
import uuid
+from drf_yasg.utils import swagger_auto_schema
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from drf_yasg.utils import swagger_auto_schema
-from lcm.ns.vnfs import create_vnfs
-from lcm.ns.vnfs.create_vnfs import CreateVnfs
-from lcm.ns.vnfs.verify_vnfs import VerifyVnfs
-from lcm.ns.vnfs.get_vnfs import GetVnf
-from lcm.ns.vnfs.scale_vnfs import NFManualScaleService
-from lcm.ns.vnfs.terminate_nfs import TerminateVnfs
-from lcm.ns.vnfs.grant_vnfs import GrantVnfs
-from lcm.ns.vnfs.place_vnfs import PlaceVnfs
-from lcm.ns.vnfs.notify_lcm import NotifyLcm
from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.extsys import get_vnfm_by_id, get_vim_by_id
from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
from lcm.pub.utils.values import ignore_case_get
-from lcm.ns.vnfs.serializers import InstVnfReqSerializer
-from lcm.ns.vnfs.serializers import InstVnfRespSerializer
-from lcm.ns.vnfs.serializers import GetVnfRespSerializer
-from lcm.ns.vnfs.serializers import TerminateVnfReqSerializer
-from lcm.ns.vnfs.serializers import TerminateVnfRespSerializer
-from lcm.ns.vnfs.serializers import GrantVnfReqSerializer
-from lcm.ns.vnfs.serializers import GrantVnfRespSerializer
-from lcm.ns.vnfs.serializers import NotifyLcmReqSerializer
-from lcm.ns.vnfs.serializers import ScaleVnfReqSerializer
-from lcm.ns.vnfs.serializers import ScaleVnfRespSerializer
-from lcm.ns.vnfs.serializers import VerifyVnfReqSerializer
-from lcm.ns.vnfs.serializers import VerifyVnfRespSerializer
-from lcm.ns.vnfs.serializers import VnfmInfoRespSerializer
-from lcm.ns.vnfs.serializers import VimInfoRespSerializer
-from lcm.ns.vnfs.serializers import PlaceVnfReqSerializer
+from lcm.ns_vnfs.biz.create_vnfs import CreateVnfs
+from lcm.ns_vnfs.biz.get_vnfs import GetVnf
+from lcm.ns_vnfs.serializers.serializers import GetVnfRespSerializer
+from lcm.ns_vnfs.serializers.serializers import GrantVnfReqSerializer
+from lcm.ns_vnfs.serializers.serializers import GrantVnfRespSerializer
+from lcm.ns_vnfs.biz.grant_vnfs import GrantVnfs
+from lcm.ns_vnfs.serializers.serializers import InstVnfReqSerializer
+from lcm.ns_vnfs.serializers.serializers import InstVnfRespSerializer
+from lcm.ns_vnfs.biz.scale_vnfs import NFManualScaleService
+from lcm.ns_vnfs.biz.notify_lcm import NotifyLcm
+from lcm.ns_vnfs.serializers.serializers import NotifyLcmReqSerializer
+from lcm.ns_vnfs.serializers.serializers import PlaceVnfReqSerializer
+from lcm.ns_vnfs.biz.place_vnfs import PlaceVnfs
+from lcm.ns_vnfs.serializers.serializers import ScaleVnfReqSerializer
+from lcm.ns_vnfs.serializers.serializers import ScaleVnfRespSerializer
+from lcm.ns_vnfs.serializers.serializers import TerminateVnfReqSerializer
+from lcm.ns_vnfs.serializers.serializers import TerminateVnfRespSerializer
+from lcm.ns_vnfs.biz.terminate_nfs import TerminateVnfs
+from lcm.ns_vnfs.serializers.serializers import VerifyVnfReqSerializer
+from lcm.ns_vnfs.serializers.serializers import VerifyVnfRespSerializer
+from lcm.ns_vnfs.biz.verify_vnfs import VerifyVnfs
+from lcm.ns_vnfs.serializers.serializers import VimInfoRespSerializer
+from lcm.ns_vnfs.serializers.serializers import VnfmInfoRespSerializer
+from lcm.ns_vnfs.biz import create_vnfs
logger = logging.getLogger(__name__)
diff --git a/lcm/pub/utils/tests.py b/lcm/pub/utils/tests.py
index d7d628e0..4d50a335 100644
--- a/lcm/pub/utils/tests.py
+++ b/lcm/pub/utils/tests.py
@@ -57,7 +57,7 @@ class UtilsTest(unittest.TestCase):
fileutil.delete_dirs("abc")
is_ok, f_name = fileutil.download_file_from_http("1", "abc", "1.txt")
self.assertTrue(is_ok)
- self.assertTrue(f_name.endswith("abc/1.txt"))
+ self.assertTrue(f_name.endswith("1.txt"))
fileutil.delete_dirs("abc")
def test_query_job_status(self):
diff --git a/lcm/urls.py b/lcm/urls.py
index 729057f0..44b79f55 100644
--- a/lcm/urls.py
+++ b/lcm/urls.py
@@ -20,14 +20,13 @@ 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.ns.vnfs.urls')),
- url(r'^', include('lcm.ns.vls.urls')),
- url(r'^', include('lcm.ns.sfcs.urls')),
+ url(r'^', include('lcm.ns_vnfs.urls')),
+ url(r'^', include('lcm.ns_vls.urls')),
+ url(r'^', include('lcm.ns_sfcs.urls')),
url(r'^', include('lcm.ns.urls')),
url(r'^', include('lcm.jobs.urls')),
url(r'^', include('lcm.workflows.urls')),
url(r'^', include('lcm.swagger.urls')),
- url(r'^', include('lcm.v2.urls')),
]
# regist to MSB when startup
diff --git a/lcm/v2/urls.py b/lcm/v2/urls.py
deleted file mode 100644
index 243cdcd8..00000000
--- a/lcm/v2/urls.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-from django.conf.urls import url
-from rest_framework.urlpatterns import format_suffix_patterns
-
-from lcm.v2.views import VnfGrantView, VnfNotifyView
-
-urlpatterns = [
- url(r'^api/nslcm/v2/grants$', VnfGrantView.as_view()),
- url(r'^api/nslcm/v2/ns/(?P<vnfmId>[0-9a-zA-Z_-]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z_-]+)/Notify$', VnfNotifyView.as_view()),
-]
-
-urlpatterns = format_suffix_patterns(urlpatterns)