#NEWLINE# def normalize_neutron_floating_ips( ips ) : #NEWLINE# #INDENT# 'Normalize the structure of Neutron floating IPs\n\n    Unfortunately, not all the Neutron floating_ip attributes are available\n    with Nova and not all Nova floating_ip attributes are available with\n    Neutron.\n    This function extract attributes that are common to Nova and Neutron\n    floating IP resource.\n    If the whole structure is needed inside shade, shade provides private\n    methods that returns "original" objects (e.g.\n    _neutron_allocate_floating_ip)\n\n    :param list ips: A list of Neutron floating IPs.\n\n    :returns:\n        A list of normalized dicts with the following attributes::\n\n        [\n          {\n            "id": "this-is-a-floating-ip-id",\n            "fixed_ip_address": "192.0.2.10",\n            "floating_ip_address": "198.51.100.10",\n            "network": "this-is-a-net-or-pool-id",\n            "attached": True,\n            "status": "ACTIVE"\n          }, ...\n        ]\n\n    ' #NEWLINE# ret = [ ] #NEWLINE# for ip in ips : #NEWLINE# #INDENT# network_id = ip . get ( 'floating_network_id' , ip . get ( 'network' ) ) #NEWLINE# ret . append ( dict ( id = ip [ 'id' ] , fixed_ip_address = ip . get ( 'fixed_ip_address' ) , floating_ip_address = ip [ 'floating_ip_address' ] , network = network_id , floating_network_id = network_id , port_id = ip . get ( 'port_id' ) , router_id = ip . get ( 'router_id' ) , attached = ( ( ip . get ( 'port_id' ) is not None ) and ( ip . get ( 'port_id' ) != '' ) ) , status = ip [ 'status' ] ) ) #NEWLINE# #UNINDENT# return meta . obj_list_to_dict ( ret )