Package org.jclouds.openstack.nova.v2_0.domain

Examples of org.jclouds.openstack.nova.v2_0.domain.FloatingIP


         FloatingIPApi api = apiOption.get();
         Set<? extends FloatingIP> response = api.list().toSet();
         assert null != response;
         assertTrue(response.size() >= 0);
         for (FloatingIP ip : response) {
            FloatingIP newDetails = api.get(ip.getId());

            assertEquals(newDetails.getId(), ip.getId());
            assertEquals(newDetails.getIp(), ip.getIp());
            assertEquals(newDetails.getFixedIp(), ip.getFixedIp());
            assertEquals(newDetails.getInstanceId(), ip.getInstanceId());

         }
      }
   }
View Full Code Here


      for (String zoneId : api.getConfiguredZones()) {
         Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
         if (!apiOption.isPresent())
            continue;
         FloatingIPApi api = apiOption.get();
         FloatingIP floatingIP = api.create();
         assertNotNull(floatingIP);

         Set<? extends FloatingIP> response = api.list().toSet();
         boolean ipInSet = false;
         for (FloatingIP ip : response) {
            if (ip.getId().equals(floatingIP.getId()))
               ipInSet = true;
         }
         assertTrue(ipInSet);

         api.delete(floatingIP.getId());

         response = api.list().toSet();
         ipInSet = false;
         for (FloatingIP ip : response) {
            if (ip.getId().equals(floatingIP.getId())) {
               ipInSet = true;
            }
         }
         assertFalse(ipInSet);
      }
View Full Code Here

         if (!apiOption.isPresent())
            continue;
         FloatingIPApi api = apiOption.get();
         ServerApi serverApi = this.api.getServerApiForZone(zoneId);
         Server server = createServerInZone(zoneId);
         FloatingIP floatingIP = api.create();
         assertNotNull(floatingIP);
         try {
            api.addToServer(floatingIP.getIp(), server.getId());
            assertEventually(new ServerHasFloatingIP(serverApi, server.getId(), floatingIP.getIp()));
         } finally {
            api.removeFromServer(floatingIP.getIp(), server.getId());
            serverApi.delete(server.getId());
         }
      }
   }
View Full Code Here

   @Test
   public void testReturnsPublicIpOnMatch() throws Exception {
      NovaApi api = createMock(NovaApi.class);
      FloatingIPApi ipApi = createMock(FloatingIPApi.class);
      FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build();

      expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
      expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(testIp)))
               .atLeastOnce();
View Full Code Here

         FloatingIPApi api = apiOption.get();
         Set<? extends FloatingIP> response = api.list().toSet();
         assert null != response;
         assertTrue(response.size() >= 0);
         for (FloatingIP ip : response) {
            FloatingIP newDetails = api.get(ip.getId());

            assertEquals(newDetails.getId(), ip.getId());
            assertEquals(newDetails.getIp(), ip.getIp());
            assertEquals(newDetails.getFixedIp(), ip.getFixedIp());
            assertEquals(newDetails.getInstanceId(), ip.getInstanceId());
            assertEquals(newDetails.getPool(), ip.getPool());
         }
      }
   }
View Full Code Here

      for (String zoneId : api.getConfiguredZones()) {
         Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
         if (!apiOption.isPresent())
            continue;
         FloatingIPApi api = apiOption.get();
         FloatingIP floatingIP = api.create();
         assertNotNull(floatingIP);

         Set<? extends FloatingIP> response = api.list().toSet();
         boolean ipInSet = false;
         for (FloatingIP ip : response) {
            if (ip.getId().equals(floatingIP.getId()))
               ipInSet = true;
         }
         assertTrue(ipInSet);

         api.delete(floatingIP.getId());

         response = api.list().toSet();
         ipInSet = false;
         for (FloatingIP ip : response) {
            if (ip.getId().equals(floatingIP.getId())) {
               ipInSet = true;
            }
         }
         assertFalse(ipInSet);
      }
View Full Code Here

         if (!apiOption.isPresent())
            continue;
         FloatingIPApi api = apiOption.get();
         ServerApi serverApi = this.api.getServerApiForZone(zoneId);
         Server server = createServerInZone(zoneId);
         FloatingIP floatingIP = api.create();
         assertNotNull(floatingIP);
         try {
            api.addToServer(floatingIP.getIp(), server.getId());
            assertEventually(new ServerHasFloatingIP(serverApi, server.getId(), floatingIP.getIp()));
         } finally {
            api.removeFromServer(floatingIP.getIp(), server.getId());
            serverApi.delete(server.getId());
         }
      }
   }
View Full Code Here

    * @param nodeID optional id of the Node we are trying to allocate a FloatingIP for. Used here only for logging purposes
    * @return Optional<FloatingIP>
    */
   private Optional<FloatingIP> allocateFloatingIPForNode(FloatingIPApi floatingIpApi, Optional<Set<String>> poolNames, String nodeID) {

      FloatingIP ip = null;

      // 1.) Attempt to allocate from optionally passed poolNames
      if (poolNames.isPresent()) {
         for (String poolName : poolNames.get()) {
            try {
View Full Code Here

         FloatingIPApi api = apiOption.get();
         Set<? extends FloatingIP> response = api.list().toSet();
         assert null != response;
         assertTrue(response.size() >= 0);
         for (FloatingIP ip : response) {
            FloatingIP newDetails = api.get(ip.getId());

            assertEquals(newDetails.getId(), ip.getId());
            assertEquals(newDetails.getIp(), ip.getIp());
            assertEquals(newDetails.getFixedIp(), ip.getFixedIp());
            assertEquals(newDetails.getInstanceId(), ip.getInstanceId());

         }
      }
   }
View Full Code Here

      for (String zoneId : api.getConfiguredZones()) {
         Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
         if (!apiOption.isPresent())
            continue;
         FloatingIPApi api = apiOption.get();
         FloatingIP floatingIP = api.create();
         assertNotNull(floatingIP);

         Set<? extends FloatingIP> response = api.list().toSet();
         boolean ipInSet = false;
         for (FloatingIP ip : response) {
            if (ip.getId().equals(floatingIP.getId()))
               ipInSet = true;
         }
         assertTrue(ipInSet);

         api.delete(floatingIP.getId());

         response = api.list().toSet();
         ipInSet = false;
         for (FloatingIP ip : response) {
            if (ip.getId().equals(floatingIP.getId())) {
               ipInSet = true;
            }
         }
         assertFalse(ipInSet);
      }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.domain.FloatingIP

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.