@AfterClass
  public void restorePrivateIp() {
    AsyncTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>>newArrayList(privateIp));
    assertNull(task);

    List<Ip<?, ?>> nics = env.virtualMachine.listAttachedNics();
    assertEquals(nics.size(), 1);
    assertEquals(nics.get(0).getId(), privateIp.getId());

    String address = publicIpCloud.getIp();
    env.virtualDatacenter.releaseePublicIp(publicIpCloud);
    assertNull(
        env.virtualDatacenter.findPurchasedPublicIp(IpPredicates.<PublicIp>address(address)));
  }
  @BeforeClass
  public void setupIps() {
    privateIp = env.privateNetwork.listUnusedIps().get(0);
    assertNotNull(privateIp);

    externalIp = env.externalNetwork.listUnusedIps().get(0);
    assertNotNull(externalIp);

    publicIpInfrastructure = env.virtualDatacenter.listAvailablePublicIps().get(0);
    env.virtualDatacenter.purchasePublicIp(publicIpInfrastructure);

    publicIpCloud =
        env.virtualDatacenter.findPurchasedPublicIp(
            IpPredicates.<PublicIp>address(publicIpInfrastructure.getIp()));
    assertNotNull(publicIpCloud);
  }
 public void testGetNetworkFromIp() {
   UnmanagedIp ip = unmanagedNetwork.findIp(IpPredicates.<UnmanagedIp>notUsed());
   // Unmanaged networks do not have IPs until attached to VMs
   assertNull(ip);
 }