I am not sure associating a floating IP to a specific port/interface (as opposed to an instance) is possible with nova. I am pretty sure it is possible with neutron, but all the nova examples I have seen associate a floating ip and an instance. In fact, if you check what gets passed to the service with addToServer, you will see that an IP address gets associated to an instance.
On the other hand, if you use neutron instead, I think you might be able to use RouterApi.addInterfaceForPort where you can associate the floatingIP ID of your floatingIP to the right port with the fixed ip of the instance. ________________________________ From: Udara Liyanage [udaraliyan...@gmail.com] Sent: Thursday, September 11, 2014 1:57 AM To: user@jclouds.apache.org Subject: Re: How to get reference to FloatingIpAPI in Neutron Hi, Thanks for the help. In my Openstack setup there are two networks. When creating the instance I specify both networks so instance get private ips from both networks. 1. Set<String> novaNetworksSet = new LinkedHashSet<String>(2); 2. 3. novaNetworksSet.add("uuid_of_network1"); 4. novaNetworksSet.add("uuid_of_network2"); 5. template.getOptions().as(NovaTemplateOptions.class).networks(novaNetworksSet); Creating floating Ips. privateIp1 and privateIp2 refers to the two private IPs allocated for the instance 1. FloatingIP publicIP1 = FloatingIP.builder().instanceId(instanceId). 2. fixedIp(privateIp1). 3. id("927b976e-0666-4039-9c38-df5b8366cce4"). 4. ip("192.168.16.66"). 5. instanceId("231c1871-0b54-4af6-afe6-c868b44c2307"). 6. build(); 7. 8. FloatingIP publicIP2 = FloatingIP.builder().instanceId(instanceId). 9. fixedIp(privateIp2). 10. id("2de964d3-1e6b-45fc-b870-55b82cc21ab1").ip("192.168.16.64"). 11. instanceId("231c1871-0b54-4af6-afe6-c868b44c2307"). 12. build(); The problem is both floatingIpApi.addToServer(publicIP1.getIp(), node.getProviderId()) and floatingIpApi.addToServer(publicIP2.getIp(), node.getProviderId()) associates the floating ip for the same interface. Still I am unable to allocate the floatingIp to the specified network interface. On Wed, Sep 10, 2014 at 1:07 PM, Ambadas Ramanna Adam <ambadas_ada...@infosys.com<mailto:ambadas_ada...@infosys.com>> wrote: Hi Udara, As per [1], you were asking for REST APIs. If you want to use REST APIs, then Dave’s answer seems correct, though haven’t used it. If you are using JClouds API and want to associate a floating IP to a server with multiple nics, then, you will have to use the fixed IP associated with that nic. Ex. FloatingIP _publicIP = FloatingIP.Builder().instanceId(_instanceID).fixedIp(_fixedPrivateIP).pool(_publicIPPoolName).build(); Regards, Ambadas Ramanna Adam From: Udara Liyanage [mailto:udaraliyan...@gmail.com<mailto:udaraliyan...@gmail.com>] Sent: Wednesday, September 10, 2014 12:39 PM To: user@jclouds.apache.org<mailto:user@jclouds.apache.org> Subject: Re: How to get reference to FloatingIpAPI in Neutron Hi Ambadas, I think I am bit confused here. Please refer to my requirement on [1]. There I was suggested to use Openstack Neutron API to associate floating IPs by specifying port information. Shouldn't I use Jclouds Neutron in this case to create floating ip s. [1] http://stackoverflow.com/questions/25637605/openstack-neutron-specify-a-network-interface-when-associating-a-floating-ip On Wed, Sep 10, 2014 at 12:21 PM, Ambadas Ramanna Adam <ambadas_ada...@infosys.com<mailto:ambadas_ada...@infosys.com>> wrote: Hi Udara, JClouds has FloatingIPApi in package org.jclouds.openstack.nova.v2_0.extensions. You can get hold of FloatingIPApi (not FloatingIpAPI, mind the p in IP!) like below. com.google.common.base.Optional<? extends FloatingIPApi> NovaApi.getFloatingIPExtensionForZone(String zone) Hope this helps. regards, Ambadas Ramanna Adam From: Udara Liyanage [mailto:udaraliyan...@gmail.com<mailto:udaraliyan...@gmail.com>] Sent: Wednesday, September 10, 2014 12:07 PM To: user@jclouds.apache.org<mailto:user@jclouds.apache.org> Subject: How to get reference to FloatingIpAPI in Neutron Hi, I was able to get reference to PortAPI and NetworkAPi, but not to FloatingIpAPI. Any help is appriciated. neutronApi = ContextBuilder.newBuilder(provider) .credentials(identity, password) .endpoint(endpoint) .modules(modules) .buildApi(NeutronApi.class); I am using Jclouds 1.8.0 version. -- Udara S.S Liyanage. Software Engineer at WSO2. Commiter and PPMC Member of Apache Stratos. Blog - http://udaraliyanage.wordpress.com<http://udaraliyanage.wordpress.com/> phone: +94 71 443 6897<tel:%2B94%2071%20443%206897> **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** -- Udara S.S Liyanage. Software Engineer at WSO2. Commiter and PPMC Member of Apache Stratos. Blog - http://udaraliyanage.wordpress.com<http://udaraliyanage.wordpress.com/> phone: +94 71 443 6897<tel:%2B94%2071%20443%206897> -- Udara S.S Liyanage. Software Engineer at WSO2. Commiter and PPMC Member of Apache Stratos. Blog - http://udaraliyanage.wordpress.com<http://udaraliyanage.wordpress.com/> phone: +94 71 443 6897