use of com.cloud.network.Network.Service in project cloudstack by apache.
the class NetscalerElement method verifyServicesCombination.
@Override
public boolean verifyServicesCombination(Set<Service> services) {
Set<Service> netscalerServices = new HashSet<Service>();
netscalerServices.add(Service.Lb);
netscalerServices.add(Service.StaticNat);
// NetScaler can only act as Lb and Static Nat service provider
if (services != null && !services.isEmpty() && !netscalerServices.containsAll(services)) {
s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " + services + " is not supported.");
StringBuffer buff = new StringBuffer();
for (Service service : services) {
buff.append(service.getName());
buff.append(" ");
}
s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " + buff.toString() + " is not supported.");
s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " + services + " is not supported.");
return false;
}
return true;
}
use of com.cloud.network.Network.Service in project cloudstack by apache.
the class ApiResponseHelper method createNetworkServiceProviderResponse.
@Override
public ProviderResponse createNetworkServiceProviderResponse(PhysicalNetworkServiceProvider result) {
ProviderResponse response = new ProviderResponse();
response.setId(result.getUuid());
response.setName(result.getProviderName());
PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(result.getPhysicalNetworkId());
if (pnw != null) {
response.setPhysicalNetworkId(pnw.getUuid());
}
PhysicalNetwork dnw = ApiDBUtils.findPhysicalNetworkById(result.getDestinationPhysicalNetworkId());
if (dnw != null) {
response.setDestinationPhysicalNetworkId(dnw.getUuid());
}
response.setState(result.getState().toString());
// set enabled services
List<String> services = new ArrayList<String>();
for (Service service : result.getEnabledServices()) {
services.add(service.getName());
}
response.setServices(services);
Provider serviceProvider = Provider.getProvider(result.getProviderName());
boolean canEnableIndividualServices = ApiDBUtils.canElementEnableIndividualServices(serviceProvider);
response.setCanEnableIndividualServices(canEnableIndividualServices);
response.setObjectName("networkserviceprovider");
return response;
}
use of com.cloud.network.Network.Service in project cloudstack by apache.
the class CreateNetworkOfferingTest method createIsolatedNtwkOffWithSpecifyIpRangesAndNoSourceNat.
@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, true);
assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
}
use of com.cloud.network.Network.Service in project cloudstack by apache.
the class CreateNetworkOfferingTest method createVpcNtwkOffWithNetscaler.
@Test
public void createVpcNtwkOffWithNetscaler() {
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
Set<Network.Provider> lbProvider = new HashSet<Network.Provider>();
vrProvider.add(Provider.VPCVirtualRouter);
lbProvider.add(Provider.Netscaler);
serviceProviderMap.put(Network.Service.Dhcp, vrProvider);
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, true);
// System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
}
use of com.cloud.network.Network.Service in project cloudstack by apache.
the class CreateNetworkOfferingTest method createIsolatedNtwkOffWithSpecifyIpRangesAndSourceNat.
@Test(expected = InvalidParameterValueException.class)
public void createIsolatedNtwkOffWithSpecifyIpRangesAndSourceNat() {
Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
vrProvider.add(Provider.VirtualRouter);
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
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, true);
assertNull("Isolated network offering with specifyIpRanges=true and source nat service enabled, was created", off);
}
Aggregations