You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Raj <ra...@apache.org> on 2014/11/13 15:12:11 UTC

How to do it with 1.8.1 neutron API?

Hi all,

I have a complicated requirement. Please help me to find a way to do it.

My environment is openstack with neutron.

When I create an instance using Jclouds, the instance should automatically
get the following;

   - a private IP from the network "netOne" to eth0
   - a private IP from the network "netTwo" to eth1
   - a private IP from the network "netThree" to eth2
   - a floating IP from the external network "externalOne" to interface eth1
   - a floating IP from the external network "externalTwo" to interface eth1
   - a floating IP from the external network "externalThree" to interface
   eth2


"networkInterfaces":[ { "name":"netOne", "networkUuid":"
84d52a6d-a9e5-472a-9935-a0e195fe5b4a",
}, { "name":"netTwo", "networkUuid":"512e1f54-1e85-4dac-b2e6-f0b30fc552cf",
"publicNetworkUuids":[ { "name":"externalOne", "networkUuid":"
8f08a69d-cb46-43c9-9ebe-b89dcc78dacc", }, { "name":"externalTwo", "
networkUuid":"b5504321-e7aa-4500-9e00-7bc1b10cb5e9", } ] }, { "name":"
netThree", "networkUuid":"b55f009a-1cc6-4b17-924f-4ae0ee18db5e", "
publicNetworkUuids":[ { "name":"externalThree", "networkUuid":"
83d52a6d-a9e5-572a-9935-a0e195fe5b4r", } ] } ],

And I know we can build a template with set of nova networks and each
instance will get private IPs per nova network.

            Set<Network> novaNetworksSet = new
LinkedHashSet<Network>(iaasInfo.getNetworkInterfaces().length);
            for (NetworkInterface ni:iaasInfo.getNetworkInterfaces()) {

novaNetworksSet.add(Network.builder().networkUuid(ni.getNetworkUuid()).fixedIp(ni.getFixedIp())
                        .portUuid(ni.getPortUuid()).build());
            }

template.getOptions().as(NovaTemplateOptions.class).novaNetworks(novaNetworksSet);

I guess this is only for nova networks.

How can I do it for neutron networks? That is how can I build a template
with set of neutron networks? Even if I am able to do so, that solves only
a part of my requirement.

According to my requirement, I would also like to assign floating IPs from
different external networks to specific interface (eth0, eth1 etc) in my
instance.

Appreciate your help on this.

Thanks.

-- 
Rajkumar Rajaratnam
Committer & PMC Member, Apache Stratos
Software Engineer, WSO2