- mbps_=("'"+str(iface['Mbps_used'])+"'") if 'Mbps_used' in iface and iface['Mbps_used'] is not None else "Mbps"
- if iface["dedicated"]=="yes":
- iface_model="PF"
- elif iface["dedicated"]=="yes:sriov":
- iface_model="VFnotShared"
- elif iface["dedicated"]=="no":
- iface_model="VF"
- #else error
- INSERT=(iface['mac_address'], iface['switch_port'], iface.get('vlan',None), 'instance:data', iface['Mbps_used'], iface['id'],
- uuid, instance_dict['tenant_id'], iface.get('name',None), iface.get('vpci',None), iface.get('uuid',None), iface_model )
- cmd = "INSERT INTO ports (mac,switch_port,vlan,type,Mbps,uuid,instance_id,tenant_id,name,vpci,net_id, model) " + \
- " VALUES (" + ",".join(map(lambda x: 'Null' if x is None else "'"+str(x)+"'", INSERT )) + ")"
+ mbps_ = ("'" + str(iface['Mbps_used']) + "'") if 'Mbps_used' in iface and \
+ iface['Mbps_used'] is not None \
+ else "Mbps"
+ if iface["dedicated"] == "yes":
+ iface_model = "PF"
+ elif iface["dedicated"] == "yes:sriov":
+ iface_model = "VFnotShared"
+ elif iface["dedicated"] == "no":
+ iface_model = "VF"
+ # else error
+ INSERT = (iface['mac_address'], iface['switch_port'], iface.get('vlan'),
+ 'instance:data', iface['Mbps_used'], iface['id'], uuid,
+ instance_dict['tenant_id'], iface.get('name'), iface.get('vpci'),
+ iface.get('uuid'), iface_model)
+ cmd = "INSERT INTO ports (mac,switch_port,vlan,type,Mbps,uuid,instance_id,tenant_id," \
+ "name,vpci,net_id, model) VALUES (" + \
+ ",".join(map(lambda x: 'Null' if x is None else "'" + str(x) + "'", INSERT)) + ")"