Search in sources :

Example 1 with ConfigurationManager

use of com.cloud.configuration.ConfigurationManager in project cloudstack by apache.

the class ManagementServerMock method locateZone.

private void locateZone() {
    _zone = _zoneDao.findByName("default");
    if (_zone == null) {
        ConfigurationManager mgr = (ConfigurationManager) _configService;
        _zone = mgr.createZone(User.UID_SYSTEM, "default", "8.8.8.8", null, "8.8.4.4", null, null, /* cidr */
        "ROOT", Domain.ROOT_DOMAIN, NetworkType.Advanced, null, null, /* networkDomain */
        false, false, null, null);
    }
}
Also used : ConfigurationManager(com.cloud.configuration.ConfigurationManager)

Example 2 with ConfigurationManager

use of com.cloud.configuration.ConfigurationManager in project cloudstack by apache.

the class ContrailManagerImpl method locatePublicNetworkOffering.

private NetworkOffering locatePublicNetworkOffering(String offeringName, String offeringDisplayText, Provider provider) {
    List<? extends NetworkOffering> offerList = _configService.listNetworkOfferings(TrafficType.Public, false);
    for (NetworkOffering offer : offerList) {
        if (offer.getName().equals(offeringName)) {
            if (offer.getState() != NetworkOffering.State.Enabled) {
                return EnableNetworkOffering(offer.getId());
            }
            return offer;
        }
    }
    Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Service, Set<Provider>>();
    Set<Provider> providerSet = new HashSet<Provider>();
    providerSet.add(provider);
    final Service[] services = { Service.Connectivity, Service.Dhcp, Service.NetworkACL, Service.StaticNat, Service.SourceNat };
    for (Service svc : services) {
        serviceProviderMap.put(svc, providerSet);
    }
    ConfigurationManager configMgr = (ConfigurationManager) _configService;
    NetworkOfferingVO voffer = configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Public, null, true, Availability.Optional, null, serviceProviderMap, true, Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false, null, null, true);
    long id = voffer.getId();
    _networkOfferingDao.update(id, voffer);
    return _networkOfferingDao.findById(id);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) NetworkOffering(com.cloud.offering.NetworkOffering) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) VpcProvisioningService(com.cloud.network.vpc.VpcProvisioningService) ConfigurationService(com.cloud.configuration.ConfigurationService) Provider(com.cloud.network.Network.Provider) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) ConfigurationManager(com.cloud.configuration.ConfigurationManager) HashSet(java.util.HashSet)

Example 3 with ConfigurationManager

use of com.cloud.configuration.ConfigurationManager in project cloudstack by apache.

the class ContrailManagerImpl method locateNetworkOffering.

private NetworkOffering locateNetworkOffering(String offeringName, String offeringDisplayText, Provider provider) {
    List<? extends NetworkOffering> offerList = _configService.listNetworkOfferings(TrafficType.Guest, false);
    for (NetworkOffering offer : offerList) {
        if (offer.getName().equals(offeringName)) {
            if (offer.getState() != NetworkOffering.State.Enabled) {
                return EnableNetworkOffering(offer.getId());
            }
            return offer;
        }
    }
    Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Service, Set<Provider>>();
    Set<Provider> providerSet = new HashSet<Provider>();
    providerSet.add(provider);
    final Service[] services = { Service.Connectivity, Service.Dhcp, Service.NetworkACL, Service.StaticNat, Service.SourceNat, Service.Lb };
    for (Service svc : services) {
        if (svc == Service.Lb) {
            if (offeringName.equals(vpcRouterOfferingName)) {
                Set<Provider> lbProviderSet = new HashSet<Provider>();
                lbProviderSet.add(Provider.InternalLbVm);
                serviceProviderMap.put(svc, lbProviderSet);
            }
            continue;
        }
        serviceProviderMap.put(svc, providerSet);
    }
    ConfigurationManager configMgr = (ConfigurationManager) _configService;
    NetworkOfferingVO voffer = configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true, Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName), null, null, true);
    if (offeringName.equals(vpcRouterOfferingName)) {
        voffer.setInternalLb(true);
    }
    long id = voffer.getId();
    _networkOfferingDao.update(id, voffer);
    return _networkOfferingDao.findById(id);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) NetworkOffering(com.cloud.offering.NetworkOffering) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) VpcProvisioningService(com.cloud.network.vpc.VpcProvisioningService) ConfigurationService(com.cloud.configuration.ConfigurationService) Provider(com.cloud.network.Network.Provider) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) ConfigurationManager(com.cloud.configuration.ConfigurationManager) HashSet(java.util.HashSet)

Aggregations

ConfigurationManager (com.cloud.configuration.ConfigurationManager)3 ConfigurationService (com.cloud.configuration.ConfigurationService)2 Provider (com.cloud.network.Network.Provider)2 Service (com.cloud.network.Network.Service)2 VpcProvisioningService (com.cloud.network.vpc.VpcProvisioningService)2 NetworkOffering (com.cloud.offering.NetworkOffering)2 NetworkOfferingVO (com.cloud.offerings.NetworkOfferingVO)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2