'Create a floating IP and associates to a resource/port on Neutron'

def create_floating_ip(self, thing, external_network_id=None, port_id=None, client=None):

    if (not external_network_id):
        external_network_id = CONF.network.public_network_id
    if (not client):
        client = self.floating_ips_client
    if (not port_id):
        (port_id, ip4) = self._get_server_port_id_and_ip4(thing)
    else:
        ip4 = None
    result = client.create_floatingip(floating_network_id=external_network_id, port_id=port_id, tenant_id=thing['tenant_id'], fixed_ip_address=ip4)
    floating_ip = result['floatingip']
    self.addCleanup(test_utils.call_and_ignore_notfound_exc, client.delete_floatingip, floating_ip['id'])
    return floating_ip
