VCF Automation Blog

from Stefan Schnell

The vCenter simulator (vcsim) contains a vSphere Web Services (SOAP) SDK endpoint. This is intended for testing consumers of the Web Service API. It can be used by any language that can talk to the vSphere Web Service API. This post describes how to install and test it on the one hand with VMware PowerCLI and on the other hand with VMware pyVmomi.

Installation and Testing VMware vCenter and ESXi API Simulator with PowerCLI and pyVmomi


PowerCLI is a command-line and scripting tool built on PowerShell, to manage and automate VMware infrastructure. pyVmomi is the Python SDK for the VMware vSphere Web Service API that allows you to manage ESX, ESXi, and vCenter. On this way an independent local test environment can be implemented.

Hint: vCenter servers offers two main API services:
REST is not a replacement for SOAP APIs, but a complement to them.

vCenter and ESXi API Simulator (vcsim)

Instructions for installing and testing of vcsim: A detailed description of vcsim is available here.

The following vCenter hierarchy is represented by vcsim:
vmware vcenter hierarchy
Default vCenter inventory of vcsim:
Folder                       /
Datacenter                   /DC0
Folder                       /DC0/vm
VirtualMachine               /DC0/vm/DC0_H0_VM0
VirtualMachine               /DC0/vm/DC0_H0_VM1
VirtualMachine               /DC0/vm/DC0_C0_RP0_VM0
VirtualMachine               /DC0/vm/DC0_C0_RP0_VM1
Folder                       /DC0/host
ComputeResource              /DC0/host/DC0_H0
HostSystem                   /DC0/host/DC0_H0/DC0_H0
ResourcePool                 /DC0/host/DC0_H0/Resources
ClusterComputeResource       /DC0/host/DC0_C0
HostSystem                   /DC0/host/DC0_C0/DC0_C0_H0
HostSystem                   /DC0/host/DC0_C0/DC0_C0_H1
HostSystem                   /DC0/host/DC0_C0/DC0_C0_H2
ResourcePool                 /DC0/host/DC0_C0/Resources
Folder                       /DC0/datastore
Datastore                    /DC0/datastore/LocalDS_0
Folder                       /DC0/network
Network                      /DC0/network/VM Network
DistributedVirtualSwitch     /DC0/network/DVS0
DistributedVirtualPortgroup  /DC0/network/DVS0-DVUplinks-9
DistributedVirtualPortgroup  /DC0/network/DC0_DVPG0

PowerCLI

Instructions for installing and testing of PowerCLI: A detailed description of PowerCLI is available here.

pyVmomi

Instructions for installing and testing of pyVmomi: A detailed description of pyVmomi is available here.

Conclusion

This approach shows that it is very easy to implement a test environment for experimenting with PowerCLI or pyVmomi. The vCenter simulator provides the necessary prerequisites for this. The operating system used is irrelevant, because all necessary components are offered for several platforms.