X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog%2Fpackages%2Fviews%2Fvnf_package_views.py;h=76891f2f58547ceb0f0e6bbce2b2df8ca78e0472;hb=2f4d7a5b1d2a629e5856a5e3e17576bc618452f0;hp=9fc143bd14849c6f33a1a7152465a0d907b13f2d;hpb=a32c2b20207885d895bd96204cc166fca14db97b;p=modeling%2Fetsicatalog.git diff --git a/catalog/packages/views/vnf_package_views.py b/catalog/packages/views/vnf_package_views.py index 9fc143b..76891f2 100644 --- a/catalog/packages/views/vnf_package_views.py +++ b/catalog/packages/views/vnf_package_views.py @@ -37,6 +37,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method="GET", operation_description="Query multiple VNF package resource", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_200_OK: VnfPkgInfosSerializer(), @@ -46,6 +47,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method="POST", operation_description="Create an individual VNF package resource", + tags=["VNF Package API"], request_body=CreateVnfPkgInfoRequestSerializer, responses={ status.HTTP_201_CREATED: VnfPkgInfoSerializer(), @@ -70,9 +72,34 @@ def vnf_packages_rc(request): return Response(data=data, status=status.HTTP_201_CREATED) +@swagger_auto_schema( + method="GET", + operation_description="Read VNFD of an on-boarded VNF package", + tags=["VNF Package API"], + request_body=no_body, + responses={ + status.HTTP_200_OK: VnfPkgInfosSerializer(), + status.HTTP_404_NOT_FOUND: "VNF package does not exist", + status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error" + } +) +@api_view(http_method_names=["GET"]) +@view_safe_call_with_log(logger=logger) +def vnfd_rd(request, **kwargs): + vnf_pkg_id = kwargs.get("vnfPkgId") + logger.debug("Read VNFD for VNF package %s" % vnf_pkg_id) + try: + file_iterator = VnfPackage().download_vnfd(vnf_pkg_id) + return StreamingHttpResponse(file_iterator, status=status.HTTP_200_OK) + except Exception as e: + logger.error(e) + raise e + + @swagger_auto_schema( method='PUT', operation_description="Upload VNF package content", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_202_ACCEPTED: "Successfully", @@ -82,6 +109,7 @@ def vnf_packages_rc(request): @swagger_auto_schema( method="GET", operation_description="Fetch VNF package content", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_200_OK: VnfPkgInfosSerializer(), @@ -113,6 +141,7 @@ def package_content_ru(request, **kwargs): @swagger_auto_schema( method='POST', operation_description="Upload VNF package content from uri", + tags=["VNF Package API"], request_body=UploadVnfPackageFromUriRequestSerializer, responses={ status.HTTP_202_ACCEPTED: "Successfully", @@ -136,6 +165,7 @@ def upload_from_uri_c(request, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query an individual VNF package resource", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_200_OK: VnfPkgInfoSerializer(), @@ -146,6 +176,7 @@ def upload_from_uri_c(request, **kwargs): @swagger_auto_schema( method='DELETE', operation_description="Delete an individual VNF package resource", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: "No content",