+ def summarize_deployment_status(status_dict):
+ #Nets
+ summary = ""
+ n_nets = 0
+ status_nets = {}
+ net_list = status_dict['nets']
+ for net in net_list:
+ n_nets += 1
+ if net['status'] not in status_nets:
+ status_nets[net['status']] = 1
+ else:
+ status_nets[net['status']] +=1
+ message = "Nets: "
+ for k,v in status_nets.items():
+ message += "{}:{},".format(k,v)
+ message += "TOTAL:{}".format(n_nets)
+ summary += "{}".format(message)
+ #VMs and VNFs
+ n_vms = 0
+ status_vms = {}
+ status_vnfs = {}
+ vnf_list = status_dict['vnfs']
+ for vnf in vnf_list:
+ member_vnf_index = vnf['member_vnf_index']
+ if member_vnf_index not in status_vnfs:
+ status_vnfs[member_vnf_index] = {}
+ for vm in vnf['vms']:
+ n_vms += 1
+ if vm['status'] not in status_vms:
+ status_vms[vm['status']] = 1
+ else:
+ status_vms[vm['status']] +=1
+ if vm['status'] not in status_vnfs[member_vnf_index]:
+ status_vnfs[member_vnf_index][vm['status']] = 1
+ else:
+ status_vnfs[member_vnf_index][vm['status']] += 1
+ message = "VMs: "
+ for k,v in status_vms.items():
+ message += "{}:{},".format(k,v)
+ message += "TOTAL:{}".format(n_vms)
+ summary += "\n{}".format(message)
+ summary += "\nNFs:"
+ for k,v in status_vnfs.items():
+ total = 0
+ message = "\n {} VMs: ".format(k)
+ for k2,v2 in v.items():
+ message += "{}:{},".format(k2,v2)
+ total += v2
+ message += "TOTAL:{}".format(total)
+ summary += message
+ return summary
+
+ def summarize_config_status(ee_list):
+ n_ee = 0
+ status_ee = {}
+ for ee in ee_list:
+ n_ee += 1
+ if ee['elementType'] not in status_ee:
+ status_ee[ee['elementType']] = {}
+ status_ee[ee['elementType']][ee['status']] = 1
+ continue;
+ if ee['status'] in status_ee[ee['elementType']]:
+ status_ee[ee['elementType']][ee['status']] += 1
+ else:
+ status_ee[ee['elementType']][ee['status']] = 1
+ summary = ""
+ for elementType in ["KDU", "VDU", "PDU", "VNF", "NS"]:
+ if elementType in status_ee:
+ message = ""
+ total = 0
+ for k,v in status_ee[elementType].items():
+ message += "{}:{},".format(k,v)
+ total += v
+ message += "TOTAL:{}\n".format(total)
+ summary += "{}: {}".format(elementType, message)
+ summary += "TOTAL Exec. Env.: {}".format(n_ee)
+ return summary