Subnet.CreateOptions createSubnet = Subnet.createOptions("1234567890", "10.0.3.0/24")
.name("jclouds-wibble")
.ipVersion(4)
.build();
Subnet subnet = api.create(createSubnet);
/*
* Check request
*/
assertAuthentication(server);
assertRequest(server.takeRequest(), "POST", "/v2.0/subnets", "/subnet_create_request.json");
/*
* Check response
*/
assertNotNull(subnet);
assertEquals(subnet.getName(), "jclouds-wibble");
assertEquals(subnet.getIpVersion().intValue(), 4);
assertEquals(subnet.getCidr(), "10.0.3.0/24");
assertEquals(subnet.getTenantId(), "1234567890");
assertEquals(subnet.getId(), "624312ff-d14b-4ba3-9834-1c78d23d574d");
} finally {
server.shutdown();
}
}