Using the GuestNicInfo class from VM GuestInfo class to retrive the all VM ip addresses. Below is the code sample.
public static void getVMIPAddresses(VirtualMachine vm) {
GuestInfo guest = vm.getGuest();
if (null != guest) {
GuestNicInfo getNet[] = guest.getNet();
if (null != getNet) {
for (int i = 0; i < getNet.length; i++) {
if (getNet[i].getIpAddress() != null) {
for (String ip : getNet[i].getIpAddress()) {
System.out.println("Ipaddress " + ip);
}
}
}
}
}
}