WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / govcsim - Neat incubation project (vCenter Server & ESXi API based simulator)

govcsim - Neat incubation project (vCenter Server & ESXi API based simulator)

04.21.2017 by William Lam // 12 Comments

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.

Requirements:

  • 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:

export GOPATH=/Users/lamw/gocode

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:

$GOPATH/bin/vcsim -h


If you just run govcsim without any arguments, it will launch with a pre-defined inventory.


By default, the API endpoint will run on 127.0.0.1 (localhost) and running on port 8989. There is no username or password, so you can pass in anything you want for it.

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


As you can see from the screenshot above, we are getting back some VMs that are being simulated by govcsim.

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
export GOVC_INSECURE=1

We can then inspect the vSphere inventory by running the following command and traversing the output:

govc ls


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!

More from my site

  • Record and Replay vSphere Inventory using govc and vcsim 
  • Slick way of deploying OVF/OVA directly to ESXi & vCenter Server using govc CLI
  • How to deploy a Kubernetes Cluster on vSphere?
  • govmomi (vSphere SDK for Go), govc CLI & Kubernetes on vSphere
  • vSphere Code Capture is your ChatGPT for vSphere Automation

Categories // Automation, ESXi, vSphere Tags // govc, govmomi, vcsim, vSphere API

Comments

  1. *protectedOmer Kushmaro says

    04/24/2017 at 2:06 am

    Nice!
    But does it support Connect-VIServer? 🙂

    Reply
    • William Lam says

      04/24/2017 at 10:01 am

      Did you actually read the post 🙂

      Reply
  2. *protectedSree says

    06/15/2017 at 10:50 am

    Hi William , Thanks for the nice writeup ..I would like to know how to assign ip's and steps to be followed to deploy VM's after reaching the above state

    Reply
    • *protectedsbhagwat says

      04/17/2019 at 11:17 pm

      Hello William,
      Can you help us know, how to add IPs to the VMs and update VMs in host??

      Reply
  3. *protectedsjourne says

    06/26/2017 at 8:35 am

    For information the project have moved to https://github.com/vmware/govmomi/vcsim.
    In step 3, you need to replace go get -u github.com/vmware/vic/cmd/vcsim by go get -u github.com/vmware/govmomi/vcsim

    Reply
    • William Lam says

      06/26/2017 at 8:40 am

      Thanks! Yea, Doug recently merged the code over, appreciate the catch

      Reply
  4. *protectedMahipat says

    08/21/2017 at 5:09 am

    Hi William,
    can you share the steps to add a real esxi host to VCSIM. I am using VCSIM based out of 5.5 and i have a 5.5 ESXi host which i need to add to my simulated vCenter.

    Reply
  5. *protectedEric says

    01/12/2018 at 9:26 am

    Hi William,

    I'm wondering if you know govcsim can be used to simulate performance metrics similar to what you mentioned in your article using the vcsim: https://www.williamlam.com/2014/04/simulating-vsphere-performance-metrics-using-vcsim.html

    It would be very useful if it does!

    Reply
  6. *protectedjashraf0406 says

    09/17/2018 at 5:46 am

    Hi Villiam,

    Thanks for the great writeup...I am using vcenter 6.7 and my task is to add dumy n number of host in vcenter like VCSIM for vcenter5.5. Can we use govcsim to add hosts ? Please let us know to configure if it is possible with govcsim.

    Thank you !

    Reply
  7. *protectedAshraf says

    09/18/2018 at 12:32 am

    Hi William

    Nice writeup.... I would like to add n number of host in vcetner 6.7 like VCSIM , Can we use govcsim to add the hosts into vcenter6.7

    Reply
  8. *protectedOzgur says

    06/20/2021 at 10:26 am

    I found the article while buying a new lab hardware. :).

    Reply
  9. *protectedRichard says

    10/04/2023 at 7:18 pm

    Thanks William!

    This simulator has many helpful use cases. Since it's command line only, we've implemented it in the Sigma automation platform to enable a web app. It's currently available for free at https://sigma-lab.rtechservices.co/register under the Compute tab.

    More info about the platform: https://rtechservices.co/

    Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...