Search in sources :

Example 1 with NetworkServiceMapVO

use of com.cloud.network.dao.NetworkServiceMapVO in project cloudstack by apache.

the class NetworkModelImpl method getServiceProvidersMap.

Map<Service, Set<Provider>> getServiceProvidersMap(long networkId) {
    Map<Service, Set<Provider>> map = new HashMap<Service, Set<Provider>>();
    List<NetworkServiceMapVO> nsms = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (NetworkServiceMapVO nsm : nsms) {
        Set<Provider> providers = map.get(Service.getService(nsm.getService()));
        if (providers == null) {
            providers = new HashSet<Provider>();
        }
        providers.add(Provider.getProvider(nsm.getProvider()));
        map.put(Service.getService(nsm.getService()), providers);
    }
    return map;
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NetworkOrchestrationService(org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService) Service(com.cloud.network.Network.Service) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) UserDataServiceProvider(com.cloud.network.element.UserDataServiceProvider) Provider(com.cloud.network.Network.Provider)

Example 2 with NetworkServiceMapVO

use of com.cloud.network.dao.NetworkServiceMapVO in project cloudstack by apache.

the class NetworkModelImpl method getNetworkCapabilities.

@Override
public Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId) {
    Map<Service, Map<Capability, String>> networkCapabilities = new HashMap<Service, Map<Capability, String>>();
    // list all services of this networkOffering
    List<NetworkServiceMapVO> servicesMap = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (NetworkServiceMapVO instance : servicesMap) {
        Service service = Service.getService(instance.getService());
        NetworkElement element = getElementImplementingProvider(instance.getProvider());
        if (element != null) {
            Map<Service, Map<Capability, String>> elementCapabilities = element.getCapabilities();
            if (elementCapabilities != null) {
                networkCapabilities.put(service, elementCapabilities.get(service));
            }
        }
    }
    return networkCapabilities;
}
Also used : NetworkElement(com.cloud.network.element.NetworkElement) Capability(com.cloud.network.Network.Capability) HashMap(java.util.HashMap) NetworkOrchestrationService(org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService) Service(com.cloud.network.Network.Service) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with NetworkServiceMapVO

use of com.cloud.network.dao.NetworkServiceMapVO in project cosmic by MissionCriticalCloud.

the class NetworkOrchestrator method getServiceProvidersMap.

private Map<Service, Set<Provider>> getServiceProvidersMap(final long networkId) {
    final Map<Service, Set<Provider>> map = new HashMap<>();
    final List<NetworkServiceMapVO> nsms = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (final NetworkServiceMapVO nsm : nsms) {
        Set<Provider> providers = map.get(Service.getService(nsm.getService()));
        if (providers == null) {
            providers = new HashSet<>();
        }
        providers.add(Provider.getProvider(nsm.getProvider()));
        map.put(Service.getService(nsm.getService()), providers);
    }
    return map;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) NetworkOrchestrationService(com.cloud.engine.orchestration.service.NetworkOrchestrationService) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ResourceLimitService(com.cloud.user.ResourceLimitService) VpcVirtualNetworkApplianceService(com.cloud.network.VpcVirtualNetworkApplianceService) RemoteAccessVpnService(com.cloud.network.vpn.RemoteAccessVpnService) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) UserDataServiceProvider(com.cloud.network.element.UserDataServiceProvider) LoadBalancingServiceProvider(com.cloud.network.element.LoadBalancingServiceProvider) StaticNatServiceProvider(com.cloud.network.element.StaticNatServiceProvider) DhcpServiceProvider(com.cloud.network.element.DhcpServiceProvider) Provider(com.cloud.network.Network.Provider)

Example 4 with NetworkServiceMapVO

use of com.cloud.network.dao.NetworkServiceMapVO in project cosmic by MissionCriticalCloud.

the class NetworkModelImpl method getProviderServicesMap.

Map<Provider, Set<Service>> getProviderServicesMap(final long networkId) {
    final Map<Provider, Set<Service>> map = new HashMap<>();
    final List<NetworkServiceMapVO> nsms = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (final NetworkServiceMapVO nsm : nsms) {
        Set<Service> services = map.get(Provider.getProvider(nsm.getProvider()));
        if (services == null) {
            services = new HashSet<>();
        }
        services.add(Service.getService(nsm.getService()));
        map.put(Provider.getProvider(nsm.getProvider()), services);
    }
    return map;
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) SortedSet(java.util.SortedSet) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) UserDataServiceProvider(com.cloud.network.element.UserDataServiceProvider) Provider(com.cloud.network.Network.Provider)

Example 5 with NetworkServiceMapVO

use of com.cloud.network.dao.NetworkServiceMapVO in project cosmic by MissionCriticalCloud.

the class NetworkModelImpl method getServiceProvidersMap.

Map<Service, Set<Provider>> getServiceProvidersMap(final long networkId) {
    final Map<Service, Set<Provider>> map = new HashMap<>();
    final List<NetworkServiceMapVO> nsms = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (final NetworkServiceMapVO nsm : nsms) {
        Set<Provider> providers = map.get(Service.getService(nsm.getService()));
        if (providers == null) {
            providers = new HashSet<>();
        }
        providers.add(Provider.getProvider(nsm.getProvider()));
        map.put(Service.getService(nsm.getService()), providers);
    }
    return map;
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) SortedSet(java.util.SortedSet) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) UserDataServiceProvider(com.cloud.network.element.UserDataServiceProvider) Provider(com.cloud.network.Network.Provider)

Aggregations

NetworkServiceMapVO (com.cloud.network.dao.NetworkServiceMapVO)9 Service (com.cloud.network.Network.Service)8 HashMap (java.util.HashMap)8 Provider (com.cloud.network.Network.Provider)6 UserDataServiceProvider (com.cloud.network.element.UserDataServiceProvider)6 HashSet (java.util.HashSet)6 Set (java.util.Set)6 TreeSet (java.util.TreeSet)4 NetworkOrchestrationService (org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService)4 VpcVirtualNetworkApplianceService (com.cloud.network.VpcVirtualNetworkApplianceService)2 DhcpServiceProvider (com.cloud.network.element.DhcpServiceProvider)2 LoadBalancingServiceProvider (com.cloud.network.element.LoadBalancingServiceProvider)2 NetworkElement (com.cloud.network.element.NetworkElement)2 StaticNatServiceProvider (com.cloud.network.element.StaticNatServiceProvider)2 RemoteAccessVpnService (com.cloud.network.vpn.RemoteAccessVpnService)2 ResourceLimitService (com.cloud.user.ResourceLimitService)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 SortedSet (java.util.SortedSet)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2