use of com.att.cdp.zones.NetworkService 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();
}
use of com.att.cdp.zones.NetworkService in project AJSC by att.
the class OpenStackServer method loadNetworks.
/**
* This method lazily loads the networks and ip addresses of the server
*
* @param context
* The context we are servicing
*/
@SuppressWarnings("nls")
private void loadNetworks(Context context) {
if (networksProcessed.compareAndSet(false, true)) {
try {
NetworkService netService = context.getNetworkService();
com.woorea.openstack.nova.model.Server.Addresses addresses = novaModel.getAddresses();
if (addresses != null) {
for (Map.Entry<String, List<com.woorea.openstack.nova.model.Server.Addresses.Address>> entry : addresses.getAddresses().entrySet()) {
String netName = entry.getKey();
try {
List<Network> nets = netService.getNetworksByName(netName);
if (!nets.isEmpty()) {
getNetworks().add(nets.get(0));
}
for (com.woorea.openstack.nova.model.Server.Addresses.Address osAddr : entry.getValue()) {
String type = osAddr.getType();
if (type != null) {
if (type.equalsIgnoreCase("fixed")) {
getFixedAddresses().add(osAddr.getAddr());
} else {
getFloatingAddresses().add(osAddr.getAddr());
}
}
}
} catch (ZoneException e) {
LOG.error(EELFResourceManager.format(e));
}
}
}
} catch (Exception e) {
LOG.error(String.format("Unexpected exception %s retrieving addresses for server %s", e.getClass().getSimpleName(), getId()));
LOG.error(EELFResourceManager.format(e));
}
}
}
Aggregations