X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2FROclient.py;h=18425ac0de6f4ab7c892c2fbc356f35dcdc0ecae;hb=9f9c6f2e8b8e978deaa4fb6e1482c0656ce4bd45;hp=d79a88bbcc14c6d9a2c11880e7739d95d51d9434;hpb=e37b57db4c684af66b004365c19921363be7c9ab;p=osm%2FLCM.git diff --git a/osm_lcm/ROclient.py b/osm_lcm/ROclient.py index d79a88b..18425ac 100644 --- a/osm_lcm/ROclient.py +++ b/osm_lcm/ROclient.py @@ -285,17 +285,33 @@ class ROClient: net_done = 0 vm_done = 0 + def _get_ref(desc): # return an identification for the network or vm. Try vim_id if exist, if not descriptor id + # for net + if desc.get("vim_net_id"): + return "'vim-id={}'".format(desc["vim_net_id"]) + elif desc.get("ns_net_osm_id"): + return "'nsd-vld-id={}'".format(desc["ns_net_osm_id"]) + elif desc.get("vnf_net_osm_id"): + return "'vnfd-vld-id={}'".format(desc["vnf_net_osm_id"]) + # for VM + elif desc.get("vim_vm_id"): + return "'vim-id={}'".format(desc["vim_vm_id"]) + elif desc.get("vdu_osm_id"): + return "'vnfd-vdu-id={}'".format(desc["vdu_osm_id"]) + else: + return "" + for net in ns_descriptor["nets"]: net_total += 1 if net["status"] in ("ERROR", "VIM_ERROR"): - return "ERROR", net["error_msg"] + return "ERROR", "VIM network ({}) on error: {}".format(_get_ref(net), net["error_msg"]) elif net["status"] == "ACTIVE": net_done += 1 for vnf in ns_descriptor["vnfs"]: for vm in vnf["vms"]: vm_total += 1 if vm["status"] in ("ERROR", "VIM_ERROR"): - return "ERROR", vm["error_msg"] + return "ERROR", "VIM VM ({}) on error: {}".format(_get_ref(vm), vm["error_msg"]) elif vm["status"] == "ACTIVE": vm_done += 1 @@ -319,7 +335,7 @@ class ROClient: other_done = 0 for vim_action_set in action_descriptor["actions"]: - for vim_action in vim_action_set["vim_actions"]: + for vim_action in vim_action_set["vim_wim_actions"]: if vim_action["item"] == "instance_vms": vm_total += 1 elif vim_action["item"] == "instance_nets": @@ -328,7 +344,7 @@ class ROClient: other_total += 1 if vim_action["status"] == "FAILED": return "ERROR", vim_action["error_msg"] - elif vim_action["status"] in ("DONE", "SUPERSEDED"): + elif vim_action["status"] in ("DONE", "SUPERSEDED", "FINISHED"): if vim_action["item"] == "instance_vms": vm_done += 1 elif vim_action["item"] == "instance_nets": @@ -617,7 +633,7 @@ class ROClient: for word in str(response_text).split(" "): if "." in word: version_text, _, _ = word.partition("-") - return list(map(int, version_text.split("."))) + return version_text raise ROClientException("Got invalid version text: '{}'".format(response_text), http_code=500) except aiohttp.errors.ClientOSError as e: raise ROClientException(e, http_code=504)