Package com.cloud.offerings

Examples of com.cloud.offerings.NetworkOfferingVO


    @Test
    public void createIsolatedNtwkOffWithSpecifyIpRangesAndNoSourceNat() {
       
        Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
        Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
        NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false,
                Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false,
                null, false, null, true, false, null, false, null);
        assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
       
    }
View Full Code Here


        serviceProviderMap.put(Network.Service.Dns , vrProvider);
        serviceProviderMap.put(Network.Service.Lb , vrProvider);
        serviceProviderMap.put(Network.Service.SourceNat , vrProvider);
        serviceProviderMap.put(Network.Service.Gateway , vrProvider);
        serviceProviderMap.put(Network.Service.Lb , vrProvider);
        NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
                Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false,
                null, false, null, false, false, null, false, null);
        // System.out.println("Creating Vpc Network Offering");
        assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
    }
View Full Code Here

        serviceProviderMap.put(Network.Service.Dns, vrProvider);
        serviceProviderMap.put(Network.Service.Lb, vrProvider);
        serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
        serviceProviderMap.put(Network.Service.Gateway, vrProvider);
        serviceProviderMap.put(Network.Service.Lb, lbProvider);
        NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
                Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false,
                null, false, false, null, false, null);
        // System.out.println("Creating Vpc Network Offering");
        assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
    }
View Full Code Here

    }

    @Override
    public NetworkOfferingVO persistDefaultNetworkOffering(NetworkOfferingVO offering) {
        assert offering.getUniqueName() != null : "how are you going to find this later if you don't set it?";
        NetworkOfferingVO vo = findByUniqueName(offering.getUniqueName());
        if (vo != null) {
            return vo;
        }
        try {
            vo = persist(offering);
View Full Code Here

    @Override
    @DB
    public boolean remove(Long networkOfferingId) {
        Transaction txn = Transaction.currentTxn();
        txn.start();
        NetworkOfferingVO offering = findById(networkOfferingId);
        offering.setUniqueName(null);
        update(networkOfferingId, offering);
        boolean result = super.remove(networkOfferingId);
        txn.commit();
        return result;
    }
View Full Code Here

    @DB
    public NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details) {
        Transaction txn = Transaction.currentTxn();
        txn.start();
        //1) persist the offering
        NetworkOfferingVO vo = super.persist(off);
       
        //2) persist the details
        if (details != null && !details.isEmpty()) {
            for (NetworkOffering.Detail detail : details.keySet()) {
                _detailsDao.persist(new NetworkOfferingDetailsVO(off.getId(), detail, details.get(detail)));
View Full Code Here

    }
   
   
    @Override
    public NetworkOfferingVO findById(Long id) {
        NetworkOfferingVO vo = null;
        if (id.longValue() == 1) {
            //network offering valid for vpc
            vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false,
                    Availability.Optional, null, Network.GuestType.Isolated, false, false, false, false, false);
        } else if (id.longValue() == 2) {
            //invalid offering - source nat is not included
            vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false,
                    Availability.Optional, null, Network.GuestType.Isolated, false, false, false, false, false);
        } else if (id.longValue() == 3) {
            //network offering invalid for vpc (conserve mode off)
            vo = new NetworkOfferingVO("non vpc", "non vpc", TrafficType.Guest, false, true, null, null, false,
                    Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false, false);
        } else if (id.longValue() == 4) {
            //network offering invalid for vpc (Shared)
            vo = new NetworkOfferingVO("non vpc", "non vpc", TrafficType.Guest, false, true, null, null, false,
                    Availability.Optional, null, Network.GuestType.Shared, false, false, false, false, false);
        } else if (id.longValue() == 5) {
            //network offering invalid for vpc (has redundant router)
            vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false,
                    Availability.Optional, null, Network.GuestType.Isolated, false, false, false, false, false);
            vo.setRedundantRouter(true);
        } else if (id.longValue() == 6) {
            //network offering invalid for vpc (has lb service)  
            vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false,
                    Availability.Optional, null, Network.GuestType.Isolated, false, false, false, false, false);
        }
       
        if (vo != null) {
            vo = setId(vo, id);
View Full Code Here

       
        return vo;
    }
   
    private NetworkOfferingVO setId(NetworkOfferingVO vo, long id) {
        NetworkOfferingVO voToReturn = vo;
        Class<?> c = voToReturn.getClass();
        try {
            Field f = c.getDeclaredField("id");
            f.setAccessible(true);
            f.setLong(voToReturn, id);
        } catch (NoSuchFieldException ex) {
View Full Code Here

        if (!canHandle(network, null)) {
            return false;
        }

        NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
        if (offering.isSystemOnly()) {
            return false;
        }
        if (!_networkMgr.isProviderEnabledInPhysicalNetwork(_networkMgr.getPhysicalNetworkId(network), getProvider().getName())) {
            return false;
        }

        @SuppressWarnings("unchecked")
        VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
        List<DomainRouterVO> routers = _routerMgr.deployVirtualRouterInGuestNetwork(network, dest,
                _accountMgr.getAccount(network.getAccountId()),
                uservm.getParameters(), offering.getRedundantRouter());
        if ((routers == null) || (routers.size() == 0)) {
            throw new ResourceUnavailableException("Can't find at least one running router!",
                    DataCenter.class, network.getDataCenterId());
        }
        return true;     
View Full Code Here

        }
        return false;
    }

    protected boolean isSharedNetworkOfferingWithServices(long networkOfferingId) {
        NetworkOfferingVO networkOffering = _networkOfferingDao.findById(networkOfferingId);
        if ( (networkOffering.getGuestType()  == Network.GuestType.Shared) && (
                areServicesSupportedByNetworkOffering(networkOfferingId, Service.SourceNat) ||
                areServicesSupportedByNetworkOffering(networkOfferingId, Service.StaticNat) ||
                areServicesSupportedByNetworkOffering(networkOfferingId, Service.Firewall) ||
                areServicesSupportedByNetworkOffering(networkOfferingId, Service.PortForwarding) ||
                areServicesSupportedByNetworkOffering(networkOfferingId, Service.Lb))) {
View Full Code Here

TOP

Related Classes of com.cloud.offerings.NetworkOfferingVO

Copyright © 2018 www.massapicom. 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.