Examples of VDC


Examples of org.jclouds.savvis.vpdc.domain.VDC

   public void test() {
      InputStream is = getClass().getResourceAsStream("/vdc.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "demo_vpdcname");
      assertEquals(result.getDescription(),
               "ServiceProfileName = Balanced; ServiceLocation = North America; Email = jim@company.com;");
      assertEquals(result.getStatus(), Status.DEPLOYED);
      assertEquals(
               result.getResourceEntities(),
               ImmutableSet
                        .<Resource> of(
                                 new ResourceImpl(
                                          "1001",
                                          "DemoHost-1",
                                          VCloudMediaType.VAPP_XML,
                                          URI
                                                   .create("https://api.sandbox.savvis.net/rest/api/v0.8/org/100000.0/vdc/2736/vApp/1001")),
                                 new ResourceImpl(
                                          "1002",
                                          "DemoHost-2",
                                          VCloudMediaType.VAPP_XML,
                                          URI
                                                   .create("https://api.sandbox.savvis.net/rest/api/v0.8/org/100000.0/vdc/2736/vApp/1002")),
                                 new ResourceImpl(
                                          "1003",
                                          "DemoHost-3",
                                          VCloudMediaType.VAPP_XML,
                                          URI
                                                   .create("https://api.sandbox.savvis.net/rest/api/v0.8/org/100000.0/vdc/2736/vApp/1003")),
                                 new ResourceImpl(
                                          "1234",
                                          "CustomerTemplateName",
                                          VCloudMediaType.VAPPTEMPLATE_XML,
                                          URI
                                                   .create("https://api.sandbox.savvis.net/rest/api/v0.8/org/100000.0/vdc/2736/vAppTemplate/1234")),
                                 new ResourceImpl(
                                          "FirewallService",
                                          "firewall",
                                          "api.savvis.net+xml",
                                          URI
                                                   .create("https://api.sandbox.savvis.net/rest/api/v0.8/org/100000.0/vdc/2736/FirewallService"))));
      assertEquals(result.getAvailableNetworks(), ImmutableSet.of());
   }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

   public void test1net() {
      InputStream is = getClass().getResourceAsStream("/vdc-1net.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "demo6");
      assertEquals(result.getDescription(),
               "ServiceProfileName = Essential; ServiceLocation = US_WEST; Email = red@chair.com;");
      assertEquals(result.getStatus(), Status.DEPLOYED);
      assertEquals(result.getResourceEntities(), ImmutableSet.of(new ResourceImpl("1001", "Host1",
               VCloudMediaType.VAPP_XML, URI
                        .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1619/vApp/1001")),
               new ResourceImpl("1002", "Host2", VCloudMediaType.VAPP_XML, URI
                        .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1619/vApp/1002")),
               new ResourceImpl("1003", "Host3", VCloudMediaType.VAPP_XML, URI
                        .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1619/vApp/1003")),
               new ResourceImpl("1004", "Host4", VCloudMediaType.VAPP_XML, URI
                        .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1619/vApp/1004"))));
      assertEquals(result.getAvailableNetworks(), ImmutableSet.of(ResourceImpl.builder().id("VM-Tier01").name(
               "VM Tier01").type(VCloudMediaType.NETWORK_XML).href(
               URI.create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1619/network/VM-Tier01"))
               .build()));

   }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

   public void testFailed() {
      InputStream is = getClass().getResourceAsStream("/vdc-failed.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "Demo7");
      assertEquals(result.getDescription(),
               "ServiceProfileName = Essential; ServiceLocation = US_WEST; Email = red@chair.com;");
      assertEquals(result.getStatus(), Status.FAILED);
      assertEquals(result.getResourceEntities(), ImmutableSet.of(new ResourceImpl("1001", "Host1",
               VCloudMediaType.VAPP_XML, URI
                        .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1641/vApp/1001"))));
      assertEquals(result.getAvailableNetworks(), ImmutableSet.of(ResourceImpl.builder().id("VM-Tier01").name(
               "VM Tier01").type(VCloudMediaType.NETWORK_XML).href(
               URI.create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/1641/network/VM-Tier01"))
               .build()));

   }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

   public void testSaved() {
      InputStream is = getClass().getResourceAsStream("/vdc-saved.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "CloudBurst1");
      assertEquals(result.getDescription(),
               "ServiceProfileName = Essential; ServiceLocation = US_WEST; Email = me@my.com;");
      assertEquals(result.getStatus(), Status.SAVED);
      assertEquals(
               result.getResourceEntities(),
               ImmutableSet
                        .of(
                                 ResourceImpl
                                          .builder()
                                          .name("templateHost")
                                          .type("application/vnd.vmware.vcloud.vApp+xml")
                                          .id("1001")
                                          .href(
                                                   URI
                                                            .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/2555/vApp/1001"))
                                          .build(),
                                 ResourceImpl
                                          .builder()
                                          .name("host-c501")
                                          .type("application/vnd.vmware.vcloud.vApp+xml")
                                          .id("1037")
                                          .href(
                                                   URI
                                                            .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/2555/vApp/1037"))
                                          .build(),
                                 ResourceImpl
                                          .builder()
                                          .name("host-c501")
                                          .type("application/vnd.vmware.vcloud.vApp+xml")
                                          .id("1038")
                                          .href(
                                                   URI
                                                            .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/2555/vApp/1038"))
                                          .build(),
                                 ResourceImpl
                                          .builder()
                                          .name("host-c601")
                                          .type("application/vnd.vmware.vcloud.vApp+xml")
                                          .id("1039")
                                          .href(
                                                   URI
                                                            .create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/2555/vApp/1039"))
                                          .build()));
      assertEquals(result.getAvailableNetworks(), ImmutableSet.of(ResourceImpl.builder().id("VM-Tier01").name(
               "VM Tier01").type(VCloudMediaType.NETWORK_XML).href(
               URI.create("https://api.savvis.net/rest/api/v0.8/org/606677.0/vdc/2555/network/VM-Tier01"))
               .build()));

   }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

   // test execution will invariably take a long time
   public void testLifeCycle() throws InterruptedException, ExecutionException, TimeoutException, IOException {
      for (Resource org1 : restContext.getApi().listOrgs()) {
         Org org = restContext.getApi().getBrowsingApi().getOrg(org1.getId());
         VDC_LOOP : for (Resource vdc : org.getVDCs()) {
            VDC VDC = restContext.getApi().getBrowsingApi().getVDCInOrg(org.getId(), vdc.getId());
            for (Resource vmHandle : Iterables.filter(VDC.getResourceEntities(), new Predicate<Resource>() {

               @Override
               public boolean apply(Resource arg0) {
                  return VCloudMediaType.VAPP_XML.equals(arg0.getType());
               }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

      String networkTierName = Iterables.get(
               restContext.getApi().getBrowsingApi().getVDCInOrg(billingSiteId, vpdcId).getAvailableNetworks(), 0)
               .getName();
      String name = prefix;

      VDC vpdc = restContext.getApi().getBrowsingApi().getVDCInOrg(billingSiteId, vpdcId);
     
      CIMOperatingSystem os = Iterables.find(restContext.getApi().listPredefinedOperatingSystems(),
               new Predicate<CIMOperatingSystem>() {

                  @Override
                  public boolean apply(CIMOperatingSystem arg0) {
                     return arg0.getOsType() == OSType.RHEL_64;
                  }

               });
      System.out.printf("Creating vm - vpdcId %s, vpdcName %s, networkName %s, name %s, os %s%n", vpdcId, vpdc.getName(), networkTierName, name, os);

      // TODO: determine the sizes available in the VDC, for example there's
      // a minimum size of boot disk, and also a preset combination of cpu count vs ram
      Task task = api.addVMIntoVDC(billingSiteId, vpdcId, VMSpec.builder().name(name).networkTierName(
               networkTierName).operatingSystem(os).memoryInGig(2).addDataDrive("/data01", 25).build());
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

               networkTierName);

      String name = prefix;

      // delete any old VM
      VDC vpdc = restContext.getApi().getBrowsingApi().getVDCInOrg(billingSiteId, vpdcId);
      CIMOperatingSystem os = Iterables.find(restContext.getApi().listPredefinedOperatingSystems(),
               new Predicate<CIMOperatingSystem>() {

                  @Override
                  public boolean apply(CIMOperatingSystem arg0) {
                     return arg0.getOsType() == OSType.RHEL_64;
                  }

               });

      // TODO: Savvis returns network names with a - instead of space on getNetworkInVDC call,
      // fix this once savvis api starts returning correctly
      System.out.printf("Creating vm's - vpdcId %s, vpdcName %s, networkName %s, name %s, os %s%n", vpdcId, vpdc.getName(), networkTier
               .getName().replace("-", " "), name, os);

      Builder<VMSpec> vmSpecs = ImmutableSet.builder();
      int noOfVms = 2;
      for (int i = 0; i < noOfVms; i++) {
         // TODO: determine the sizes available in the VDC, for example there's
         // a minimum size of boot disk, and also a preset combination of cpu count vs ram
         VMSpec vmSpec = VMSpec.builder().name(name + i).operatingSystem(os).memoryInGig(2).networkTierName(
                  networkTierName).addDataDrive("/data01", 25).build();
         vmSpecs.add(vmSpec);
      }

      Set<Task> tasks = api.addMultipleVMsIntoVDC(vpdc.getHref(), vmSpecs.build());

      for (Task task : tasks) {
         // make sure there's no error
         assert task.getId() != null && task.getError() == null : task;
         assert this.taskTester.apply(task.getId());
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

                     return description.indexOf(email) != -1;
                  }

               }).getId();

      VDC vpdc = restContext.getApi().getBrowsingApi().getVDCInOrg(billingSiteId, vpdcId);

      for (Resource vApp : Iterables.filter(vpdc.getResourceEntities(), new Predicate<Resource>() {

         @Override
         public boolean apply(Resource arg0) {
            return VCloudMediaType.VAPP_XML.equals(arg0.getType());
         }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

   @Test
   public void testVDC() throws Exception {
      for (Resource org1 : restContext.getApi().listOrgs()) {
         Org org = api.getOrg(org1.getId());
         for (Resource vdc : org.getVDCs()) {
            VDC response = api.getVDCInOrg(org.getId(), vdc.getId());
            assertNotNull(response);
            assertNotNull(response.getId());
            assertNotNull(response.getHref());
            assertNotNull(response.getName());
            assertNotNull(response.getStatus());
            assertEquals(response.getType(), "application/vnd.vmware.vcloud.vdc+xml");
            assertNotNull(response.getDescription());
            assertNotNull(response.getResourceEntities());
            assertNotNull(response.getAvailableNetworks());
            assertEquals(api.getVDCInOrg(org.getId(), response.getId()).toString(), response.toString());
         }
      }
   }
View Full Code Here

Examples of org.jclouds.savvis.vpdc.domain.VDC

   @Test
   public void testNetwork() throws Exception {
      for (Resource org1 : restContext.getApi().listOrgs()) {
         Org org = api.getOrg(org1.getId());
         for (Resource vdc : org.getVDCs()) {
            VDC VDC = api.getVDCInOrg(org.getId(), vdc.getId());
            for (Resource vApp : VDC.getAvailableNetworks()) {
               Network response = api.getNetworkInVDC(org.getId(), vdc.getId(), vApp.getId());
               assertNotNull(response);
               assertNotNull(response.getId());
               assertNotNull(response.getHref());
               assertNotNull(response.getName());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.