diff options
authorManuel Buil <mbuil@suse.com>2017-09-18 15:02:56 +0200
committerManuel Buil <mbuil@suse.com>2017-09-18 14:45:02 +0000
commite2e0a53027b9ec01b28af8d398cdce0750c08da8 (patch)
parent85aa735678433c40f8369781fba29af4dbbbd416 (diff)
Bug fix: allows searching vnfd_id based on name
It is currently impossible to obtain the vnfd_id based on the vnfd_name when we want to create the vnffg Change-Id: Ib7752156db43d76c24f8c6c2803eb7dbc5bbe1d8 Signed-off-by: Manuel Buil <mbuil@suse.com>
1 files changed, 6 insertions, 2 deletions
diff --git a/sfc/lib/openstack_tacker.py b/sfc/lib/openstack_tacker.py
index df112c3..93649e3 100644
--- a/sfc/lib/openstack_tacker.py
+++ b/sfc/lib/openstack_tacker.py
@@ -141,18 +141,22 @@ def create_vnf(tacker_client, vnf_name, vnfd_id=None,
with open(param_file) as f:
params = f.read()
vnf_body['vnf']['attributes']['param_values'] = params
if vnfd_id is not None:
vnf_body['vnf']['vnfd_id'] = vnfd_id
- if vim_id is not None:
- vnf_body['vnf']['vim_id'] = vim_id
if vnfd_name is None:
raise Exception('vnfd id or vnfd name is required')
vnf_body['vnf']['vnfd_id'] = get_vnfd_id(tacker_client, vnfd_name)
+ if vim_id is not None:
+ vnf_body['vnf']['vim_id'] = vim_id
+ else:
if vim_name is None:
raise Exception('vim id or vim name is required')
vnf_body['vnf']['vim_id'] = get_vim_id(tacker_client, vim_name)
return tacker_client.create_vnf(body=vnf_body)
except Exception, e:
logger.error("error [create_vnf(tacker_client,"
" '%s', '%s', '%s')]: %s"