@Override public int compareTo(Zone o) { return id.compareTo(o.getId()); } }
@Override public int compareTo(Zone o) { return id.compareTo(o.getId()); } }
@Override public int compareTo(Zone o) { return id.compareTo(o.getId()); } }
@Override public Map<String, Set<String>> apply(CloudStackClient client) { checkNotNull(client, "client"); Builder<String, Set<String>> builder = ImmutableMap.builder(); for (Zone zone : client.getZoneClient().listZones()) { builder.put(zone.getId(), client.getHypervisorClient().listHypervisorsInZone(zone.getId())); } return builder.build(); } }
@Override public Map<String, Set<String>> apply(CloudStackClient client) { checkNotNull(client, "client"); Builder<String, Set<String>> builder = ImmutableMap.builder(); for (Zone zone : client.getZoneClient().listZones()) { builder.put(zone.getId(), client.getHypervisorClient().listHypervisorsInZone(zone.getId())); } return builder.build(); } }
@Override public Map<String, Set<String>> apply(CloudStackApi client) { checkNotNull(client, "client"); Builder<String, Set<String>> builder = ImmutableMap.builder(); for (Zone zone : client.getZoneApi().listZones()) { builder.put(zone.getId(), client.getHypervisorApi().listHypervisorsInZone(zone.getId())); } return builder.build(); } }
@Override public Location apply(Zone zone) { return new LocationBuilder().scope(LocationScope.ZONE).metadata(ImmutableMap.<String, Object> of()) .description(zone.getName()).id(zone.getId()) .parent(Iterables.getOnlyElement(provider.get())).build(); }
@Override public Location apply(Zone zone) { return new LocationBuilder().scope(LocationScope.ZONE).metadata(ImmutableMap.<String, Object> of()) .description(zone.getName()).id(zone.getId()) .parent(Iterables.getOnlyElement(provider.get())).build(); }
@BeforeMethod(groups = "live") public void setZoneId() { Set<Zone> zones = client.getZoneClient().listZones(); assertNotNull(zones); assertFalse(zones.isEmpty()); zoneId = Iterables.get(zones, 0).getId(); }
@Override public Location apply(Zone zone) { return new LocationBuilder().scope(LocationScope.ZONE).metadata(ImmutableMap.<String, Object> of()) .description(zone.getName()).id(zone.getId()) .parent(Iterables.getOnlyElement(provider.get())).build(); }
@BeforeMethod(groups = "live") public void setZoneId() { Set<Zone> zones = client.getZoneApi().listZones(); assertNotNull(zones); assertFalse(zones.isEmpty()); zoneId = Iterables.get(zones, 0).getId(); }
@BeforeMethod(groups = "live") public void setZoneId() { Set<Zone> zones = client.getZoneApi().listZones(); assertNotNull(zones); assertFalse(zones.isEmpty()); zoneId = Iterables.get(zones, 0).getId(); }
public void testListHypervisors() throws Exception { Set<String> response = client.getHypervisorClient().listHypervisors(); assert null != response; assertTrue(response.size() >= 0); for (Zone zone : client.getZoneClient().listZones()) { Set<String> zoneHype = client.getHypervisorClient().listHypervisorsInZone(zone.getId()); assert response.containsAll(zoneHype); } }
@Test public void testCreatePod() { skipIfNotGlobalAdmin(); zone = globalAdminClient.getZoneClient().createZone(prefix + "-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10"); pod = globalAdminClient.getPodClient().createPod(prefix + "-pod", zone.getId(), "172.20.0.1", "172.20.0.250", "172.20.0.254", "255.255.255.0", CreatePodOptions.Builder.allocationState(AllocationState.ENABLED)); assertNotNull(pod); assertEquals(pod.getName(), prefix + "-pod"); assertEquals(pod.getZoneId(), zone.getId()); assertEquals(pod.getZoneName(), prefix + "-zone"); assertEquals(pod.getStartIp(), "172.20.0.1"); assertEquals(pod.getEndIp(), "172.20.0.250"); assertEquals(pod.getGateway(), "172.20.0.254"); assertEquals(pod.getNetmask(), "255.255.255.0"); assertEquals(pod.getAllocationState(), AllocationState.ENABLED); }
public void testListHypervisors() throws Exception { Set<String> response = client.getHypervisorApi().listHypervisors(); assert null != response; assertTrue(response.size() > 0); for (Zone zone : client.getZoneApi().listZones()) { Set<String> zoneHype = client.getHypervisorApi().listHypervisorsInZone(zone.getId()); assert response.containsAll(zoneHype); } }
@Test public void testCreateVMWithoutSecurityGroupAssignsDefault() throws Exception { skipIfSecurityGroupsNotSupported(); String defaultTemplate = template != null ? template.getImageId() : null; VirtualMachine newVm = VirtualMachineClientLiveTest.createVirtualMachineWithOptionsInZone(DeployVirtualMachineOptions.NONE, zone.getId(), defaultTemplateOrPreferredInZone(defaultTemplate, client, zone.getId()), client, jobComplete, virtualMachineRunning); try { VirtualMachine runningVm = client.getVirtualMachineClient().getVirtualMachine(newVm.getId()); assertEquals(1, runningVm.getSecurityGroups().size()); assertEquals(Iterables.getOnlyElement(runningVm.getSecurityGroups()).getName(), "default"); } finally { assertTrue(jobComplete.apply(client.getVirtualMachineClient().destroyVirtualMachine(newVm.getId()))); } }
@Override public Template getNodeTemplate() { return view.getComputeService().templateBuilder().locationId(zone.getId()).build(); } }
@Test(dependsOnMethods = "testCreateIngress") public void testCreateVMInSecurityGroup() throws Exception { skipIfSecurityGroupsNotSupported(); String defaultTemplate = template != null ? template.getImageId() : null; vm = VirtualMachineClientLiveTest.createVirtualMachineWithSecurityGroupInZone(zone.getId(), defaultTemplateOrPreferredInZone(defaultTemplate, client, zone.getId()), group.getId(), client, jobComplete, virtualMachineRunning); if (vm.getPassword() != null && loginCredentials.getOptionalPassword() == null) loginCredentials = loginCredentials.toBuilder().password(vm.getPassword()).build(); // ingress port 22 checkSSH(HostAndPort.fromParts(vm.getIPAddress(), 22)); // ingress icmp disabled as this is platform dependent and may actually // just try tcp port 7 // assert InetAddress.getByName(vm.getIPAddress()).isReachable(1000) : vm; }
@AfterGroups(groups = "live") @Override protected void tearDownContext() { if (pod != null) { globalAdminClient.getPodClient().deletePod(pod.getId()); pod = null; } if (zone != null) { globalAdminClient.getZoneClient().deleteZone(zone.getId()); zone = null; } super.tearDownContext(); } }
@AfterGroups(groups = "live") @Override protected void tearDownContext() { if (pod != null) { globalAdminClient.getPodClient().deletePod(pod.getId()); pod = null; } if (zone != null) { globalAdminClient.getZoneApi().deleteZone(zone.getId()); zone = null; } super.tearDownContext(); } }