SubnetApi subnetApi = api.getSubnetApiForZone(zone);
Network network = networkApi.create(CreateNetworkOptions.builder().name("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
assertNotNull(network);
Subnet subnet = subnetApi.create(network.getId(), 4, "192.168.0.0/16");
assertNotNull(subnet);
Router ref = routerApi.create(CreateRouterOptions.builder().name("jclouds-router-test")
.externalGatewayInfo(ExternalGatewayInfo.builder().networkId(network.getId()).build()).build());
assertNotNull(ref);