aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaopengzhang <zhang.maopeng1@zte.com.cn>2019-03-20 20:20:47 +0800
committermaopengzhang <zhang.maopeng1@zte.com.cn>2019-03-20 20:24:12 +0800
commitd490f5bfd727d0219eb4dd74235194e9712ebb9a (patch)
treefa7ed3febfe61aeaad331b728a5a6e1d82f22d50
parent85acd5ef9b2a9368c9c82f172a98892bf4f8e3cc (diff)
create NS
create NS Change-Id: I51719db2213cac96afe9792a8eeb3400fad8dfcc Issue-ID: VFC-1211 Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r--lcm/ns/urls.py26
-rw-r--r--lcm/ns/views/deprecated/__init__.py0
-rw-r--r--lcm/ns/views/deprecated/create_ns_view.py (renamed from lcm/ns/views/create_ns_view.py)0
-rw-r--r--lcm/ns/views/deprecated/get_del_ns_view.py (renamed from lcm/ns/views/get_del_ns_view.py)0
-rw-r--r--lcm/ns/views/deprecated/inst_ns_view.py (renamed from lcm/ns/views/inst_ns_view.py)0
-rw-r--r--lcm/ns/views/deprecated/term_ns_view.py (renamed from lcm/ns/views/term_ns_view.py)0
-rw-r--r--lcm/ns/views/sol/__init__.py0
-rw-r--r--lcm/ns/views/sol/ns_instances_views.py37
-rw-r--r--lcm/ns/views/sol/nslcm_op_views.py35
9 files changed, 88 insertions, 10 deletions
diff --git a/lcm/ns/urls.py b/lcm/ns/urls.py
index d9efa614..0a12ed7e 100644
--- a/lcm/ns/urls.py
+++ b/lcm/ns/urls.py
@@ -14,20 +14,21 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.ns.views.create_ns_view import CreateNSView
-from lcm.ns.views.inst_ns_view import NSInstView
-from lcm.ns.views.term_ns_view import TerminateNSView
+from lcm.ns.views.deprecated.create_ns_view import CreateNSView
+from lcm.ns.views.deprecated.get_del_ns_view import NSDetailView
+from lcm.ns.views.deprecated.inst_ns_view import NSInstView
+from lcm.ns.views.deprecated.term_ns_view import TerminateNSView
+from lcm.ns.views.sol.ns_instances_views import NSInstancesView, IndividualNsInstanceView
+from lcm.ns.views.sol.nslcm_op_views import InstantiateNsView, TerminateNsView
from lcm.ns.views.heal_ns_view import NSHealView
-from lcm.ns.views.update_ns_view import NSUpdateView
-from lcm.ns.views.get_del_ns_view import NSDetailView
from lcm.ns.views.inst_ns_post_deal_view import NSInstPostDealView
+from lcm.ns.views.lcm_op_occs_view import QueryMultiNsLcmOpOccs, QuerySingleNsLcmOpOcc
from lcm.ns.views.scale_ns_views import NSManualScaleView
from lcm.ns.views.subscriptions_view import SubscriptionsView
-from lcm.ns.views.lcm_op_occs_view import QueryMultiNsLcmOpOccs, QuerySingleNsLcmOpOcc
+from lcm.ns.views.update_ns_view import NSUpdateView
urlpatterns = [
# API will be deprecated in the future release
- url(r'^api/nslcm/v1/subscriptions$', SubscriptionsView.as_view()),
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()),
@@ -37,10 +38,15 @@ urlpatterns = [
url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/heal$', NSHealView.as_view()),
url(r'^api/nslcm/v1/ns_lcm_op_occs$', QueryMultiNsLcmOpOccs.as_view()),
url(r'^api/nslcm/v1/ns_lcm_op_occs/(?P<lcmopoccid>[0-9a-zA-Z_-]+)$', QuerySingleNsLcmOpOcc.as_view()),
+ url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/update$', NSUpdateView.as_view()),
+
+ # SOL005 URL API definition
+ url(r'^api/nslcm/v1/ns_instances$', NSInstancesView.as_view()),
+ url(r'^api/nslcm/v1/ns_instances$/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/instantiate$', InstantiateNsView.as_view()),
+ url(r'^api/nslcm/v1/ns_instances$/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/terminate$', TerminateNsView.as_view()),
+ url(r'^api/nslcm/v1/ns_instances$/(?P<ns_instance_id>[0-9a-zA-Z_-]+)$', IndividualNsInstanceView.as_view()),
+ url(r'^api/nslcm/v1/subscriptions$', SubscriptionsView.as_view()),
- # SOL005 URL API definition TODO
- url(r'^api/nslcm/v1/ns/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/update$',
- NSUpdateView.as_view())
]
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/lcm/ns/views/deprecated/__init__.py b/lcm/ns/views/deprecated/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/ns/views/deprecated/__init__.py
diff --git a/lcm/ns/views/create_ns_view.py b/lcm/ns/views/deprecated/create_ns_view.py
index e03ed959..e03ed959 100644
--- a/lcm/ns/views/create_ns_view.py
+++ b/lcm/ns/views/deprecated/create_ns_view.py
diff --git a/lcm/ns/views/get_del_ns_view.py b/lcm/ns/views/deprecated/get_del_ns_view.py
index ce0692ec..ce0692ec 100644
--- a/lcm/ns/views/get_del_ns_view.py
+++ b/lcm/ns/views/deprecated/get_del_ns_view.py
diff --git a/lcm/ns/views/inst_ns_view.py b/lcm/ns/views/deprecated/inst_ns_view.py
index eddd9a97..eddd9a97 100644
--- a/lcm/ns/views/inst_ns_view.py
+++ b/lcm/ns/views/deprecated/inst_ns_view.py
diff --git a/lcm/ns/views/term_ns_view.py b/lcm/ns/views/deprecated/term_ns_view.py
index 0ae655b6..0ae655b6 100644
--- a/lcm/ns/views/term_ns_view.py
+++ b/lcm/ns/views/deprecated/term_ns_view.py
diff --git a/lcm/ns/views/sol/__init__.py b/lcm/ns/views/sol/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/ns/views/sol/__init__.py
diff --git a/lcm/ns/views/sol/ns_instances_views.py b/lcm/ns/views/sol/ns_instances_views.py
new file mode 100644
index 00000000..562df709
--- /dev/null
+++ b/lcm/ns/views/sol/ns_instances_views.py
@@ -0,0 +1,37 @@
+import logging
+
+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
+
+logger = logging.getLogger(__name__)
+
+
+class NSInstancesView(APIView):
+ def get(self, request):
+ logger.debug(request.query_params)
+ # todo
+
+ def post(self, request):
+ logger.debug("Enter NSInstancesView::POST ns_instances %s", request.data)
+ # todo
+ return Response(data={}, status=status.HTTP_201_CREATED)
+
+
+class IndividualNsInstanceView(APIView):
+ def get(self, request, id):
+ logger.debug("Enter IndividualNsInstanceView::get ns(%s)", id)
+ # todo
+ return Response(data={}, status=status.HTTP_200_OK)
+
+ @swagger_auto_schema(
+ request_body=None,
+ responses={
+ status.HTTP_204_NO_CONTENT: None
+ }
+ )
+ def delete(self, request, id):
+ logger.debug("Enter IndividualNsInstanceView::DELETE ns_instance(%s)", id)
+ # todo
+ return Response(data={}, status=status.HTTP_204_NO_CONTENT)
diff --git a/lcm/ns/views/sol/nslcm_op_views.py b/lcm/ns/views/sol/nslcm_op_views.py
new file mode 100644
index 00000000..ed4945a1
--- /dev/null
+++ b/lcm/ns/views/sol/nslcm_op_views.py
@@ -0,0 +1,35 @@
+import logging
+from rest_framework.views import APIView
+
+logger = logging.getLogger(__name__)
+
+
+class InstantiateNsView(APIView):
+ def post(self, request, id):
+ # todo
+ return
+
+
+class HealNsView(APIView):
+
+ def post(self, request, id):
+ # todo
+ return
+
+
+class ScaleNsView(APIView):
+ def post(self, request, id):
+ # todo
+ return
+
+
+class UpdateNsView(APIView):
+ def post(self, request, id):
+ # todo
+ return
+
+
+class TerminateNsView(APIView):
+ def post(self, request, id):
+ # todo
+ return