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);
}
}
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);
}
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);
}
Aggregations