Package org.jclouds.cloudsigma2.domain

Examples of org.jclouds.cloudsigma2.domain.Server


   public static void main(String[] args) {
      ListVolumeAttachments listVolumeAttachments = new ListVolumeAttachments();

      try {
         listVolumeAttachments.init(args);
         Server server = listVolumeAttachments.getServer();
         listVolumeAttachments.listVolumeAttachments(server);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
View Full Code Here


      NodeMetadata nodeMetadata = computeService.createNodesInGroup("jclouds-reverse-dns-test", 1, template).iterator().next();
      serverId = nodeMetadata.getId();
      serverURI = nodeMetadata.getUri();

      ServerApi serverApi = nova.getApi().getServerApiForZone(nodeMetadata.getLocation().getParent().getId());
      Server server = serverApi.get(nodeMetadata.getProviderId());
      serverIPv4 = server.getAccessIPv4();
      serverIPv6 = server.getAccessIPv6();
     
      System.out.println("serverURI = " + serverURI);
      System.out.println("serverIPv4 = " + serverIPv4);
      System.out.println("serverIPv6 = " + serverIPv6);
   }
View Full Code Here

         String expectedImageId, OperatingSystem expectedOs, Image existingImage) {

      Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
      Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
            .of(existingHardware);
      Server serverToConvert = new ParseServerTest().expected();

      ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");

      ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
               NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
                        .<Set<? extends Image>> ofInstance(images), Suppliers
                        .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);

      NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);

      assertEquals(serverInZoneToConvert.slashEncode(), convertedNodeMetadata.getId());
      assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());

      assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.HOST);
      assertEquals(convertedNodeMetadata.getLocation().getId(), "e4d909c290d0fb1ca068ffaddf22cbd0");

      assertEquals(convertedNodeMetadata.getLocation().getParent(), locationIndex.get().get("az-1.region-a.geo-1"));

      assertEquals(serverToConvert.getName(), convertedNodeMetadata.getName());
      assertEquals(convertedNodeMetadata.getGroup(), "sample");

      assertEquals(convertedNodeMetadata.getImageId(), expectedImageId);
      assertEquals(convertedNodeMetadata.getOperatingSystem(), expectedOs);

      assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);

      assertEquals(NovaComputeServiceContextModule.toPortableNodeStatus.get(serverToConvert.getStatus()),
               convertedNodeMetadata.getStatus());

      assertNotNull(convertedNodeMetadata.getPrivateAddresses());
      assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.176.42.16"));
View Full Code Here

   public void testNewServerWithoutHostIdSetsZoneAsLocation() {

      Set<Image> images = ImmutableSet.<Image> of();
      Set<Hardware> hardwares = ImmutableSet.<Hardware> of();

      Server serverToConvert = expectedServer();

      ServerInZone serverInZoneToConvert = new ServerInZone(serverToConvert, "az-1.region-a.geo-1");

      ServerInZoneToNodeMetadata converter = new ServerInZoneToNodeMetadata(
               NovaComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
                        .<Set<? extends Image>> ofInstance(images), Suppliers
                        .<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);

      NodeMetadata convertedNodeMetadata = converter.apply(serverInZoneToConvert);

      assertEquals(serverInZoneToConvert.slashEncode(), convertedNodeMetadata.getId());
      assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());

      assertEquals(convertedNodeMetadata.getLocation(), zone);

      URI expectedURI = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752");
      assertEquals(convertedNodeMetadata.getUri(), expectedURI);
View Full Code Here

         Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
         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

         this.floatingIP = floatingIP;
      }

      public void run() {
         try {
            Server server = api.get(serverId);
            boolean ipInServerAddresses = false;
            Multimap<String, Address> addresses = server.getAddresses();
            for (Address address : addresses.values()) {
               if (address.getAddr().equals(floatingIP)) {
                  ipInServerAddresses = true;
               }
            }
View Full Code Here

      apiOption = api.getVirtualInterfaceExtensionForZone(zone);
   }

   public void testListVirtualInterfaces() {
      if (apiOption.isPresent()) {
         Server testServer = null;
         try {
            testServer = createServerInZone(zone);
            Set<? extends VirtualInterface> results = apiOption.get().listOnServer(testServer.getId()).toSet();
            for (VirtualInterface vif : results) {
               assertNotNull(vif.getId());
               assertNotNull(vif.getMacAddress());
            }
         } finally {
            if (testServer != null) {
               api.getServerApiForZone(zone).delete(testServer.getId());
            }
         }
   }
}
View Full Code Here

            assertEquals(serverWithGroups.getName(), server.getName());
            assertNotNull(serverWithGroups.getSecurityGroupNames());
         }

         // Create a new server to verify the groups work as expected
         Server testServer = null;
         try {
            testServer = createServerInZone(zone);
           
            ServerWithSecurityGroups results = apiOption.get().get(testServer.getId());
            assertEquals(results.getId(), testServer.getId());
            assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default"));
         } finally {
            if (testServer != null) {
               serverApi.delete(testServer.getId());
            }
         }
      }
   }
View Full Code Here

   /**
    * Will block until the requested server is in the correct state, if Extended Server Status extension is loaded
    * this will continue to block while any task is in progress.
    */
   protected void blockUntilServerInState(String serverId, ServerApi api, Status status) {
      Server currentDetails = null;
      for (currentDetails = api.get(serverId); currentDetails.getStatus() != status
               || ((currentDetails.getExtendedStatus().isPresent() && currentDetails.getExtendedStatus().get()
                        .getTaskState() != null)); currentDetails = api.get(serverId)) {
         System.out.printf("blocking on status %s%n%s%n", status, currentDetails);
         try {
            Thread.sleep(5 * 1000);
         } catch (InterruptedException e) {
View Full Code Here

   @Singleton
   public static class ServerWithSecurityGroupsAdapter implements JsonDeserializer<ServerWithSecurityGroups> {
      @Override
      public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
            throws JsonParseException {
         Server server = context.deserialize(jsonElement, Server.class);
         ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server);
         Set<String> names = Sets.newLinkedHashSet();
         if (jsonElement.getAsJsonObject().get("security_groups") != null) {
            JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray();
            for (JsonElement y : x) {
View Full Code Here

TOP

Related Classes of org.jclouds.cloudsigma2.domain.Server

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.