use of com.cloud.agent.api.DeleteLogicalSwitchCommand in project cosmic by MissionCriticalCloud.
the class NiciraNvpResourceTest method testDeleteLogicalSwitch.
@Test
public void testDeleteLogicalSwitch() throws ConfigurationException {
resource.configure("NiciraNvpResource", parameters);
final DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
final DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) resource.executeRequest(dlsc);
assertTrue(dlsa.getResult());
}
use of com.cloud.agent.api.DeleteLogicalSwitchCommand in project cloudstack by apache.
the class NiciraNvpGuestNetworkGuru method shutdown.
@Override
public void shutdown(final NetworkProfile profile, final NetworkOffering offering) {
final NetworkVO networkObject = networkDao.findById(profile.getId());
if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Lswitch || networkObject.getBroadcastUri() == null) {
s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
return;
}
final List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
if (devices.isEmpty()) {
s_logger.error("No NiciraNvp Controller on physical network " + networkObject.getPhysicalNetworkId());
return;
}
final NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
final HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
String logicalSwitchUuid = BroadcastDomainType.getValue(networkObject.getBroadcastUri());
if (offering.getGuestType().equals(GuestType.Shared)) {
sharedNetworksCleanup(networkObject, logicalSwitchUuid, niciraNvpHost);
}
final DeleteLogicalSwitchCommand cmd = new DeleteLogicalSwitchCommand(logicalSwitchUuid);
final DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) agentMgr.easySend(niciraNvpHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
s_logger.error("DeleteLogicalSwitchCommand failed");
}
super.shutdown(profile, offering);
}
use of com.cloud.agent.api.DeleteLogicalSwitchCommand in project cloudstack by apache.
the class NiciraNvpRequestWrapperTest method testDeleteLogicalSwitchCommandWrapper.
@Test
public void testDeleteLogicalSwitchCommandWrapper() {
final NiciraNvpApi niciraNvpApi = Mockito.mock(NiciraNvpApi.class);
final String logicalSwitchUuid = "d2e05a9e-7120-4487-a5fc-414ab36d9345";
final DeleteLogicalSwitchCommand command = new DeleteLogicalSwitchCommand(logicalSwitchUuid);
when(niciraNvpResource.getNiciraNvpApi()).thenReturn(niciraNvpApi);
try {
doNothing().when(niciraNvpApi).deleteLogicalSwitch(command.getLogicalSwitchUuid());
} catch (final NiciraNvpApiException e) {
fail(e.getMessage());
}
final NiciraNvpRequestWrapper wrapper = NiciraNvpRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, niciraNvpResource);
assertTrue(answer.getResult());
}
Aggregations