Are you trying to just get the ip address for each vm?
If so you can use CreateContainerView on the vim.VirtualMachine to get the IP addresses of each VM from your vCentre via the guest object. Although you will need to have VMWare Tools installed to gather most of the information within the guest object.
serviceInstance = SmartConnect(host=host,user=user,pwd=password,port=443)
atexit.register(Disconnect, serviceInstance)
content = serviceInstance.RetrieveContent()
vm_view = content.viewManager.CreateContainerView(content.rootFolder,[vim.VirtualMachine],True)
# Loop through the vms and print the ipAddress
for vm in vm_view.view:
print(vm.guest.ipAddress)
If you are trying to do a more advanced approach I would recommend following the getvnicinfo.py example provided on the vmware github page. This actually goes through a more detailed view getting the information for each VM. Although this doesn't seem to provide the IP Address.
To view the available vlans for a host follow the below example.
hosts = content.viewManager.CreateContainerView(content.rootFolder,[vim.HostSystem],True)
for host in hosts.view:
for network in host.network:
switch = network.config.distributedVirtualSwitch
for portgroup in switch.portgroup:
print(portgroup.name) # This will print the vlan names