diff --git a/govc/test/vcsim.bats b/govc/test/vcsim.bats index 6b9f44d1d..7dba6c967 100755 --- a/govc/test/vcsim.bats +++ b/govc/test/vcsim.bats @@ -267,6 +267,15 @@ EOF netip=$(govc object.collect -json -s vm/$vm guest.net | jq -r .[].Val.GuestNicInfo[].IpAddress[0]) [ "$netip" = "$ip" ] + run govc vm.ip $vm # covers VirtualMachine.WaitForIP + assert_success "$ip" + + run govc vm.ip -a $vm # covers VirtualMachine.WaitForNetIP + assert_success "$ip" + + run govc vm.ip -n ethernet-0 $vm # covers VirtualMachine.WaitForNetIP + assert_success "$ip" + run govc vm.power -s $vm assert_success diff --git a/simulator/container.go b/simulator/container.go index 08f8f7ed1..96f4fd10c 100644 --- a/simulator/container.go +++ b/simulator/container.go @@ -114,6 +114,20 @@ func (c *container) inspect(vm *VirtualMachine) error { net := &vm.Guest.Net[0] net.IpAddress = []string{s.IPAddress} net.MacAddress = s.MacAddress + net.IpConfig = &types.NetIpConfigInfo{ + IpAddress: []types.NetIpConfigInfoIpAddress{{ + IpAddress: s.IPAddress, + PrefixLength: int32(s.IPPrefixLen), + State: string(types.NetIpConfigInfoIpAddressStatusPreferred), + }}, + } + } + + for _, d := range vm.Config.Hardware.Device { + if eth, ok := d.(types.BaseVirtualEthernetCard); ok { + eth.GetVirtualEthernetCard().MacAddress = s.MacAddress + break + } } }