@Test public void testCreatePod() { skipIfNotGlobalAdmin(); zone = globalAdminClient.getZoneApi().createZone(prefix + "-zone-for-pod", 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-for-pod"); 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); }
@Test public void testCreateUpdateDeleteZone() { skipIfNotGlobalAdmin(); Zone zone = null; String zoneName = prefix + "-zone"; try { zone = globalAdminClient.getZoneApi().createZone(zoneName, NetworkType.BASIC, "8.8.8.8", "10.10.10.10"); assertNotNull(zone); assertEquals(zone, globalAdminClient.getZoneApi().getZone(zone.getId())); assertEquals(zone.getNetworkType(), NetworkType.BASIC); assertEquals(zone.getDNS(), ImmutableList.of("8.8.8.8")); assertEquals(zone.getInternalDNS(), ImmutableList.of("10.10.10.10")); Zone updated = globalAdminClient.getZoneApi().updateZone(zone.getId(), name(zoneName + "-2").externalDns(ImmutableList.of("8.8.4.4"))); assertEquals(updated.getId(), zone.getId()); assertEquals(updated.getDNS(), ImmutableList.of("8.8.4.4")); } finally { if (zone != null) { globalAdminClient.getZoneApi().deleteZone(zone.getId()); } } }
public void testCreateZoneWhenResponseIs2xxAnd404() { GlobalZoneApi client = requestSendsResponse(createZone, HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/createzoneresponse.json")) .build()); assertEquals(client.createZone("test-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10"), Zone.builder() .id("6") .name("test-zone") .DNS(ImmutableList.of("8.8.8.8")) .internalDNS(ImmutableList.of("10.10.10.10")) .networkType(NetworkType.BASIC) .securityGroupsEnabled(true) .allocationState(AllocationState.ENABLED) .zoneToken("7b6e27df-30a6-3024-9d8b-7971a3127f64") .dhcpProvider("DhcpServer").build()); client = requestSendsResponse(createZone, HttpResponse.builder().statusCode(404).build()); assertNull(client.createZone("test-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10")); }