X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_ro%2Fnfvo_db.py;h=055699e410fcbfaaa76ced6350dc354762785724;hb=41a6981cd96a7e4ae15e881bc868873fbfaa3937;hp=87e3f1e15da3c1162cf2959b84fbb272ee9d611c;hpb=69b590eb0469efa021bada0d2bf867bbdff27a10;p=osm%2FRO.git diff --git a/osm_ro/nfvo_db.py b/osm_ro/nfvo_db.py index 87e3f1e1..055699e4 100644 --- a/osm_ro/nfvo_db.py +++ b/osm_ro/nfvo_db.py @@ -598,14 +598,14 @@ class nfvo_db(db_base.db_base): vnf['mgmt_access'] = yaml.load(mgmt_access_dict[0]['mgmt_access']) else: vnf['mgmt_access'] = None - #sce_interfaces + # sce_interfaces cmd = "SELECT scei.uuid,scei.sce_net_id,scei.interface_id,i.external_name,scei.ip_address"\ " FROM sce_interfaces as scei join interfaces as i on scei.interface_id=i.uuid"\ " WHERE scei.sce_vnf_id='{}' ORDER BY scei.created_at".format(vnf['uuid']) self.logger.debug(cmd) self.cur.execute(cmd) vnf['interfaces'] = self.cur.fetchall() - #vms + # vms cmd = "SELECT vms.uuid as uuid, flavor_id, image_id, vms.name as name," \ " vms.description as description, vms.boot_data as boot_data, count," \ " vms.availability_zone as availability_zone" \ @@ -643,9 +643,14 @@ class nfvo_db(db_base.db_base): self.logger.debug(cmd) self.cur.execute(cmd) vm['interfaces'] = self.cur.fetchall() - for index in range(0,len(vm['interfaces'])): - vm['interfaces'][index]['port-security'] = vm['interfaces'][index].pop("port_security") - vm['interfaces'][index]['floating-ip'] = vm['interfaces'][index].pop("floating_ip") + for iface in vm['interfaces']: + iface['port-security'] = iface.pop("port_security") + iface['floating-ip'] = iface.pop("floating_ip") + for sce_interface in vnf["interfaces"]: + if sce_interface["interface_id"] == iface["uuid"]: + if sce_interface["ip_address"]: + iface["ip_address"] = sce_interface["ip_address"] + break #nets every net of a vms cmd = "SELECT uuid,name,type,description FROM nets WHERE vnf_id='{}'".format(vnf['vnf_id']) self.logger.debug(cmd)