diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2019-03-20 11:19:34 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2019-03-20 11:40:38 +0800 |
commit | 5f924ba0d34363444ae558d6a3219551482f0fb3 (patch) | |
tree | d12d02440aa5ec4b6c11d9a6e859f5521f000d85 /zte | |
parent | 93fe03c6a611e3385f0efd9b56364d5412c7c205 (diff) |
Add api adaptor for zte vnfm
Change-Id: I2abeb89878505f97bca013ab875bb92ff387c3fa
Issue-ID: VFC-1307
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'zte')
-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) |