Search in sources :

Example 6 with NetworkServiceMapVO

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

the class NetworkModelImpl method getNetworkCapabilities.

@Override
public Map<Service, Map<Capability, String>> getNetworkCapabilities(final long networkId) {
    final Map<Service, Map<Capability, String>> networkCapabilities = new HashMap<>();
    // list all services of this networkOffering
    final List<NetworkServiceMapVO> servicesMap = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (final NetworkServiceMapVO instance : servicesMap) {
        final Service service = Service.getService(instance.getService());
        final NetworkElement element = getElementImplementingProvider(instance.getProvider());
        if (element != null) {
            final 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) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) Map(java.util.Map) HashMap(java.util.HashMap)

Example 7 with NetworkServiceMapVO

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

the class NetworkOrchestrator method getServicesNotSupportedInNewOffering.

@Override
public List<String> getServicesNotSupportedInNewOffering(Network network, long newNetworkOfferingId) {
    NetworkOffering offering = _networkOfferingDao.findById(newNetworkOfferingId);
    List<String> services = _ntwkOfferingSrvcDao.listServicesForNetworkOffering(offering.getId());
    List<NetworkServiceMapVO> serviceMap = _ntwkSrvcDao.getServicesInNetwork(network.getId());
    List<String> servicesNotInNewOffering = new ArrayList<>();
    for (NetworkServiceMapVO serviceVO : serviceMap) {
        boolean inlist = false;
        for (String service : services) {
            if (serviceVO.getService().equalsIgnoreCase(service)) {
                inlist = true;
                break;
            }
        }
        if (!inlist) {
            // behaviour of network.
            if (!serviceVO.getService().equalsIgnoreCase(Service.Gateway.getName()))
                servicesNotInNewOffering.add(serviceVO.getService());
        }
    }
    return servicesNotInNewOffering;
}
Also used : NetworkOffering(com.cloud.offering.NetworkOffering) ArrayList(java.util.ArrayList) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO)

Example 8 with NetworkServiceMapVO

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

the class NetworkOrchestrator method getServiceProvidersMap.

private Map<Service, Set<Provider>> getServiceProvidersMap(final long networkId) {
    final Map<Service, Set<Provider>> map = new HashMap<Service, Set<Provider>>();
    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<Provider>();
        }
        providers.add(Provider.getProvider(nsm.getProvider()));
        map.put(Service.getService(nsm.getService()), providers);
    }
    return map;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) NetworkOrchestrationService(org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService) Service(com.cloud.network.Network.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ResourceLimitService(com.cloud.user.ResourceLimitService) VpcVirtualNetworkApplianceService(com.cloud.network.VpcVirtualNetworkApplianceService) AnnotationService(org.apache.cloudstack.annotation.AnnotationService) RemoteAccessVpnService(com.cloud.network.vpn.RemoteAccessVpnService) NetworkServiceMapVO(com.cloud.network.dao.NetworkServiceMapVO) DnsServiceProvider(com.cloud.network.element.DnsServiceProvider) UserDataServiceProvider(com.cloud.network.element.UserDataServiceProvider) DhcpServiceProvider(com.cloud.network.element.DhcpServiceProvider) LoadBalancingServiceProvider(com.cloud.network.element.LoadBalancingServiceProvider) StaticNatServiceProvider(com.cloud.network.element.StaticNatServiceProvider) Provider(com.cloud.network.Network.Provider)

Example 9 with NetworkServiceMapVO

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

the class NetworkModelImpl method getProviderServicesMap.

Map<Provider, Set<Service>> getProviderServicesMap(long networkId) {
    Map<Provider, Set<Service>> map = new HashMap<Provider, Set<Service>>();
    List<NetworkServiceMapVO> nsms = _ntwkSrvcDao.getServicesInNetwork(networkId);
    for (NetworkServiceMapVO nsm : nsms) {
        Set<Service> services = map.get(Provider.getProvider(nsm.getProvider()));
        if (services == null) {
            services = new HashSet<Service>();
        }
        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) 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)

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