diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-10-26 16:49:45 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-10-26 16:49:45 +0800 |
commit | 17430ed38d561a6da0d0b2b694728db092750d3c (patch) | |
tree | fde8a009ff5ba4977653545521719f79446823ca | |
parent | 1f363878b997f16d9ed2eb506431e400cf1089d5 (diff) |
Fix bugs for get vnfm from esr
Change-Id: If8dc4482885e2d8fad93f4896df1705858b06b85
Issue-Id: VFC-558
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/pub/msapi/extsys.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lcm/pub/msapi/extsys.py b/lcm/pub/msapi/extsys.py index 0d423b6d..1baed838 100644 --- a/lcm/pub/msapi/extsys.py +++ b/lcm/pub/msapi/extsys.py @@ -142,7 +142,7 @@ def convert_vnfm_info(vnfm_info_aai): def select_vnfm(vnfm_type, vim_id): - uri = "/external-system/esr-vnfm-list?depth=all" + uri = "/external-system/esr-vnfm-list" ret = call_aai(uri, "GET") if ret[0] > 0: logger.error("Failed to call %s: %s", uri, ret[1]) @@ -150,11 +150,9 @@ def select_vnfm(vnfm_type, vim_id): vnfms = json.JSONDecoder().decode(ret[1]) vnfms = ignore_case_get(vnfms, "esr-vnfm") for vnfm in vnfms: - esr_system_info = ignore_case_get(vnfm, "esr-system-info") - type = ignore_case_get(esr_system_info, "type") - vimId = vnfm["vnfm-id"] - if type == vnfm_type and vimId == vim_id: - # convert vnfm_info_aai to internal vnfm_info - vnfm = convert_vnfm_info(vnfm) - return vnfm + vnfm_info = get_vnfm_by_id(vnfm.get("vnfm-id")) + vnfmtype = ignore_case_get(vnfm_info, "type") + vimid = ignore_case_get(vnfm_info, "vimId") + if vnfmtype == vnfm_type and vimid == vim_id: + return vnfm_info raise NSLCMException('No vnfm found with %s in vim(%s)' % (vnfm_type, vim_id)) |