Show easily all networks with id

46 views
Skip to first unread message

Didi

unread,
Nov 15, 2013, 3:01:38 AM11/15/13
to psp...@googlegroups.com
Hi,
 
i want to show all my virtual networks (description and vlanId). I did it like this:
from psphere.client import Client
from psphere.managedobjects import HostSystem, ComputeResource

client
= Client("***", "***", "***")
HypervisorList = HostSystem.all(client)

for hv in HypervisorList:
 
for portgroup in hv.config.network.portgroup:
 
if str(portgroup.spec.vlanId) != '0':
   
print portgroup.spec.vlanId, portgroup.spec.name
When i do it like this the script will run for 30 min. How can i directly show all networks? In my case I take the informations from HostSystem... how can I get a list of all networks or if this is not exists a list of all networks of a datacenter?
 
I hope you can help me :)
Reply all
Reply to author
Forward
0 new messages