Examples of BigSwitchVnsDeviceVO


Examples of com.cloud.network.BigSwitchVnsDeviceVO

    /////////////////////////////////////////////////////

    @Override
    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
        try {
            BigSwitchVnsDeviceVO bigswitchVnsDeviceVO = _bigswitchVnsElementService.addBigSwitchVnsDevice(this);
            if (bigswitchVnsDeviceVO != null) {
                BigSwitchVnsDeviceResponse response = _bigswitchVnsElementService.createBigSwitchVnsDeviceResponse(bigswitchVnsDeviceVO);
                response.setObjectName("bigswitchvnsdevice");
                response.setResponseName(getCommandName());
                this.setResponseObject(response);
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId);
        if (devices.isEmpty()) {
            s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId);
            return null;
        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
        _hostDao.loadDetails(bigswitchVnsHost);

        CreateVnsNetworkCommand cmd = new CreateVnsNetworkCommand(networkUuid, name, tenantId, vlan);
        CreateVnsNetworkAnswer answer = (CreateVnsNetworkAnswer) _agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
        if (devices.isEmpty()) {
            s_logger.error("No BigSwitch Controller on physical network " + networkObject.getPhysicalNetworkId());
            return;
        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());

        String tenantId = profile.getNetworkDomain();

        DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId,
                        networkObject.getBroadcastUri().getSchemeSpecificPart());
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        if (devices.isEmpty()) {
            s_logger.error("No BigSwitch Controller on physical network "
                    + network.getPhysicalNetworkId());
            return false;
        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());

        CreateVnsPortCommand cmd = new CreateVnsPortCommand(
                network.getBroadcastUri().getSchemeSpecificPart(),
                vm.getUuid(),
                tenantId,
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        if (devices.isEmpty()) {
            s_logger.error("No BigSwitch Controller on physical network "
                    + network.getPhysicalNetworkId());
            return false;
        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());

        DeleteVnsPortCommand cmd = new DeleteVnsPortCommand(
                network.getBroadcastUri().getSchemeSpecificPart(),
                vm.getUuid(),
                tenantId);
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        ServerResource resource = new BigSwitchVnsResource();
        String deviceName = VnsConstants.BigSwitchVns.getName();
        NetworkDevice networkDevice = NetworkDevice
                .getNetworkDevice(deviceName);
        Long physicalNetworkId = cmd.getPhysicalNetworkId();
        BigSwitchVnsDeviceVO bigswitchVnsDevice = null;

        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
                .findById(physicalNetworkId);
        if (physicalNetwork == null) {
            throw new InvalidParameterValueException(
                    "Could not find phyical network with ID: "
                            + physicalNetworkId);
        }
        long zoneId = physicalNetwork.getDataCenterId();

        PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao
                .findByServiceProvider(physicalNetwork.getId(),
                        networkDevice.getNetworkServiceProvder());
        if (ntwkSvcProvider == null) {
            throw new CloudRuntimeException("Network Service Provider: "
                    + networkDevice.getNetworkServiceProvder()
                    + " is not enabled in the physical network: "
                    + physicalNetworkId + "to add this device");
        } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
            throw new CloudRuntimeException("Network Service Provider: "
                    + ntwkSvcProvider.getProviderName()
                    + " is in shutdown state in the physical network: "
                    + physicalNetworkId + "to add this device");
        }

        if (_bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
            throw new CloudRuntimeException(
                    "A BigSwitch controller device is already configured on this physical network");
        }

        Map<String, String> params = new HashMap<String, String>();
        params.put("guid", UUID.randomUUID().toString());
        params.put("zoneId", String.valueOf(physicalNetwork.getDataCenterId()));
        params.put("physicalNetworkId", String.valueOf(physicalNetwork.getId()));
        params.put("name", "BigSwitch Controller - " + cmd.getHost());
        params.put("ip", cmd.getHost());
        // FIXME What to do with multiple isolation types
        params.put("transportzoneisotype",
                physicalNetwork.getIsolationMethods().get(0).toLowerCase());

        Map<String, Object> hostdetails = new HashMap<String, Object>();
        hostdetails.putAll(params);

        Transaction txn = Transaction.currentTxn();
        try {
            resource.configure(cmd.getHost(), hostdetails);

            Host host = _resourceMgr.addHost(zoneId, resource,
                    Host.Type.L2Networking, params);
            if (host != null) {
                txn.start();

                bigswitchVnsDevice = new BigSwitchVnsDeviceVO(host.getId(),
                        physicalNetworkId, ntwkSvcProvider.getProviderName(),
                        deviceName);
                _bigswitchVnsDao.persist(bigswitchVnsDevice);

                DetailVO detail = new DetailVO(host.getId(),
                        "bigswitchvnsdeviceid",
                        String.valueOf(bigswitchVnsDevice.getId()));
                _hostDetailsDao.persist(detail);

                txn.commit();
                return bigswitchVnsDevice;
            } else {
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

    }

    @Override
    public boolean deleteBigSwitchVnsDevice(DeleteBigSwitchVnsDeviceCmd cmd) {
        Long bigswitchVnsDeviceId = cmd.getBigSwitchVnsDeviceId();
        BigSwitchVnsDeviceVO bigswitchVnsDevice = _bigswitchVnsDao
                .findById(bigswitchVnsDeviceId);
        if (bigswitchVnsDevice == null) {
            throw new InvalidParameterValueException(
                    "Could not find a BigSwitch Controller with id " + bigswitchVnsDevice);
        }

        // Find the physical network we work for
        Long physicalNetworkId = bigswitchVnsDevice.getPhysicalNetworkId();
        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
                .findById(physicalNetworkId);
        if (physicalNetwork != null) {
            List<NetworkVO> networkList = _networkDao
                    .listByPhysicalNetwork(physicalNetworkId);

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

        HostVO bigswitchHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
        Long hostId = bigswitchHost.getId();

        //bigswitchHost.setResourceState(ResourceState.Maintenance);
        //_hostDao.update(hostId, bigswitchHost);
        _hostDao.remove(hostId);
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

            throw new InvalidParameterValueException(
                    "Either physical network Id or bigswitch device Id must be specified");
        }

        if (bigswitchVnsDeviceId != null) {
            BigSwitchVnsDeviceVO bigswitchVnsDevice = _bigswitchVnsDao
                    .findById(bigswitchVnsDeviceId);
            if (bigswitchVnsDevice == null) {
                throw new InvalidParameterValueException(
                        "Could not find BigSwitch controller with id: "
                                + bigswitchVnsDevice);
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId);
        if (devices.isEmpty()) {
            s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId);
            return null;
        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
        _hostDao.loadDetails(bigswitchVnsHost);

        CreateVnsNetworkCommand cmd = new CreateVnsNetworkCommand(networkUuid, name, tenantId, vlan);
        CreateVnsNetworkAnswer answer = (CreateVnsNetworkAnswer)_agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
View Full Code Here

Examples of com.cloud.network.BigSwitchVnsDeviceVO

        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
        if (devices.isEmpty()) {
            s_logger.error("No BigSwitch Controller on physical network " + networkObject.getPhysicalNetworkId());
            return;
        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());

        String tenantId = profile.getNetworkDomain();

        DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId, BroadcastDomainType.getValue(networkObject.getBroadcastUri()));
        _agentMgr.easySend(bigswitchVnsHost.getId(), cmd);
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.