diff options
author | Manuel Buil <mbuil@suse.com> | 2017-09-18 15:02:56 +0200 |
---|---|---|
committer | Brady Johnson <bjohnson@inocybe.com> | 2017-09-18 14:46:29 +0000 |
commit | 2aa0c27a5d4b0b0d31a9cc0c9dc07321538860f0 (patch) | |
tree | f1686e9f12be35edc99039cd01bb0c7caa259666 | |
parent | 40344ff1e6a616a97cd1eb2afcc767699a576dc1 (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>
-rw-r--r-- | sfc/lib/openstack_tacker.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sfc/lib/openstack_tacker.py b/sfc/lib/openstack_tacker.py index df112c39..93649e32 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 else: 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" |