Find file History
alexellis Add 2x blog posts about vcsim
- adds 2x blog posts to the file of the vcsim
component to help new users get started and to improve SEO.

Signed-off-by: Alex Ellis (VMware) <>
Latest commit b261f25 Jan 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Move vcsim from vmware/vic to govmomi Jun 20, 2017
Makefile Makefiles for govc/vcsim; updates govc/ Nov 14, 2018 Add 2x blog posts about vcsim Jan 8, 2019
main.go vcsim: configure HostSystem port Dec 27, 2018

vcsim - A vCenter and ESXi API based simulator

This package implements a vSphere Web Services (SOAP) SDK endpoint intended for testing consumers of the API. While the mock framework is written in the Go language, it can be used by any language that can talk to the vSphere API.


% export GOPATH=$HOME/gopath
% go get -u
% $GOPATH/bin/vcsim -h


The vcsim program by default creates a vCenter model with a datacenter, hosts, cluster, resource pools, networks and a datastore. The naming is similar to that of the original vcsim mode that was included with vCenter. 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.

Example using the default settings:

% export GOVC_URL=https://user:pass@
% $GOPATH/bin/vcsim
% govc find
/DC0/network/VM Network

Example using ESX mode:

% $GOPATH/vcsim -esx
% govc find
/ha-datacenter/network/VM Network

Supported methods

The simulator supports a subset of API methods. However, the generated govmomi code includes all types and methods defined in the vmodl, which can be used to implement any method documented in the VMware vSphere API Reference.

To see the list of supported methods:

curl -sk https://user:pass@

Listen address

The default vcsim listen address is Use the -httptest.serve flag to listen on another address:

vcsim -httptest.serve= # specific address

vcsim -httptest.serve=:8989 # any address

When given a port value of '0', an unused port will be chosen. You can then source the GOVC_URL from another process, for example:


mkfifo $govc_sim_env

vcsim -httptest.serve= -E $govc_sim_env &

eval "$(cat $govc_sim_env)"

# ... run tests ...

rm -f $govc_sim_env

Tests written in Go can also use the simulator package directly, rather than the vcsim binary.

Introducing delays

Sometimes, especially when debugging software, it can be useful to introduce delays to simulate network latency or a poorly performing vCenter. There are three command line options for dealing with delays.

-delay <ms> Adds a constant delay (experessed in milliseconds) to every call

-method-delay <method:milliseconds,method:milliseconds...> Adds a specified delay to individual methods. If both -method-delay and -delay are specified, they are added together

delay-jitter Specifies a jitter, i.e. a random value added to or subtracted from the delay. It is specified as a Coefficient of Variation, which is the same as the standard deviation divided by the mean. A reasonable starting value is 0.5, as it gives a nice variation without extreme outliers.

Projects using vcsim

Related projects


Blog posts on vcsim