Deploy a VI Workload Domain Using the VMware Cloud Foundation API

If you want to create a VI workload domain with more than one vSphere Distributed Switch (vDS) or use ESXi hosts with more than two pNICs, you must use the
VMware Cloud Foundation
API.
This procedure uses the
domainCreationSpec
to create a new VI workload domain using the
VMware Cloud Foundation
API. It focuses on two specific sections of the
domainCreationSpec
that allow you to create a VI workload domain with more than one vDS or use ESXi hosts with more than two pNICS;
hostSpecs
and
vdsSpecs
.
You will need to modify these sections and complete the other sections of the
domainCreationSpec
that are required for your environment. See the VMware Cloud Foundation API Reference Guide for details on all the sections of the
domainCreationSpec
. See an example of a complete
domainCreationSpec
at the end of this procedure.
The examples in the following procedure are based on the following scenario.
Two vSphere Distributed Switches
  • sfo-w01-cl01-vds01
  • sfo-w01-cl01-vds02
Four pNICs
  • vmnic0
  • vmnic1
  • vmnic2
  • vmnic3
pNIC to vDS mapping
  • vmnic0 and vmnic1 to sfo-w01-cl01-vds01
  • vmnic2 and vmnic3 to sfo-w01-cl01-vds02
vDS to traffic type mapping
  • sfo-w01-cl01-vds01: Management and vMotion
  • sfo-w01-cl01-vds02: vSAN, host overlay, and Edge uplinks
