summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-03-21 08:52:26 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-03-21 10:13:25 +0800
commit0194671a341317b41162ce8f48f8112337c88b0c (patch)
tree4a0fc02699c33b28b41b3f36f00cfa445b4e68ff
parentd5f2d43c566ac4f14c173a5417ab3bec20af452b (diff)
Add api adaptor for update nfvo info
Change-Id: I4fe49c57b21cfb43ea2061b35d031d01160c4f73 Issue-ID: VFC-1307 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--zte/vmanager/driver/interfaces/urls.py1
-rw-r--r--zte/vmanager/driver/interfaces/views.py27
2 files changed, 28 insertions, 0 deletions
diff --git a/zte/vmanager/driver/interfaces/urls.py b/zte/vmanager/driver/interfaces/urls.py
index 82cc1ffd..9732cacd 100644
--- a/zte/vmanager/driver/interfaces/urls.py
+++ b/zte/vmanager/driver/interfaces/urls.py
@@ -36,5 +36,6 @@ urlpatterns = [
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'^api/ztevnfmdriver/v1/vnfpkgs/(?P<packageId>[0-9a-zA-Z\-\_]+)/(?P<fileName>[0-9a-zA-Z\.\-\_]+)$', views.VnfPkg.as_view(), name='VnfPkg'),
+ url(r'^api/ztevnfmdriver/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/nfvo/info$', views.NfvoInfo.as_view(), name='NfvoInfo'),
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 fd99a92d..54325b39 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -681,3 +681,30 @@ class VnfPkg(APIView):
start, end = parse_file_range(local_file_path, file_range)
file_iterator = read(local_file_path, start, end)
return StreamingHttpResponse(file_iterator, status=status.HTTP_200_OK)
+
+
+class NfvoInfo(APIView):
+ def put(self, request, vnfmid):
+ logger.debug("====NfvoInfo put====%s", vnfmid)
+ req_data = {
+ "nfvoid": request.data.get("nfvoid", "1"),
+ "vnfmid": vnfmid,
+ "nfvourl": request.data.get("nfvourl", "http://127.0.0.1:80")
+ }
+ ret = get_vnfminfo_from_nslcm(vnfmid)
+ if ret[0] != 0:
+ raise Exception(ret[1])
+
+ vnfm_info = json.JSONDecoder().decode(ret[1])
+ logger.debug("[%s] vnfm_info=%s", fun_name(), vnfm_info)
+ ret = restcall.call_req(
+ base_url=ignorcase_get(vnfm_info, "url"),
+ user=ignorcase_get(vnfm_info, "userName"),
+ passwd=ignorcase_get(vnfm_info, "password"),
+ auth_type=restcall.rest_no_auth,
+ resource="v1/nfvo/info",
+ method='put',
+ content=json.dumps(req_data))
+ if ret[0] != 0:
+ raise Exception(ret[1])
+ logger.debug("update nfvo info successfully.")