diff options
-rw-r--r-- | zte/vmanager/driver/interfaces/urls.py | 5 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/views.py | 44 |
2 files changed, 49 insertions, 0 deletions
diff --git a/zte/vmanager/driver/interfaces/urls.py b/zte/vmanager/driver/interfaces/urls.py index de8bbee4..65331fc0 100644 --- a/zte/vmanager/driver/interfaces/urls.py +++ b/zte/vmanager/driver/interfaces/urls.py @@ -30,5 +30,10 @@ urlpatterns = [ views.Scale.as_view(), name='scale'), url(r'^api/ztevnfmdriver/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/heal$', views.Heal.as_view(), name='heal'), + url(r'^api/ztevnfmdriver/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/heal$', + views.Heal.as_view(), name='heal'), + url(r'^api/ztevnfmdriver/v1/subscribe/(?P<subscribeId>[0-9a-zA-Z\-\_]+)$', views.SubscribeDetail.as_view(), name='subscribe_detail'), + url(r'^api/ztevnfmdriver/v1/subscribe$', views.Subscribe.as_view(), name='subscribe'), + url(r'^api/ztevnfmdriver/v1/vnfpkgs$', views.VnfPkgs.as_view(), name='VnfPkgs'), url(r'^samples/$', views.SampleList.as_view(), name='samples') ] diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py index 4615df94..3fc6272d 100644 --- a/zte/vmanager/driver/interfaces/views.py +++ b/zte/vmanager/driver/interfaces/views.py @@ -618,3 +618,47 @@ class SampleList(APIView): def get(self, request): logger.debug("get") return Response({"status": "active"}) + + +class Subscribe(APIView): + def get(self, request): + logger.debug("====Subscribe get====") + resp_data = { + "subscriptions": [{ + "subscribeid": "cdbddb00-452c-11e9-91e8-acc860114657", + "filter": [{ + "vendor": "ZTE", + "type": "vCPE", + }], + "notificationuri": " https://127.0.0.1:80/v2/vnfm/vnfds/notification", + }] + } + return Response(data=resp_data, status=status.HTTP_200_OK) + + def post(self, request): + logger.debug("====Subscribe post====") + resp_data = {"subscribeid": "cdbddb00-452c-11e9-91e8-acc860114657"} + return Response(data=resp_data, status=status.HTTP_201_CREATED) + + +class SubscribeDetail(APIView): + def delete(self, request, subscribeId): + logger.debug("====SubscribeDetail delete %s====", subscribeId) + return Response(status=status.HTTP_204_NO_CONTENT) + + +class VnfPkgs(APIView): + def get(self, request): + logger.debug("====VnfPkgs get====") + resp_data = { + "data": [{ + "packageid": "924fc980-4530-11e9-ae68-acc860114657", + "vendor": "ZTE", + "type": "vCPE", + "vnfdfile": "MRP6600_FS_SRIOV_4NIC_200W.zip", + "imagefiles": ["MRP6600_FS_SRIOV_MRPISU_IMGV500R008C20SPC030T.tar"], + "swfiles": ["MRP6600_SRV_V500R008C20SPC030T.tar"], + "description": "This is a service for vCPE.", + }] + } + return Response(data=resp_data, status=status.HTTP_200_OK) |