vcsim

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package vcsim contains tools for running a VCenter simulator.

Index

Constants

View Source
const (
	// DefaultNetworkName is the name of the default network that exists when starting a new vcsim instance.
	DefaultNetworkName = "VM Network"

	// DefaultStoragePolicyName is the name of the default storage policy that exists when starting a new vcsim instance.
	DefaultStoragePolicyName = "vSAN Default Storage Policy"
)

Variables

View Source
var (
	// DefaultVMTemplates is the name of the default VM templates the vcsim controller adds to new vcsim instance.
	// Note: There are no default templates when starting a new vcsim instance.
	// Note: For the sake of testing with vcsim the template doesn't really matter (nor the version of K8s hosted on it)
	// but we must provide at least the templates that are expected by test cluster classes.
	DefaultVMTemplates = []string{

		"ubuntu-2204-kube-v1.28.0",
		"ubuntu-2204-kube-v1.29.0",
		"ubuntu-2204-kube-v1.30.0",
	}
)

Functions

func ClusterName added in v1.10.0

func ClusterName(datacenter, cluster int) string

ClusterName provide a function to compute vcsim cluster names given its index and the index of a datacenter.

func ClusterPath added in v1.10.0

func ClusterPath(datacenter, cluster int) string

ClusterPath provides the path for a vcsim cluster given its index and the index of a datacenter.

func DatacenterName added in v1.10.0

func DatacenterName(datacenter int) string

DatacenterName provide a function to compute vcsim datacenter names given its index.

func DatastoreName added in v1.10.0

func DatastoreName(datastore int) string

DatastoreName provide a function to compute vcsim datastore names given its index.

func DatastorePath added in v1.10.0

func DatastorePath(datacenter, datastore int) string

DatastorePath provides the path for a vcsim datastore given its index and the index of a datacenter.

func DistributedPortGroupName added in v1.10.0

func DistributedPortGroupName(datacenter int, distributedPortGroup int) string

DistributedPortGroupName provide a function to compute vcsim distribute port group names in a datacenter.

func NetworkFolderName added in v1.10.0

func NetworkFolderName(datacenter int) string

NetworkFolderName provide a function to compute vcsim network folder name names given the index of a datacenter.

func NetworkPath added in v1.10.0

func NetworkPath(datacenter int, network string) string

NetworkPath provides the path for a vcsim network given the index of a datacenter and the network name.

func ResourcePoolPath added in v1.10.0

func ResourcePoolPath(datacenter, cluster int) string

ResourcePoolPath provides the path for a vcsim Resources folder given the index of a datacenter and the index of a cluster.

func VMFolderName added in v1.10.0

func VMFolderName(datacenter int) string

VMFolderName provide a function to compute vcsim vm folder name names given the index of a datacenter.

func VMPath added in v1.10.0

func VMPath(datacenter int, vm string) string

VMPath provides the path for a vcsim VM given the index of a datacenter and the vm name.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder helps in creating a vcsim simulator.

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a new a Builder.

func (*Builder) Build

func (b *Builder) Build() (*Simulator, error)

Build the vcsim instance.

func (*Builder) SkipModelCreate added in v1.10.0

func (b *Builder) SkipModelCreate() *Builder

SkipModelCreate tells the builder to skip creating the model, because it is already created before passing it to WithModel.

func (*Builder) WithModel

func (b *Builder) WithModel(model *simulator.Model) *Builder

WithModel defines the model to be used by the Builder when creating the vcsim instance.

func (*Builder) WithOperations

func (b *Builder) WithOperations(ops ...string) *Builder

WithOperations defines the operation that the Builder should executed on the newly created vcsim instance.

func (*Builder) WithURL added in v1.10.0

func (b *Builder) WithURL(url *url.URL) *Builder

WithURL defines the url to be used for service listening.

type Simulator

type Simulator struct {
	// contains filtered or unexported fields
}

Simulator binds together a vcsim model and its server.

func (Simulator) Destroy

func (s Simulator) Destroy()

Destroy a Simulator.

func (Simulator) Password

func (s Simulator) Password() string

Password for the Simulator.

func (Simulator) Run

func (s Simulator) Run(commandStr string, buffers ...*gbytes.Buffer) error

Run a govc command on the Simulator.

func (Simulator) ServerURL

func (s Simulator) ServerURL() *url.URL

ServerURL returns Simulator's server url.

func (Simulator) Username

func (s Simulator) Username() string

Username for the Simulator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL