VMware Cloud Community
PaulSE
Contributor
Contributor

Can't find IP Addresses for stateless ESXi servers

We have a VMware vSphere Web Services SDK 4.0 application that connects to a virtual center and then gathers information about the virtual center’s ESX(i) servers.  The application uses the following code excerpt to get the IP Address for the ESX(i) servers from the virtual NIC whose port group is “Management Network”:

                           String esxIP = null;

                            if (pc.getName().equalsIgnoreCase("config.network.vnic"))

                            {

                                ArrayOfHostVirtualNic arrayOfHVN = (ArrayOfHostVirtualNic) pc.getVal();

                                if (arrayOfHVN != null)

                                {

                                    HostVirtualNic[] vNics = arrayOfHVN.getHostVirtualNic();

                                    if (vNics != null)

                                    {

                                        for (HostVirtualNic hvn : vNics)

                                        {

                                            if (hvn.getPortgroup().equals("Management Network"))

                                            {

                                                esxIP = hvn.getSpec().getIp().getIpAddress();

                                            }

                                        }

                                    }

                                }

This works fine except for one site that is running ESXi server 4.1U2.  In this case, we do not find the IP Address.  This site has stateless ESXi servers and are using vNetwork Distributed Switch.

Do we need to use different SDK types and properties in order to get these ESXi server IP Addresses?

The vSphere client Configuration Networking page shows that their ESXi servers have Management Network vNICs with IP Addresses.

Thanks!

Tags (2)
0 Kudos
0 Replies