use of com.att.cdp.zones.model.Subnet in project AJSC by att.
the class OpenStackNetworkService method getSubnetsByName.
/**
* @see com.att.cdp.zones.NetworkService#getSubnetsByName(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public List<Subnet> getSubnetsByName(String name) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SUBNET, name);
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
List<Subnet> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
SubnetsResource resource = client.subnets();
for (com.woorea.openstack.quantum.model.Subnet net : resource.list().execute()) {
if (net.getName().equals(name)) {
list.add(new OpenStackSubnet(context, net));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.zones.model.Subnet in project AJSC by att.
the class OpenStackNetworkService method getSubnets.
/**
* @see com.att.cdp.zones.NetworkService#getSubnets()
*/
@SuppressWarnings("nls")
@Override
public List<Subnet> getSubnets() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<Subnet> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
SubnetsResource resource = client.subnets();
for (com.woorea.openstack.quantum.model.Subnet net : resource.list().execute()) {
list.add(new OpenStackSubnet(context, net));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.zones.model.Subnet in project AJSC by att.
the class TestNetworkService method testSubnets.
/**
* Verifies that we can get floating IP Pools
*
* @throws ZoneException
* If the connection fails, user is not authorized, or the provider cannot perform the operation.
*/
@Test
@Ignore
public void testSubnets() throws ZoneException {
Context context = connect();
NetworkService service = context.getNetworkService();
List<Subnet> subnets = service.getSubnets();
assertNotNull(subnets);
assertFalse(subnets.isEmpty());
for (Subnet subnet : subnets) {
assertNotNull(service.getSubnetById(subnet.getId()));
assertNotNull(service.getSubnetsByName(subnet.getName()));
}
}
use of com.att.cdp.zones.model.Subnet in project AJSC by att.
the class TestNetworkService method createIPV4SubnetWithGateway.
/**
* Verifies that we can create a subnet with a specified gateway IP address on a provider
*
* @throws ZoneException
* If the connection fails, user is not authorized, or the provider cannot perform the operation.
*/
@Test
@Ignore
public void createIPV4SubnetWithGateway() throws ZoneException {
Context context = connect();
NetworkService service = context.getNetworkService();
try {
// verify test network exists
verifyTestNetworkHelper();
List<Network> networks = service.getNetworksByName("CDP_Test_Network");
assertNotNull(networks);
assertFalse(networks.isEmpty());
Network testNetwork = networks.get(0);
Subnet subnetWithGateway = new Subnet();
subnetWithGateway.setName("CDP_Test_IPV4_Subnet_With_Gateway");
subnetWithGateway.setNetwork(testNetwork.getId());
subnetWithGateway.setIpv4(true);
subnetWithGateway.setRouting("10.10.10.0/24");
subnetWithGateway.setGatewayIp("10.10.10.1");
service.createSubnet(subnetWithGateway);
List<Subnet> subnets = service.getSubnetsByName("CDP_Test_IPV4_Subnet_With_Gateway");
assertFalse(subnets.isEmpty());
for (Subnet subnet : subnets) {
assertTrue(subnet.getRouting().equalsIgnoreCase("10.10.10.0/24"));
assertTrue(subnet.getGatewayIp().equalsIgnoreCase("10.10.10.1"));
}
} catch (ZoneException ze) {
ze.printStackTrace();
fail("Failed to create the ipv4 test subnet with gateway IP");
}
}
use of com.att.cdp.zones.model.Subnet in project AJSC by att.
the class TestNetworkService method testCreateAndDeletePort.
@Test
@Ignore
public void testCreateAndDeletePort() throws ZoneException {
Context context = connect();
NetworkService service = context.getNetworkService();
String poolName = "TestNewPool";
String tenantId = context.getTenant().getId();
String networkId = "64e612b4-0a2a-4073-b408-66a3ef27aef7";
String subnetId = "b124ab37-a285-4b8f-848b-e485c062594c";
Subnet subnet = service.getSubnetById(subnetId);
assertNotNull(subnet);
Port port = service.createPort(subnet);
assertNotNull(port);
port.delete();
}
Aggregations