VMware {code} Community
arpan_c
Contributor
Contributor

Find out virtual distributed switches under a datacenter by vi java

Hi,

I have a requirement in which I have to find/list out the virtual distributed switches under the datacenter of a Vcenter.

Is there an api to achieve the same?

Folder nws = Datacenter.getNetworkFolder();

Task task = nws.createDVS_Task(spec)

This actually allows you to create a dvs under the datacenter,similarly there should be an api to get the dvs under the datacenter,isn't that so?


Awaiting response on the same. Smiley Happy

Thanks & Regards,

Arpan Chaudhuri.

Tags (1)
Reply
0 Kudos
1 Reply
doskiran
Enthusiast
Enthusiast

Yes by using same datcenter network folder(nws) api to get the dvSwitches under datacenter.

ManagedEntity[] childEntity = nws .getChildEntity();

for (ManagedEntity me : childEntity) {

         if (me instanceof com.vmware.vim25.mo.DistributedVirtualSwitch) {

                   System.out.println(me.getName());

        }

}

Reply
0 Kudos