Modify the examples based on your
VMware Cloud Foundation
environment.
  1. Get the IDs for the ESXi hosts that you want to add to the VI workload domain.
    1. In the
      SDDC Manager UI
      , click
      Developer Center
      API Explorer
      .
    2. Expand the
      APIs for managing Hosts
      section, and click
      GET /v1/hosts
      .
    3. Enter
      UNASSIGNED_USEABLE
      in the status text box and click
      Execute
      .
    4. In the response, locate and copy the ID of each host you want to add to the VI workload domain.
  2. In a text editor, create a JSON specification for the
    hostSpecs
    . For example:
    "hostSpecs" : [ { "id" : "0ac30e66-7f65-4477-8331-80c3777c153c", "licenseKey": "
    XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    ", "username" : "root", "hostNetworkSpec" : { "vmNics" : [ { "id" : "vmnic0", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic1", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic2", "vdsName" : "sfo-w01-cl01-vds02" }, { "id" : "vmnic3", "vdsName" : "sfo-w01-cl01-vds02" } ] } },
    For each ESXi host, add a section that includes:
    • id
    • licenseKey
    • userName
    • hostNetworkSpec
    Use the ESXi host IDs from step 1.
  3. In a text editor, create a JSON specification for the
    vdsSpecs
    . For example:
    "vdsSpecs": [ { "name": "sfo-w01-cl01-vds01", "portGroupSpecs": [ { "name": "sfo01-w01-cl01-vds01-pg-mgmt", "transportType": "MANAGEMENT" }, { "name": "sfo01-w01-cl01-vds01-pg-vmotion", "transportType": "VMOTION" } ] }, { "name": "sfo-w01-cl01-vds02", "portGroupSpecs": [ { "name": "sfo01-w01-cl01-vds02-pg-vsan", "transportType": "VSAN" } ], "isUsedByNsxt": true }
    Specify
    "isUsedByNsxt": true
    for the vDS to use for host overlay traffic. If you have multiple vSphere Distributed Switches, only one of them can specify
    "isUsedByNsxt": true
    .
  4. In the
    SDDC Manager UI
    , click
    Developer Center
    API Explorer
    .
  5. Expand the
    APIs for managing Domains
    section, and click
    POST /v1/domains/validations
    .
  6. In the
    Description/Data Type
    column, click
    DomainCreationSpec
    .
    domainCreationSpec validation in the API Explorer
  7. Replace the
    hostSpecs
    section with the information from the hostSpecs JSON file.
  8. Replace the
    vdsSpecs
    section with the information from the vdsSpecs JSON file.
  9. Update or remove the other sections of the
    domainCreationSpec
    as needed, based on the VI workload domain you are creating.
    See an example of a complete
    domainCreationSpec
    at the end of this procedure.
  10. Click
    Execute
    to validate the
    domainCreationSpec
    .
    If validation succeeds, copy the domainCreationSpec content and proceed to the next step. If validation fails, check the errors in the response, update the domainCreationSpec, and validate it again.
  11. Expand the
    APIs for managing Domains
    section, and click
    POST /v1/domains
    .
  12. Paste the validated domainCreationSpec content and click
    Execute
    .
    Use the
    Tasks
    panel in the
    SDDC Manager UI
    to monitor the VI workload domain creation.
Example of a complete
domainCreationSpec
{ "domainName" : "sfo-w01", "vcenterSpec" : { "name" : "sfo-w01-vc01", "networkDetailsSpec" : { "ipAddress" : "10.0.0.43", "dnsName" : "sfo-w01-vc01.vrack.vsphere.local", "gateway" : "10.0.0.250", "subnetMask" : "255.255.255.0" }, "rootPassword" : "
<password>
", "datacenterName" : "sfo-w01-dc01", "vmSize" : "medium", "storageSize" : "lstorage" }, "computeSpec" : { "clusterSpecs" : [ { "name" : "sfo-w01-cl01", "hostSpecs" : [ { "id" : "0ac30e66-7f65-4477-8331-80c3777c153c", "licenseKey": "
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
", "username" : "root", "hostNetworkSpec" : { "vmNics" : [ { "id" : "vmnic0", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic1", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic2", "vdsName" : "sfo-w01-cl01-vds02" }, { "id" : "vmnic3", "vdsName" : "sfo-w01-cl01-vds02" } ] } }, { "id" : "05d1a8df-773a-46bb-8838-dcb5bb3358ea", "licenseKey": "
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
", "username" : "root", "hostNetworkSpec" : { "vmNics" : [ { "id" : "vmnic0", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic1", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic2", "vdsName" : "sfo-w01-cl01-vds02" }, { "id" : "vmnic3", "vdsName" : "sfo-w01-cl01-vds02" } ] } }, { "id" : "2b8b770f-265d-4a63-b830-9c98038c81b2", "licenseKey": "
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
", "username" : "root", "hostNetworkSpec" : { "vmNics" : [ { "id" : "vmnic0", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic1", "vdsName" : "sfo-w01-cl01-vds01" }, { "id" : "vmnic2", "vdsName" : "sfo-w01-cl01-vds02" }, { "id" : "vmnic3", "vdsName" : "sfo-w01-cl01-vds02" } ] } } ], "datastoreSpec" : { "vsanDatastoreSpec" : { "failuresToTolerate" : 1, "licenseKey" : "
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
", "datastoreName" : "sfo-w01-cl01-ds-vsan01" } }, "networkSpec" : { "vdsSpecs" : [ { "name" : "sfo-w01-cl01-vds01", "portGroupSpecs" : [ { "name" : "sfo-w01-cl01-vds01-pg-mgmt", "transportType" : "MANAGEMENT" }, { "name" : "sfo-w01-cl01-vds01-pg-vmotion", "transportType" : "VMOTION" }] }, { "name" : "sfo-w01-cl01-vds02", "portGroupSpecs" : [ { "name" : "sfo-w01-cl01-vds02-pg-vsan", "transportType" : "VSAN" } ], "isUsedByNsxt" : true } ], "nsxClusterSpec" : { "nsxTClusterSpec" : { "geneveVlanId" : 2, "ipAddressPoolSpec" : { "name" : "static-ip-pool-01", "subnets" : [ { "ipAddressPoolRanges" : [ { "start" : "10.0.11.50", "end" : "10.0.11.70" }, { "start" : "10.0.11.80", "end" : "10.0.11.150" } ], "cidr" : "10.0.11.0/24", "gateway" : "10.0.11.250" } ] } } } } } ] }, "nsxTSpec" : { "nsxManagerSpecs" : [ { "name" : "sfo-w01-nsx01a", "networkDetailsSpec" : { "ipAddress" : "10.0.0.44", "dnsName" : "sfo-w01-nsx01a.vrack.vsphere.local", "gateway" : "10.0.0.250", "subnetMask" : "255.255.255.0" } }, { "name" : "sfo-w01-nsx01b", "networkDetailsSpec" : { "ipAddress" : "10.0.0.45", "dnsName" : "sfo-w01-nsx01b.vrack.vsphere.local", "gateway" : "10.0.0.250", "subnetMask" : "255.255.255.0" } }, { "name" : "sfo-w01-nsx01c", "networkDetailsSpec" : { "ipAddress" : "10.0.0.46", "dnsName" : "sfo-w01-nsx01c.vrack.vsphere.local", "gateway" : "10.0.0.250", "subnetMask" : "255.255.255.0" } } ], "vip" : "10.0.0.166", "vipFqdn" : "sfo-w01-nsx01.vrack.vsphere.local", "licenseKey" : "
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
", "nsxManagerAdminPassword" : "
<password>
", "formFactor" : "large" } }