use of com.cloud.legacymodel.network.Network.Provider in project cosmic by MissionCriticalCloud.
the class CreateNetworkOfferingTest method createIsolatedNtwkOffWithSpecifyIpRangesAndSourceNat.
@Test(expected = InvalidParameterValueException.class)
public void createIsolatedNtwkOffWithSpecifyIpRangesAndSourceNat() {
final Map<Service, Set<Provider>> serviceProviderMap = new HashMap<>();
final Set<Network.Provider> vrProvider = new HashSet<>();
vrProvider.add(Provider.VirtualRouter);
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
final NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false, GuestType.Isolated, false, null, null, false, null, true, false, null, false, null, true);
assertNull("Isolated network offering with specifyIpRanges=true and source nat service enabled, was created", off);
}
use of com.cloud.legacymodel.network.Network.Provider in project cosmic by MissionCriticalCloud.
the class CreateNetworkOfferingTest method createIsolatedNtwkOffWithVlan.
@Test
public void createIsolatedNtwkOffWithVlan() {
final Map<Service, Set<Provider>> serviceProviderMap = new HashMap<>();
final Set<Network.Provider> vrProvider = new HashSet<>();
vrProvider.add(Provider.VirtualRouter);
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
final NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false, GuestType.Isolated, false, null, null, false, null, false, false, null, false, null, true);
assertNotNull("Isolated network offering with specifyVlan=true wasn't created", off);
}
use of com.cloud.legacymodel.network.Network.Provider in project cosmic by MissionCriticalCloud.
the class CreateNetworkOfferingTest method createIsolatedNtwkOffWithNoVlan.
// Test Isolated network offerings
@Test
public void createIsolatedNtwkOffWithNoVlan() {
final Map<Service, Set<Provider>> serviceProviderMap = new HashMap<>();
final Set<Network.Provider> vrProvider = new HashSet<>();
vrProvider.add(Provider.VirtualRouter);
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
final NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false, GuestType.Isolated, false, null, null, false, null, false, false, null, false, null, true);
assertNotNull("Isolated network offering with specifyIpRanges=false failed to create ", off);
}
use of com.cloud.legacymodel.network.Network.Provider in project cosmic by MissionCriticalCloud.
the class CreateNetworkOfferingTest method createVpcNtwkOff.
@Test
public void createVpcNtwkOff() {
final Map<Service, Set<Provider>> serviceProviderMap = new HashMap<>();
final Set<Network.Provider> vrProvider = new HashSet<>();
vrProvider.add(Provider.VPCVirtualRouter);
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, vrProvider);
final NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false, GuestType.Isolated, false, null, null, false, null, false, false, null, false, null, true);
// System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
}
use of com.cloud.legacymodel.network.Network.Provider in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method getServiceResponses.
private List<ServiceResponse> getServiceResponses(final Map<Service, Set<Provider>> serviceProviderMap) {
final List<ServiceResponse> serviceResponses = new ArrayList<>();
for (final Map.Entry<Service, Set<Provider>> entry : serviceProviderMap.entrySet()) {
final Service service = entry.getKey();
final Set<Provider> serviceProviders = entry.getValue();
final ServiceResponse svcRsp = new ServiceResponse();
// skip gateway service
if (service == Service.Gateway) {
continue;
}
svcRsp.setName(service.getName());
final List<ProviderResponse> providers = getProviderResponses(serviceProviders);
svcRsp.setProviders(providers);
serviceResponses.add(svcRsp);
}
return serviceResponses;
}
Aggregations