Search in sources :

Example 1 with DestroyNetworkAnswer

use of org.apache.cloudstack.network.opendaylight.agent.responses.DestroyNetworkAnswer in project cloudstack by apache.

the class OpendaylightGuestNetworkGuru method shutdown.

@Override
public void shutdown(NetworkProfile profile, NetworkOffering offering) {
    NetworkVO networkObject = networkDao.findById(profile.getId());
    if (networkObject.getBroadcastDomainType() != BroadcastDomainType.OpenDaylight || networkObject.getBroadcastUri() == null) {
        s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
        return;
    }
    List<OpenDaylightControllerVO> devices = openDaylightControllerMappingDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
    if (devices.isEmpty()) {
        s_logger.error("No Controller on physical network " + networkObject.getPhysicalNetworkId());
        return;
    }
    OpenDaylightControllerVO controller = devices.get(0);
    DestroyNetworkCommand cmd = new DestroyNetworkCommand(BroadcastDomainType.getValue(networkObject.getBroadcastUri()));
    DestroyNetworkAnswer answer = (DestroyNetworkAnswer) agentManager.easySend(controller.getHostId(), cmd);
    if (answer == null || !answer.getResult()) {
        s_logger.error("DestroyNetworkCommand failed");
    }
    super.shutdown(profile, offering);
}
Also used : NetworkVO(com.cloud.network.dao.NetworkVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) DestroyNetworkAnswer(org.apache.cloudstack.network.opendaylight.agent.responses.DestroyNetworkAnswer) OpenDaylightControllerVO(org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO) DestroyNetworkCommand(org.apache.cloudstack.network.opendaylight.agent.commands.DestroyNetworkCommand)

Aggregations

NetworkVO (com.cloud.network.dao.NetworkVO)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 DestroyNetworkCommand (org.apache.cloudstack.network.opendaylight.agent.commands.DestroyNetworkCommand)1 DestroyNetworkAnswer (org.apache.cloudstack.network.opendaylight.agent.responses.DestroyNetworkAnswer)1 OpenDaylightControllerVO (org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO)1