summaryrefslogtreecommitdiffstats
path: root/zte/vmanager
diff options
context:
space:
mode:
Diffstat (limited to 'zte/vmanager')
-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.")