diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-12-11 11:21:40 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-12-11 11:21:40 +0800 |
commit | e6bf504d43a082dc8b2282cabfc84a8e804beaa3 (patch) | |
tree | 291f349446f614da8161bf52e45060ff9215785b /zte/vmanager | |
parent | 74146bf9a2786ac9a9ca65c99e0589ceca42392d (diff) |
Optimize vfc-ztevnfmdriver scale/heal code
Change-Id: Ia83ab330fd2f3f4858e4bb7e18e2759850880ed1
Issue-ID: VFC-613
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'zte/vmanager')
-rw-r--r-- | zte/vmanager/driver/interfaces/views.py | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py index d4a98240..27983334 100644 --- a/zte/vmanager/driver/interfaces/views.py +++ b/zte/vmanager/driver/interfaces/views.py @@ -385,9 +385,6 @@ def notify(request, *args, **kwargs): return Response(data=None, status=ret[2]) -nf_scaling_url = '/v1/vnfs/{vnfInstanceID}/scale' - - @api_view(http_method_names=['POST']) def scale(request, *args, **kwargs): logger.info("====scale_vnf===") @@ -403,8 +400,6 @@ def scale(request, *args, **kwargs): scale_type = ignorcase_get(request.data, "type") aspect_id = ignorcase_get(request.data, "aspectId") number_of_steps = ignorcase_get(request.data, "numberOfSteps") - # extension = ignorcase_get(request.data, "additionalParam") - # vnfd_model = ignorcase_get(extension, "vnfdModel") data = { 'vnfmid': vnfm_id, 'nfvoid': 1, @@ -412,20 +407,14 @@ def scale(request, *args, **kwargs): 'vmlist': [{'VMNumber': number_of_steps, 'VMFlavor': aspect_id}], 'extension': '' } - ''' - for vdu_id in get_vdus(vnfd_model, aspect_id): - data['vmlist'].append({ - "VMFlavor": vdu_id, - "VMNumber": number_of_steps - }) - ''' + logger.info("data = %s", data) 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=nf_scaling_url.format(vnfInstanceID=nf_instance_id), + resource='/v1/vnfs/{vnfInstanceID}/scale'.format(vnfInstanceID=nf_instance_id), method='put', # POST content=json.JSONEncoder().encode(data)) logger.info("ret=%s", ret) @@ -440,9 +429,6 @@ def scale(request, *args, **kwargs): return Response(data=resp_data, status=ret[2]) -nf_healing_url = '/api/v1/nf_m_i/nfs/{vnfInstanceID}/vms/operation' - - @api_view(http_method_names=['POST']) def heal(request, *args, **kwargs): logger.info("====heal_vnf===") @@ -472,7 +458,7 @@ def heal(request, *args, **kwargs): user=ignorcase_get(vnfm_info, "userName"), passwd=ignorcase_get(vnfm_info, "password"), auth_type=restcall.rest_no_auth, - resource=nf_healing_url.format(vnfInstanceID=nf_instance_id), + resource='/api/v1/nf_m_i/nfs/{vnfInstanceID}/vms/operation'.format(vnfInstanceID=nf_instance_id), method='post', content=json.JSONEncoder().encode(data)) logger.info("ret=%s", ret) |