Create an External Network

An external network is a reference to a portgroup on a vCenter server attached to VMware Cloud Director. To create an external network, a system administrator must specify the vCenter server and a portgroup associated with it. External networks provide support for bridged organization networks.

Only a system administrator can create an external network. A system administrator can modify an external network to change properties such as its description, and to add or remove portgroups in the VimPortGroupRefs element. An organization administrator can retrieve a read-only representation of an external network to examine its properties.

Prerequisites

Procedure

  1. Retrieve the XML representation of the vSphere platform extensions.
    Use a request like this one.
    GET https://vcloud.example.com/api/admin/extension
  2. Examine the response to locate the Link element that contains the URL for adding external networks to the cloud.
    This element has a rel attribute value of add and a type attribute value of application/vnd.vmware.admin.vmwexternalnet+xml, as shown here:
    <Link
       type="application/vnd.vmware.admin.vmwexternalnet+xml"
       rel="add"
       href="https://vcloud.example.com/api/admin/extension/externalnets"/>
  3. Choose a vCenter server to provide a portgroup for the network.
  4. Create a VMWExternalNetwork element that specifies the properties of the external network.
    These properties include the portgroup you specified in Step 3.
  5. POST the VMWExternalNetwork element you created in Step 4 to the URL described in Step 2.
    See the request portion of Create an External Network.

Results

The server creates the external network and returns a VMWExternalNetwork element that includes the contents you POSTed, along with a set of Link elements that you can use to access, remove, disable, or modify it. A reference to the new external network is added to the VMWExternalNetworkReferences element of the VCloud. The portgroup you specified is removed from the VimObjectRefList of the vCenter server.

Example: Create an External Network

This request creates an external network backed by one of the portgroups listed in the response portion of Retrieve a List of Available Portgroups and Switches from a vCenter Server.

Request:
POST https://vcloud.example.com/api/admin/extension/externalnets
Content-Type: application/vnd.vmware.admin.vmwexternalnet+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<vmext:VMWExternalNetwork
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
   name="example-extnet"
   type="application/vnd.vmware.admin.vmwexternalnet+xml">
   <vcloud:Description>ExternalNet</vcloud:Description>
   <vcloud:Configuration>
      <vcloud:IpScopes>
         <vcloud:IpScope>
            <vcloud:IsInherited>false</vcloud:IsInherited>
            <vcloud:Gateway>10.24.64.126</vcloud:Gateway>
            <vcloud:Netmask>255.255.255.192</vcloud:Netmask>
            <vcloud:Dns1>10.115.120.71</vcloud:Dns1>
            <vcloud:Dns2>10.6.64.29</vcloud:Dns2>
            <vcloud:DnsSuffix>example.com</vcloud:DnsSuffix>
            <vcloud:IpRanges>
               <vcloud:IpRange>
               <vcloud:StartAddress>Start IP Address</vcloud:StartAddress>
               <vcloud:EndAddress>End IP Address</vcloud:EndAddress>
               </vcloud:IpRange>
            </vcloud:IpRanges>
         </vcloud:IpScope>
      </vcloud:IpScopes>
      <vcloud:FenceMode>isolated</vcloud:FenceMode>
   </vcloud:Configuration>
   <vmext:VimPortGroupRefs>
      <vmext:VimObjectRef>
         <vmext:VimServerRef
            href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
         <vmext:MoRef>dvportgroup-175</vmext:MoRef>
         <vmext:VimObjectType>DV_PORTGROUP</vmext:VimObjectType>
      </vmext:VimObjectRef>
   </vmext:VimPortGroupRefs>
</vmext:VMWExternalNetwork>

You can specify more than one VimObjectRef in the VimPortGroupRefs as long as each VimObjectRef references a portgroup on a different vCenter Server registered to the system and all referenced objects have the same VimObjectType (DV_PORTGROUP or NETWORK).

The response includes a Task that tracks the creation of the network, and a set of Link elements that you can use to operate on or modify it.

Response:
201 Created
Content-Type: application/vnd.vmware.admin/vmwexternalnet+xml
...
<vmext:VMWExternalNetwork
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
   name="example-extnet"
   id="urn:vcloud:network:85"
   type="application/vnd.vmware.admin.vmwexternalnet+xml"
   href="https://vcloud.example.com/api/admin/extension/externalnet/85"... >
   <vcloud:Link
      rel="alternate"
      type="application/vnd.vmware.admin.network+xml"
      href="https://vcloud.example.com/api/admin/network/85" />
   <vcloud:Link
      rel="edit"
      type="application/vnd.vmware.admin.vmwexternalnet+xml"
      href="https://vcloud.example.com/api/admin/extension/externalnet/85" />
   <vcloud:Link
      rel="remove"
      href="https://vcloud.example.com/api/admin/extension/externalnet/85" />
   <vcloud:Link
      rel="up"
      type="application/vnd.vmware.admin.vmwExternalNetworkReferences+xml"
      href="https://vcloud.example.com/api/admin/extension/externalNetworkReferences" />
   <vcloud:Link
      rel="repair"
      type="application/vnd.vmware.admin.network+xml"
      href="https://vcloud.example.com/api/admin/network/85/action/reset" />
   <vcloud:Description>ExternalNet</vcloud:Description>
   <vcloud:Tasks>
      <vcloud:Task
         status="running"
         startTime="2011-03-10T06:08:31.506-08:00"
         operationName="_network_create_provider_network"
         operation="Busy Network example-extnet(85)" ... >
         ...
       </vcloud:Task>
   </vcloud:Tasks>
   ...
</vmext:VMWExternalNetwork>