VMware Cloud Community
jherry
Contributor
Contributor

Instanciate vApp with internal network thru vCloud API

I would like to instanciate a template with an internal network using the vCloud API. Here is the params:

    <ns2:InstantiationParams>
        <ns2:NetworkConfigSection>
            <ns1:Info/>
            <ns2:NetworkConfig networkName="vApp internal network">
                <ns2:Configuration>
                    <ns2:FenceMode>isolated</ns2:FenceMode>
                </ns2:Configuration>
            </ns2:NetworkConfig>
            <ns2:NetworkConfig networkName="vApp external network">
                <ns2:Configuration>
                    <ns2:ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="network_external_bridged" href="https://**.**.**.**/api/v1.0/network/1901611631"/>
                    <ns2:FenceMode>bridged</ns2:FenceMode>
                </ns2:Configuration>
            </ns2:NetworkConfig>
        </ns2:NetworkConfigSection>
    </ns2:InstantiationParams>
    <ns2:Source type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="http://**.**.**.**/api/v1.0/vAppTemplate/567810271"/>
</ns2:InstantiateVAppTemplateParams>

It returns an error because parentNetwork is not set. I also tried without the NetworkConfig section for this network, also without Configuration tag, but vCloud Director want an existing network...

Fine, but how to create one through vCloud API? I'm not administrator (and I can do it through the portal)!

Thank you for your help

0 Kudos
10 Replies
srmdocs
VMware Employee
VMware Employee

http://pubs.vmware.com/vcloud-api-1/vCloud_API_Guide_Admin.8.7.html explains how to use the API to create an OrgNetwork, but you have to be an Org admin to do it.

0 Kudos
jake_robinson_b
Hot Shot
Hot Shot

The first thing I would do is validate your XML against the XSD on this site: http://tools.decisionsoft.com/schemaValidate/

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
0 Kudos
jherry
Contributor
Contributor

So you are telling me that I cannot create an isolated network for my vApp through the vCloud API when I can do it on the portal?

0 Kudos
srmdocs
VMware Employee
VMware Employee

Looks like I misunderstood your question. I believe you can create an isolated vApp network (which is what I think you're asking)

by eliminating the NetworkConfig Section from the InstantiationParams.

0 Kudos
jherry
Contributor
Contributor

Yes this is what I am asking.

If I eliminate the NetworkConfig tag from InstantiationParams, e.g. I do not map the logical network to anything, then vCloud Director return an error: The VCD entity network "vApp internal network" specified for VM "app23" does not exist.

Any other solution?

0 Kudos
srmdocs
VMware Employee
VMware Employee

You need to create a vApp network named "vApp internal network"

Try somethng like this:

<InstantiationParams>
      <NetworkConfigSection>
         <ovf:Info>Configuration parameters for logical networks
         </ovf:Info>
         <NetworkConfig
            networkName="vApp internal network">
            <Configuration>
               <ParentNetwork
                  href="some-network-in-this-vDC"></ParentNetwork>
               <FenceMode>isolated</FenceMode>
            </Configuration>
         </NetworkConfig>
      </NetworkConfigSection>
   </InstantiationParams>
0 Kudos
jherry
Contributor
Contributor

I am the admin of my organisation but I cannot create network because I am not the system admin.

The thing is that I can have an isolated network through the portal, I guess the portal is creating a network for me.

To be precise, it's not the instanciation of a vApp template but a composition of VM.

Maybe, it's just a problem of grant access to network creation?

0 Kudos
srmdocs
VMware Employee
VMware Employee

It's hard to say not knowing all the details, but you should be able to do this (supply instantiation params)

on composition as well. Creating  a vApp network during instantiaiton should not require sys admin privileges, since you're

just connecting to an existing network (or creating an isolated network form exsiting resources). The API does not

curently match the portal's features exactly, but I believe that this should work for you in the API  if it works in the portal.

0 Kudos
jherry
Contributor
Contributor

I finnally solved my problem.

When you want to create an isolated network, you set the parent network to nothing (don't set it). If so, you need to set an ipscope like the following:

            <NetworkConfig networkName="vApp internal network">

                <Description>Connection for vApp internal network</Description>

                <Configuration>

                    <IpScope>

                        <IsInherited>false</IsInherited>

                        <Gateway>192.168.1.1</Gateway>

                        <Netmask>255.255.255.0</Netmask>

                        <Dns1>0.0.0.0</Dns1>

                        <Dns2>0.0.0.0</Dns2>

                        <IpRanges>

                            <IpRange>

                              <StartAddress>192.168.1.2</StartAddress>

                              <EndAddress>192.168.1.254</EndAddress>

                            </IpRange>

                        </IpRanges>

                    </IpScope>

                    <FenceMode>isolated</FenceMode>

                </Configuration>

            </NetworkConfig>

The thing is that if you forget to set DNS for exemple, you will only get an internal error without explanation.

Thank you for your help.

0 Kudos
srmdocs
VMware Employee
VMware Employee

Thanks. I'll update to doc to clarify this, and will see what we can do about the error rmessage.

0 Kudos