Package org.jclouds.openstack.nova.v2_0

Examples of org.jclouds.openstack.nova.v2_0.NovaApi


            .build();

      HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/metadata_updated.json")).build();
     
      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, setMetadata, setMetadataResponse);

      assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").updateMetadata(serverId, metadata).toString()
             new ParseMetadataUpdateTest().expected().toString());
   }
View Full Code Here


            .build();

      HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404)
              .payload(payloadFromResource("/metadata_updated.json")).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, setMetadata, setMetadataResponse);

      try {
       apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata);
         fail("Expected an exception.");
      } catch (Exception e) {
         ;
      }
   }
View Full Code Here

            .addHeader("X-Auth-Token", authToken)
            .build();

      HttpResponse updateMetadataResponse = HttpResponse.builder().statusCode(204).build();
     
      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, updateMetadata, updateMetadataResponse);

      apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").deleteMetadata(serverId, key);

   }
View Full Code Here

    String openstackNovaMsg = " Openstack-nova. Region: " + region
        + " - Name: ";

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();
    NovaApi novaApi = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();

    KeyPairApi api = novaApi.getKeyPairExtensionForZone(region).get();

    KeyPair keyPair = api.createWithPublicKey(keyPairName, publicKey);

    if (keyPair != null) {
View Full Code Here

      NodeMetadata node) {

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();

    NovaApi novaClient = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
    String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);

    FloatingIPApi floatingIp = novaClient.getFloatingIPExtensionForZone(
        region).get();

    String ip = null;
    // first try to find an unassigned IP.
    ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables
View Full Code Here

  public synchronized void releaseAddress(IaasProvider iaasInfo, String ip) {

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();

    NovaApi novaApi = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
    String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);

    FloatingIPApi floatingIPApi = novaApi
        .getFloatingIPExtensionForZone(region).get();

    for (FloatingIP floatingIP : floatingIPApi.list()) {
      if (floatingIP.getIp().equals(ip)) {
        floatingIPApi.delete(floatingIP.getId());
View Full Code Here

      server.enqueue(new MockResponse().setBody(stringFromResource("/server_details.json")));
      String serverDetailsActive = stringFromResource("/server_details.json").replace("BUILD(scheduling)", ACTIVE.value());
      server.enqueue(new MockResponse().setBody(serverDetailsActive));

      try {
         NovaApi novaApi = api(server.getUrl("/").toString(), "openstack-nova");
         ServerApi serverApi = novaApi.getServerApiForZone(("RegionOne"));

         boolean result = awaitActive(serverApi).apply("52415800-8b69-11e0-9b19-734f000004d2");

         assertTrue(result);
         assertEquals(server.getRequestCount(), 5);
View Full Code Here

      server.enqueue(new MockResponse().setBody(stringFromResource("/server_details.json")));
      String serverDetailsShutoff = stringFromResource("/server_details.json").replace("BUILD(scheduling)", SHUTOFF.value());
      server.enqueue(new MockResponse().setBody(serverDetailsShutoff));

      try {
         NovaApi novaApi = api(server.getUrl("/").toString(), "openstack-nova");
         ServerApi serverApi = novaApi.getServerApiForZone(("RegionOne"));

         boolean result = awaitShutoff(serverApi).apply("52415800-8b69-11e0-9b19-734f000004d2");

         assertTrue(result);
         assertEquals(server.getRequestCount(), 7);
View Full Code Here

      for (int i=0; i < 20; i++) {
         server.enqueue(new MockResponse().setBody(stringFromResource("/server_details.json")));
      }

      try {
         NovaApi novaApi = api(server.getUrl("/").toString(), "openstack-nova");
         ServerApi serverApi = novaApi.getServerApiForZone(("RegionOne"));

         boolean result = awaitStatus(serverApi, ACTIVE, 3, 1).apply("52415800-8b69-11e0-9b19-734f000004d2");

         assertFalse(result);
         assertAuthentication(server);
View Full Code Here

            .addHeader("X-Auth-Token", authToken).build();

      HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResource("/server_list.json")).build();

      NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
            responseWithKeystoneAccess, listServers, listServersResponse);

      assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));

      assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
            new ParseServerListTest().expected().toString());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.NovaApi

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.