Examples of PhysicalNetworkVO


Examples of com.cloud.network.dao.PhysicalNetworkVO

    @Override
    @DB
    public BaremetalPxeVO addPxeServer(AddBaremetalPxeCmd cmd) {
        AddBaremetalPxePingServerCmd pcmd = (AddBaremetalPxePingServerCmd)cmd;
       
        PhysicalNetworkVO pNetwork = null;
        long zoneId;
       
        if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) {
            throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null");
        }
       
        pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId());
        if (pNetwork == null) {
            throw new IllegalArgumentException("Could not find phyical network with ID: " + cmd.getPhysicalNetworkId());
        }
        zoneId = pNetwork.getDataCenterId();
       
        PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER.getName());
        if (ntwkSvcProvider == null) {
            throw new CloudRuntimeException("Network Service Provider: " + BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER.getName() +
                    " is not enabled in the physical network: " + cmd.getPhysicalNetworkId() + "to add this device");
        } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
            throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() +
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

            throw new CloudRuntimeException(String.format("Cannot find physical network in zone %s", vm.getDataCenterId()));
        }
        if (phys.size() > 1) {
            throw new CloudRuntimeException(String.format("Baremetal only supports one physical network in zone, but zone %s has %s physical networks", vm.getDataCenterId(), phys.size()));
        }
        PhysicalNetworkVO phy = phys.get(0);
       
        SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
        //TODO: handle both kickstart and PING
        //sc.addAnd(sc.getEntity().getPodId(), Op.EQ, vm.getPodIdToDeployIn());
        sc.addAnd(sc.getEntity().getPhysicalNetworkId(), Op.EQ, phy.getId());
        BaremetalPxeVO pxeVo = sc.find();
        if (pxeVo == null) {
            throw new CloudRuntimeException("No PXE server found in pod: " + vm.getPodIdToDeployIn() + ", you need to add it before starting VM");
        }
       
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

    protected abstract boolean canHandle(NetworkOffering offering, final NetworkType networkType, PhysicalNetwork physicalNetwork);

    @Override
    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
        DataCenter dc = _dcDao.findById(plan.getDataCenterId());
        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());

        if (!canHandle(offering, dc.getNetworkType(), physnet)) {
            return null;
        }
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

        }
    }
   

    public int getVlanOffset(long physicalNetworkId, int vlanTag) {
        PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
        if (pNetwork == null) {
            throw new CloudRuntimeException("Could not find the physical Network " + physicalNetworkId + ".");
        }

        if (pNetwork.getVnet() == null) {
            throw new CloudRuntimeException("Could not find vlan range for physical Network " + physicalNetworkId + ".");
        }
        Integer lowestVlanTag = null;
        List<Pair<Integer, Integer>> vnetList = pNetwork.getVnet();
        //finding the vlanrange in which the vlanTag lies.
        for (Pair <Integer,Integer> vnet : vnetList){
            if (vlanTag >= vnet.first() && vlanTag <= vnet.second()){
                lowestVlanTag = vnet.first();
            }
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

    @Override
    public Network design(NetworkOffering offering, DeploymentPlan plan,
            Network userSpecified, Account owner) {
         // Check of the isolation type of the related physical network is VNS
        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
        if (physnet == null ||
                        physnet.getIsolationMethods() == null ||
                        !physnet.getIsolationMethods().contains("VNS")) {
            s_logger.debug("Refusing to design this network, the physical isolation type is not VNS");
            return null;
        }

        List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physnet.getId());
        if (devices.isEmpty()) {
            s_logger.error("No BigSwitxh Controller on physical network " + physnet.getName());
            return null;
        }
        s_logger.debug("BigSwitch Controller " + devices.get(0).getUuid() +
                        " found on physical network " + physnet.getId());

        s_logger.debug("Physical isolation type is VNS, asking GuestNetworkGuru to design this network");
        NetworkVO networkObject = (NetworkVO) super.design(offering, plan, userSpecified, owner);
        if (networkObject == null) {
            return null;
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

        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();
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

                    "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);
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

                        "Could not find BigSwitch controller with id: "
                                + bigswitchVnsDevice);
            }
            responseList.add(bigswitchVnsDevice);
        } else {
            PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
                    .findById(physicalNetworkId);
            if (physicalNetwork == null) {
                throw new InvalidParameterValueException(
                        "Could not find a physical network with id: "
                                + physicalNetworkId);
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO


    @Override
    @DB
    public BaremetalDhcpVO addDchpServer(AddBaremetalDhcpCmd cmd) {
        PhysicalNetworkVO pNetwork = null;
        long zoneId;

        if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) {
            throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null");
        }

        pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId());
        if (pNetwork == null) {
            throw new IllegalArgumentException("Could not find phyical network with ID: " + cmd.getPhysicalNetworkId());
        }
        zoneId = pNetwork.getDataCenterId();
        DataCenterVO zone = _dcDao.findById(zoneId);

        PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(),
            BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_PROVIDER.getName());
        if (ntwkSvcProvider == null) {
            throw new CloudRuntimeException("Network Service Provider: " + BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_PROVIDER.getName() + " is not enabled in the physical network: "
                    + cmd.getPhysicalNetworkId() + "to add this device");
        } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
View Full Code Here

Examples of com.cloud.network.dao.PhysicalNetworkVO

        BaremetalDhcpResponse response = new BaremetalDhcpResponse();
        response.setDeviceType(vo.getDeviceType());
        response.setId(vo.getUuid());
        HostVO host = _hostDao.findById(vo.getHostId());
        response.setUrl(host.getPrivateIpAddress());
        PhysicalNetworkVO nwVO = _physicalNetworkDao.findById(vo.getPhysicalNetworkId());
        response.setPhysicalNetworkId(nwVO.getUuid());
        PhysicalNetworkServiceProviderVO providerVO = _physicalNetworkServiceProviderDao.findById(vo.getNetworkServiceProviderId());
        response.setProviderId(providerVO.getUuid());
        response.setObjectName("baremetaldhcp");
        return response;
    }
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.