title: How to use vi java api to specify IP address while deploying vm from ovf?
body: <p>Is there a way I can configure the network setting (IP, gateway, etc) while deploying ovf to ESXi server ? Below is the code snippet I copied from vi java api sample code (by Steven Jin) that I used to create vm instance from existing ovf. Anyone know how to insert some lines to get the new IP/gateway configured ?</p>
  
  <pre><code>    OvfCreateImportSpecParams importSpecParams = new OvfCreateImportSpecParams();
      importSpecParams.setHostSystem(host.getMOR());
      importSpecParams.setLocale("US");
      importSpecParams.setEntityName(newVmName);
      importSpecParams.setDeploymentOption("");
      OvfNetworkMapping networkMapping = new OvfNetworkMapping();
      networkMapping.setName("Network 1");
      networkMapping.setNetwork(host.getNetworks()[0].getMOR()); // network);
      importSpecParams.setNetworkMapping(new OvfNetworkMapping[] { networkMapping });
      importSpecParams.setPropertyMapping(null);
  
      String ovfDescriptor = readOvfContent(ovfLocal);
      if (ovfDescriptor == null) 
      {
        si.getServerConnection().logout();
        return;
      }
  
      System.out.println("ovfDesc:" + ovfDescriptor);
  
      ResourcePool rp = ((ComputeResource)host.getParent()).getResourcePool();
  
      OvfCreateImportSpecResult ovfImportResult = si.getOvfManager().createImportSpec(
          ovfDescriptor, rp, host.getDatastores()[0], importSpecParams); 
  </code></pre>
  
  <p>Thanks,</p>