use of org.apache.cloudstack.network.opendaylight.api.resources.NeutronPortsNorthboundAction in project cloudstack by apache.
the class NeutronRestApiIT method neutronListAllPorts.
@Test
public void neutronListAllPorts() throws NeutronRestApiException {
URL url;
try {
url = new URL("http://178.237.34.233:8080");
NeutronPortsNorthboundAction neutron = new NeutronPortsNorthboundAction(url, "admin", "admin");
NeutronPortsList<NeutronPortWrapper> results = neutron.listAllPorts();
Assert.assertNotNull(results);
List<NeutronPortWrapper> networks = results.getPorts();
Assert.assertNotNull(networks);
} catch (MalformedURLException e) {
Assert.fail("Should not fail here.");
}
}
use of org.apache.cloudstack.network.opendaylight.api.resources.NeutronPortsNorthboundAction in project cloudstack by apache.
the class OpenDaylightControllerResource method executeRequest.
private Answer executeRequest(ConfigurePortCommand cmd) {
NeutronPortsNorthboundAction configurePort = new NeutronPortsNorthboundAction(controllerUrl, controllerUsername, controllerPassword);
NeutronPort newPort = new NeutronPort();
// Configuration from the command
newPort.setId(cmd.getPortId());
newPort.setTenantId(cmd.getTennantId());
newPort.setAdminStateUp(true);
newPort.setName(cmd.getPortId().toString());
newPort.setNetworkId(cmd.getNetworkId());
newPort.setMacAddress(cmd.getMacAddress());
newPort.setDeviceId(UUID.randomUUID());
// Static valus
newPort.setStatus("ACTIVE");
newPort.setFixedIps(Collections.<String>emptyList());
NeutronPortWrapper portWrapper = new NeutronPortWrapper();
portWrapper.setPort(newPort);
try {
portWrapper = configurePort.createNeutronPort(portWrapper);
} catch (NeutronRestApiException e) {
s_logger.error("createPortCommand failed", e);
return new ConfigurePortAnswer(cmd, e);
}
return new ConfigurePortAnswer(cmd, true, "Port " + portWrapper.getPort().getId().toString() + " created");
}
Aggregations