I know many of my readers have inquired about VCSIM (vCenter Server Simulator) which was a really useful tool that served a variety of use cases, but unfortunately it had stopped working with the VCSA 6.0 release. VCSIM is another topic that is near and dear to me and it is something I continue to push and advocate for internally at VMware. Earlier this week, I came to learn about a cool new incubation project that Doug MacEachern had been working on for some time now. Doug is an awesome VMware developer working on the vSphere Integrated Containers (vIC) project and he is also well known for his active contributions to both govmomi (vSphere SDK for Go) and govc CLI.
As you can probably guess from the title, the name of the project is called govcsim and it is a vCenter Server and ESXi API based simulator written using govmomi. It creates a vCenter Server model with a datacenter, hosts, cluster, resource pools, networks and a datastore. The naming of the objects is similar to that of the original VCSIM mode that was included with the VCSA. The number of resources can be increased or decreased using the various resource type flags. Resources can also be created and removed using the API. Doug had developed the tool to provide an easy way for their team to test some of the work they are doing with vIC. The tool is still under incubation but continues to received enhancements. In fact, the other day when I had used it for the first time, I had found a couple of issues which Doug resolved immediately.
I got a chance to give govcsim a spin the other day and currently you can connect to it using govmomi, govc, pyvomi (vSphere SDK for Python) or rbvmomi (vSphere SDK for Ruby). It currently does not work with PowerCLI (connects but no inventory), I know this is something Doug is currently looking into. You might also be able to connect using other vSphere SDKs but these are the ones that Doug and I have tried so far.
- golang 1.7+ installed on a system
- git installed on a system
In the example below, I will be demonstrating on how to setup and build vcsim on a macOS system. You can easily use Photon OS and run through the exact same instructions.
Step 1 - Install Go, you can find the binaries located here. On my macOS, I just used brew install go
Step 2 - Set the GOPATH to where govcsim will reside using the following:
Step 3 - Download govcsim by running the following command:
go get -u github.com/vmware/govmomi/vcsim
Step 4 - If everything was built correctly, you should be able to run the following to launch govcsim with the help menu:
Here is an example of connecting to govcsim using a pyvmomi sample:
python getallvms.py -s 127.0.0.1 -o 8989 -u foo -p bar
We can also connect using govc, to do so, make sure you first download and install it by running the following:
curl -L https://github.com/vmware/govmomi/releases/download/v0.14.0/govc_darwin_amd64.gz | gunzip -d > /usr/local/bin/govc
chmod +x /usr/local/bin/govc
Next, we need to take the output from govcsim which is GOVC_URL and export that as an environmental variable by running the following
export GOVC_URL=https://user:[email protected]:8989/sdk
We can then inspect the vSphere inventory by running the following command and traversing the output:
If you wish to have govcsim listen to a specific IP Address/Port, you can pass in the -httptest.serve property. If you wish to disable HTTPS protocol, you can pass in false to the -tls property. You can also have govcsim simulate a standalone ESXi host by using the -esx property.
Lastly, if you would like to see which vSphere API methods are supported by govcsim, you can simply open a browser to https://127.0.0.1/8989/about to see the list of methods.
I am definitely looking forward to seeing how this project develops and the great thing about this is govcsim is completely OSS. If you are interested, get involved and contribute back, even if it is just helping out with testing or filing bugs. Huge thanks to Doug for kicking off this effort, really appreciate you sharing this with our community!