Examples of OpenDaylightControllerVO


Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

            final Host host = resourceManager.addHost(zoneId, odlController, Host.Type.L2Networking, hostParams);
            if (host != null) {
                return Transaction.execute(new TransactionCallback<OpenDaylightControllerVO>() {
                    @Override
                    public OpenDaylightControllerVO doInTransaction(TransactionStatus status) {
                        OpenDaylightControllerVO controller = new OpenDaylightControllerVO(host.getId(), physicalNetworkId, ntwkSvcProvider.getProviderName(), hostParams
                                .get("name"));
                        openDaylightControllerMappingDao.persist(controller);
                        return controller;
                    }
                });
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

        }
    }

    @Override
    public void deleteController(DeleteOpenDaylightControllerCmd cmd) throws InvalidParameterValueException {
        OpenDaylightControllerVO controller = openDaylightControllerMappingDao.findById(cmd.getId());
        if (controller == null) {
            throw new InvalidParameterValueException("No ODL Controller with id " + cmd.getId());
        }

        // Find the physical network we work for
        Long physicalNetworkId = controller.getPhysicalNetworkId();
        PhysicalNetworkVO physicalNetwork = physicalNetworkDao.findById(physicalNetworkId);
        if (physicalNetwork != null) {
            // Lets see if there are networks that use us
            List<NetworkVO> networkList = networkDao.listByPhysicalNetwork(physicalNetworkId);

            if (networkList != null) {
                // Networks with broadcast type lswitch are ours
                for (NetworkVO network : networkList) {
                    if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.OpenDaylight) {
                        if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) {
                            throw new CloudRuntimeException("This Controller can not be deleted as there are one or more logical networks provisioned by cloudstack.");
                        }
                    }
                }
            }
        }

        HostVO host = hostDao.findById(controller.getHostId());
        Long hostId = host.getId();

        host.setResourceState(ResourceState.Maintenance);
        hostDao.update(hostId, host);
        resourceManager.deleteHost(hostId, false, false);
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

    @Override
    public List<OpenDaylightControllerVO> listControllers(ListOpenDaylightControllersCmd cmd) {
        if (cmd.getId() != null) {
            List<OpenDaylightControllerVO> foundControllers = new ArrayList<OpenDaylightControllerVO>();
            OpenDaylightControllerVO controller = openDaylightControllerMappingDao.findById(cmd.getId());
            if (controller != null) {
                foundControllers.add(controller);
            }
            return foundControllers;
        } else if (cmd.getPhysicalNetworkId() != null) {
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

        List<OpenDaylightControllerVO> devices = openDaylightControllerMappingDao.listByPhysicalNetwork(physicalNetworkId);
        if (devices.isEmpty()) {
            s_logger.error("No Controller on physical network " + physicalNetworkId);
            return null;
        }
        OpenDaylightControllerVO controller = devices.get(0);

        ConfigureNetworkCommand cmd = new ConfigureNetworkCommand(name, context.getAccount().getAccountName());
        ConfigureNetworkAnswer answer = (ConfigureNetworkAnswer)agentManager.easySend(controller.getHostId(), cmd);

        if (answer == null || !answer.getResult()) {
            s_logger.error("ConfigureNetworkCommand failed");
            return null;
        }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

        List<OpenDaylightControllerVO> devices = openDaylightControllerMappingDao.listByPhysicalNetwork(physicalNetworkId);
        if (devices.isEmpty()) {
            s_logger.error("No Controller on physical network " + physicalNetworkId);
            throw new InsufficientVirtualNetworkCapcityException("No OpenDaylight Controller configured for this network", dest.getPod().getId());
        }
        OpenDaylightControllerVO controller = devices.get(0);

        AddHypervisorCommand addCmd = new AddHypervisorCommand(dest.getHost().getUuid(), dest.getHost().getPrivateIpAddress());
        AddHypervisorAnswer addAnswer = (AddHypervisorAnswer)agentManager.easySend(controller.getHostId(), addCmd);
        if (addAnswer == null || !addAnswer.getResult()) {
            s_logger.error("Failed to add " + dest.getHost().getName() + " as a node to the controller");
            throw new InsufficientVirtualNetworkCapcityException("Failed to add destination hypervisor to the OpenDaylight Controller", dest.getPod().getId());
        }

        ConfigurePortCommand cmd = new ConfigurePortCommand(UUID.fromString(nic.getUuid()), UUID.fromString(BroadcastDomainType.getValue(network.getBroadcastUri())), context
                .getAccount().getAccountName(), nic.getMacAddress());
        ConfigurePortAnswer answer = (ConfigurePortAnswer)agentManager.easySend(controller.getHostId(), cmd);

        if (answer == null || !answer.getResult()) {
            s_logger.error("ConfigureNetworkCommand failed");
            throw new InsufficientVirtualNetworkCapcityException("Failed to configure the port on the OpenDaylight Controller", dest.getPod().getId());
        }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

            List<OpenDaylightControllerVO> devices = openDaylightControllerMappingDao.listByPhysicalNetwork(physicalNetworkId);
            if (devices.isEmpty()) {
                s_logger.error("No Controller on physical network " + physicalNetworkId);
                throw new CloudRuntimeException("No OpenDaylight controller on this physical network");
            }
            OpenDaylightControllerVO controller = devices.get(0);

            DestroyPortCommand cmd = new DestroyPortCommand(UUID.fromString(nic.getUuid()));
            DestroyPortAnswer answer = (DestroyPortAnswer)agentManager.easySend(controller.getHostId(), cmd);

            if (answer == null || !answer.getResult()) {
                s_logger.error("DestroyPortCommand failed");
                success = false;
            }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO

        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");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.