Search in sources :

Example 16 with Provider

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);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Service(com.cloud.legacymodel.network.Network.Service) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Provider(com.cloud.legacymodel.network.Network.Provider) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 17 with Provider

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);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Service(com.cloud.legacymodel.network.Network.Service) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Provider(com.cloud.legacymodel.network.Network.Provider) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 18 with Provider

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);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Service(com.cloud.legacymodel.network.Network.Service) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Provider(com.cloud.legacymodel.network.Network.Provider) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 19 with Provider

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);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Service(com.cloud.legacymodel.network.Network.Service) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Provider(com.cloud.legacymodel.network.Network.Provider) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 20 with Provider

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;
}
Also used : ServiceResponse(com.cloud.api.response.ServiceResponse) EnumSet(java.util.EnumSet) HashSet(java.util.HashSet) Set(java.util.Set) VirtualRouterProviderResponse(com.cloud.api.response.VirtualRouterProviderResponse) ProviderResponse(com.cloud.api.response.ProviderResponse) ArrayList(java.util.ArrayList) Service(com.cloud.legacymodel.network.Network.Service) Map(java.util.Map) HashMap(java.util.HashMap) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) Provider(com.cloud.legacymodel.network.Network.Provider) PhysicalNetworkServiceProvider(com.cloud.network.PhysicalNetworkServiceProvider)

Aggregations

Provider (com.cloud.legacymodel.network.Network.Provider)55 Service (com.cloud.legacymodel.network.Network.Service)29 HashSet (java.util.HashSet)25 UserDataServiceProvider (com.cloud.network.element.UserDataServiceProvider)22 HashMap (java.util.HashMap)22 Set (java.util.Set)22 ArrayList (java.util.ArrayList)21 NetworkElement (com.cloud.network.element.NetworkElement)19 LoadBalancingServiceProvider (com.cloud.network.element.LoadBalancingServiceProvider)15 InvalidParameterValueException (com.cloud.legacymodel.exceptions.InvalidParameterValueException)14 StaticNatServiceProvider (com.cloud.network.element.StaticNatServiceProvider)14 CloudRuntimeException (com.cloud.legacymodel.exceptions.CloudRuntimeException)13 DhcpServiceProvider (com.cloud.network.element.DhcpServiceProvider)13 NetworkOrchestrationService (com.cloud.engine.orchestration.service.NetworkOrchestrationService)12 ResourceLimitService (com.cloud.user.ResourceLimitService)12 Network (com.cloud.legacymodel.network.Network)11 VpcProvider (com.cloud.network.element.VpcProvider)10 NicProfile (com.cloud.vm.NicProfile)10 SortedSet (java.util.SortedSet)10 NetworkVO (com.cloud.network.dao.NetworkVO)8