private static NetworkSummary getHostNetworkSummaryByName()

in src/com/vmware/vim25/mox/VirtualMachineDeviceManager.java [569:597]


  private static NetworkSummary getHostNetworkSummaryByName(String networkName, VirtualMachineNetworkInfo[] hostNetworkList) 
  {
    NetworkSummary result = null;
    boolean isNetworkExistingOnHost = false;

     // Check each of the provided network names against host networks to see if it exists on host
    for (VirtualMachineNetworkInfo netInfo : hostNetworkList) 
    {
      if (networkName.equals(netInfo.name)) 
      {
        isNetworkExistingOnHost = true;

        if (netInfo.network.accessible) 
        {
          result = netInfo.network;
          break;
        }
        else
        {
          throw new RuntimeException("Network: " + networkName + " is not accessible."); 
        }
      }
    }
    if (!isNetworkExistingOnHost) 
    {
      throw new RuntimeException("Network: " + networkName + " does not exist on host network."); 
    }
    return result;
  }