VMware Cloud Community
MHTX
Contributor
Contributor

VCD 10.5 API call to create OrgVDC Network

I'm trying to automate the provisioning of a network for a new Org VDC. 

In the VCD UI, I would go into a Tenant Org VDC, then open that in the tenant portal. From there, click on Networks, then New. The dialog box opens, I select 'Current Organizaton Virtual Data Center', then Network Type 'Imported' and 'NSX-T logical Switch'.  I select the logical switch I created for my customer, ie.  MikesWidget-LAN, give it a name and description and a gateway CIDR, then a static IP pool, and that's it. 

Using Postman, I know that I have to use the /api/admin/vdc/{orgVdcID}/networks call. 

Documentation here:   https://developer.vmware.com/apis/1703/doc/operations/POST-CreateOrgVdcNetwork.html

and input parameters here:  https://developer.vmware.com/apis/1703/doc//types/OrgVdcNetworkType.html

According to the documentation, only the ProviderInfo and the VimPortGroupRef are mandatory, but I just can't make this call work. The documenation in this case is just too vague. When it's looking for the VimPortGroupRef, VimServerRef, I assume it's looking for the Virtual Center we have connected? I have the MoRef for the network segment from vCenter, but it's giving me an error 403. 

Anyway, short version, does anybody have this particular call working and would be willing to share their parameters for the body and header with me?

Thanks!

Mike

 

 

Reply
0 Kudos
1 Reply
MHTX
Contributor
Contributor

Okay, so for reference in case anybody else is stuck with this, I was able to accomplish the task with the 'new' API:

POST /cloudapi/1.0.0/orgVdcNetworks

Normal Headers, ie. accept, x-cloud-authorization and Content-Type

Body:

{
    "name""123testCustomer-TestNW",
    "description""test network for 123 test customer",
    "subnets": {
        "values": [
            {
                "gateway""10.10.10.1",
                "prefixLength"24,
                "ipRanges": {
                    "values": [
                        {
                            "startAddress""10.10.10.10",
                            "endAddress""10.10.10.50"
                        }
                    ]
                },
                "enabled"true
            }
        ]
    },
    "backingNetworkId""9f1dd844-5e63-44e1-bbc5-fd4e83b041b5",
    "backingNetworkType""IMPORTED_T_LOGICAL_SWITCH",
    "parentNetworkId"null,
    "networkType""OPAQUE",
    "ownerRef": {
        "id""urn:vcloud:vdc:afbfc824-xxxx-xxxx-xxxx-0c9cb7eaf515"
    },
    "orgVdcIsNsxTBacked"true,
    "orgRef": {
        "name""123testCustomer",
        "id""urn:vcloud:org:d919e432-yyyy-yyyy-yyyy-1a1c3c135b08"
    },
    "shared"false,
    "enableDualSubnetNetwork"false
}
 
I have found the need to go back and forth between 'old' and 'new' API trees several times for VCD, what a frustration....
 
Regards,
Mike
Reply
0 Kudos