use of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNodesNorthboundAction in project cloudstack by apache.
the class OpenDaylightControllerResource method executeRequest.
private Answer executeRequest(AddHypervisorCommand cmd) {
NeutronNodesNorthboundAction nodeActions = new NeutronNodesNorthboundAction(controllerUrl, controllerUsername, controllerPassword);
try {
NeutronNodesList<NeutronNodeWrapper> nodes = nodeActions.listAllNodes();
if (nodes.getNodes() != null) {
for (NeutronNodeWrapper nodeWrapper : nodes.getNodes()) {
NeutronNode node = nodeWrapper.getNode();
if (node.getId().equals(cmd.getHostId())) {
return new AddHypervisorAnswer(cmd, true, "Hypervisor already connected");
}
}
}
// Not found in the existing node list, add it
nodeActions.updateNeutronNodeV2("OVS", cmd.getHostId(), cmd.getIpAddress(), 6640);
} catch (NeutronRestApiException e) {
s_logger.error("Call to OpenDaylight failed", e);
return new AddHypervisorAnswer(cmd, e);
}
return new AddHypervisorAnswer(cmd, true, "Hypervisor " + cmd.getHostId() + " added");
}
use of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNodesNorthboundAction in project cloudstack by apache.
the class NeutronRestApiMock method neutronNodesFail.
@Test(expected = NeutronRestApiException.class)
public void neutronNodesFail() throws NeutronRestApiException {
URL url;
try {
url = new URL("http://localhost:8080");
NeutronNodesNorthboundAction neutron = new NeutronNodesNorthboundAction(url, "admin", "admin");
neutron.listAllNodes();
} catch (MalformedURLException e) {
Assert.fail("Should not fail here.");
}
}
use of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNodesNorthboundAction in project cloudstack by apache.
the class NeutronRestApiIT method neutronListAllNodes.
@Test
public void neutronListAllNodes() throws NeutronRestApiException {
URL url;
try {
url = new URL("http://178.237.34.233:8080");
NeutronNodesNorthboundAction neutron = new NeutronNodesNorthboundAction(url, "admin", "admin");
NeutronNodesList<NeutronNodeWrapper> results = neutron.listAllNodes();
Assert.assertNotNull(results);
} catch (MalformedURLException e) {
Assert.fail("Should not fail here.");
}
}
use of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNodesNorthboundAction in project cloudstack by apache.
the class NeutronRestApiMock method neutronHTTPPutUriMethod.
/*
* Test fails because there is no controller. It's used only to test that
* the HTTP methods are correct.
*/
@Test(expected = NeutronRestApiException.class)
public void neutronHTTPPutUriMethod() throws NeutronRestApiException {
URL url;
try {
url = new URL("http://localhost:8080");
NeutronNodesNorthboundAction neutron = new NeutronNodesNorthboundAction(url, "admin", "admin");
neutron.updateNeutronNodeV1("ca31aa7f-84c7-416d-bc00-1f84927367e0", "1.1.1.1.", 6400);
} catch (MalformedURLException e) {
Assert.fail("Should not fail here.");
}
}
Aggregations