summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivia2047 <zhan.jie1@zte.com.cn>2018-02-11 14:15:57 +0800
committerOlivia2047 <zhan.jie1@zte.com.cn>2018-02-11 14:15:57 +0800
commit419ff1636376fb94879d8c61ec7d8c52745deb5f (patch)
tree254c8afc08bd8f1c83f6454ef65104a15136e0c2
parent3f0fd16389a70751664a8f654cb8c529b58202bc (diff)
Add auto swagger code for VnfOperInfo VnfGrantInfo
Change-Id: Ica16765e7be66a2bd18bbea266ec57f98cd3b79d Issue-ID: VFC-737 Signed-off-by: Olivia J.Zhan. <zhan.jie1@zte.com.cn>
-rw-r--r--gvnfmadapter/driver/interfaces/serializers.py37
-rw-r--r--gvnfmadapter/driver/interfaces/views.py16
2 files changed, 53 insertions, 0 deletions
diff --git a/gvnfmadapter/driver/interfaces/serializers.py b/gvnfmadapter/driver/interfaces/serializers.py
index c0fcdc7..c7dd351 100644
--- a/gvnfmadapter/driver/interfaces/serializers.py
+++ b/gvnfmadapter/driver/interfaces/serializers.py
@@ -83,3 +83,40 @@ class VnfQueryRespSerializer(serializers.Serializer):
help_text="The information items about the selected VNF instance(s) that are returned.",
required=True
)
+
+
+class ResponseDescriptor(serializers.Serializer):
+ status = serializers.CharField(help_text="status.", required=True)
+ responsehistorylist = serializers.CharField(help_text="History response messages.", required=True)
+ responseid = serializers.CharField(help_text="Response identifier.", required=True)
+ errorcode = serializers.CharField(help_text="Errorcode.", required=True)
+ progress = serializers.IntegerField(help_text="Progress.", required=True)
+ statusdescription = serializers.CharField(help_text="Status description.", required=True)
+
+
+class OperationStatusInfo(serializers.Serializer):
+ responsedescriptor = ResponseDescriptor(help_text="Response descriptor.", required=True)
+ jobid = serializers.CharField(help_text="Job ID.", required=True)
+
+
+class VnfOperRespSerializer(serializers.Serializer):
+ operationStatusInfo = OperationStatusInfo(
+ help_text="Operation Status.",
+ required=True
+ )
+
+
+class VnfGrantReqSerializer(serializers.Serializer):
+ vnfmid = serializers.CharField(help_text="VNFM identifier.", required=True)
+ nfvoid = serializers.CharField(help_text="NFVO identifier.", required=True)
+ vimid = serializers.CharField(help_text="VIM identifier.", required=True)
+ exvimidlist = serializers.CharField(help_text="Extend VIM identifier list.", required=True)
+ tenant = serializers.CharField(help_text="Tenant name.", required=True)
+ vnfistanceid = serializers.CharField(help_text="VNF instance identifier.", required=True)
+ operationright = serializers.CharField(help_text="Operation right.", required=True)
+ vmlist = serializers.CharField(help_text="VM list.", required=True)
+
+
+class VnfGrantRespSerializer(serializers.Serializer):
+ vimid = serializers.CharField(help_text="VIM identifier.", required=True)
+ tenant = serializers.CharField(help_text="Tenant name.", required=True)
diff --git a/gvnfmadapter/driver/interfaces/views.py b/gvnfmadapter/driver/interfaces/views.py
index eb7c0c9..0bd3deb 100644
--- a/gvnfmadapter/driver/interfaces/views.py
+++ b/gvnfmadapter/driver/interfaces/views.py
@@ -28,6 +28,7 @@ from driver.pub.utils import restcall
from driver.pub.utils.restcall import req_by_msb
from driver.interfaces.serializers import VnfInstReqParamsSerializer, ResponseSerializer
from driver.interfaces.serializers import VnfTermReqSerializer, VnfQueryRespSerializer
+from driver.interfaces.serializers import VnfOperRespSerializer, VnfGrantReqSerializer, VnfGrantRespSerializer
logger = logging.getLogger(__name__)
@@ -181,6 +182,13 @@ class VnfQueryInfo(APIView):
class VnfOperInfo(APIView):
+ @swagger_auto_schema(
+ responses={
+ status.HTTP_201_CREATED: VnfOperRespSerializer(),
+ status.HTTP_404_NOT_FOUND: "The vnfmid, jobid and responseId are wrong",
+ status.HTTP_500_INTERNAL_SERVER_ERROR: "The url is invalid"
+ }
+ )
def get(self, request, vnfmtype, vnfmid, jobid):
logger.debug("operation_status--post::> %s" % request.data)
try:
@@ -217,6 +225,14 @@ class VnfOperInfo(APIView):
class VnfGrantInfo(APIView):
+ @swagger_auto_schema(
+ request_body=VnfGrantReqSerializer(),
+ responses={
+ status.HTTP_201_CREATED: VnfGrantRespSerializer(),
+ status.HTTP_404_NOT_FOUND: "The request body is wrong",
+ status.HTTP_500_INTERNAL_SERVER_ERROR: "The url is invalid"
+ }
+ )
def put(self, request, vnfmtype):
try:
logger.debug("[grantvnf] req_data = %s", request.data)