'Add a floating IP address to a server.'

def handle_create(self):

    if self.properties[self.EIP]:
        server = self.client().servers.get(self.properties[self.INSTANCE_ID])
        server.add_floating_ip(self.properties[self.EIP])
        self.resource_id_set(self.properties[self.EIP])
        LOG.debug('ElasticIpAssociation    %(instance)s.add_floating_ip(%(eip)s)', {'instance': self.properties[self.INSTANCE_ID], 'eip': self.properties[self.EIP]})
    elif self.properties[self.ALLOCATION_ID]:
        ni_id = self.properties[self.NETWORK_INTERFACE_ID]
        instance_id = self.properties[self.INSTANCE_ID]
        (port_id, port_rsrc) = self._get_port_info(ni_id, instance_id)
        if ((not port_id) or (not port_rsrc)):
            LOG.warning('Skipping    association,    resource    not    specified')
            return
        float_id = self.properties[self.ALLOCATION_ID]
        network_id = port_rsrc['network_id']
        self._neutron_add_gateway_router(float_id, network_id)
        self._neutron_update_floating_ip(float_id, port_id)
        self.resource_id_set(float_id)
