# 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
-# 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.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
# 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__)
# 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)
@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']
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:
@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)}
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")
# 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")
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
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
# 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):
# 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
}
self.nsd_model = json.dumps({
"model": json.dumps({
- "vnfs": [{
+ "ns_vnfs": [{
"vnf_id": "vnf1",
"properties": {
"id": "vnfd1",
"vl_id": "5"
}]
}],
- "vls": [{
+ "ns_vls": [{
"vl_id": "5",
"properties": {}
}]
})
})
self.updated_nsd_model = {
- "vnfs": [{
+ "ns_vnfs": [{
"dependencies": [{
"vl_id": "5"
}],
"id": "vnfd1"
}
}],
- "vls": [{
+ "ns_vls": [{
"vl_id": "5",
"properties": {
"location_info": {
# 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": [
# 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):
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
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,
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()),
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)
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
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__)
+++ /dev/null
-# 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.
+++ /dev/null
-# 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.
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
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__)
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__)
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
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__)
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
-# 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.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
"param2": "22",
},
- "vnfs": [
+ "ns_vnfs": [
{
"type": "tosca.nodes.nfv.ext.VNF.FireWall",
"vnf_id": "vnf_1",
}
],
- "vls": [
+ "ns_vls": [
{
"vl_id": "vldId1",
"description": "",
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'image_file_id': u'sss'
}
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'dependencies': [
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
'image_file_id': u'sss'
}
],
- 'vls': [
+ 'ns_vls': [
],
'cps': [
# '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):
"param2": "22",
},
- "vnfs": [
+ "ns_vnfs": [
{
"type": "tosca.nodes.nfv.ext.VNF.FireWall",
"vnf_id": "vnf_1",
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):
'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)
# 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()),
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
# 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__)
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__)
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")
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):
"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],
"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)
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"])
'''
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)
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()),
# 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__)
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
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
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__)
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']:
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']:
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 '', ''
# 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__)
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
# 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__)
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")
# 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__)
"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])
"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])
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()
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
"external_cps": [],
"forward_cps": []
},
- "vls": [],
+ "ns_vls": [],
"cps": [],
"metadata": {
"designer": "sdno",
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):
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)
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
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):
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)
--- /dev/null
+# Copyright 2018 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
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__)
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__)
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):
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
+++ /dev/null
-# 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)