Search in sources :

Example 1 with VpcOfferingServiceMapVO

use of com.cloud.network.vpc.VpcOfferingServiceMapVO in project cloudstack by apache.

the class NuageVspElement method implementVpc.

@Override
public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
    List<VpcOfferingServiceMapVO> vpcOfferingServices = _vpcOfferingSrvcDao.listByVpcOffId(vpc.getVpcOfferingId());
    Map<Network.Service, Set<Network.Provider>> supportedVpcServices = NuageVspManagerImpl.NUAGE_VSP_VPC_SERVICE_MAP;
    for (VpcOfferingServiceMapVO vpcOfferingService : vpcOfferingServices) {
        Network.Service service = Network.Service.getService(vpcOfferingService.getService());
        if (!supportedVpcServices.containsKey(service)) {
            s_logger.warn(String.format("NuageVsp doesn't support service %s for VPCs", service.getName()));
            return false;
        }
        Network.Provider provider = Network.Provider.getProvider(vpcOfferingService.getProvider());
        if (!supportedVpcServices.get(service).contains(provider)) {
            s_logger.warn(String.format("NuageVsp doesn't support provider %s for service %s for VPCs", provider.getName(), service.getName()));
            return false;
        }
    }
    return true;
}
Also used : VpcOfferingServiceMapVO(com.cloud.network.vpc.VpcOfferingServiceMapVO) Set(java.util.Set) ImmutableSet(com.google.common.collect.ImmutableSet) HashSet(java.util.HashSet) Provider(com.cloud.network.Network.Provider) Network(com.cloud.network.Network) VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) PhysicalNetwork(com.cloud.network.PhysicalNetwork) Service(com.cloud.network.Network.Service) Service(com.cloud.network.Network.Service)

Example 2 with VpcOfferingServiceMapVO

use of com.cloud.network.vpc.VpcOfferingServiceMapVO in project cloudstack by apache.

the class VpcOfferingServiceMapDaoImpl method areServicesSupportedByNetworkOffering.

@Override
public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
    SearchCriteria<VpcOfferingServiceMapVO> sc = MultipleServicesSearch.create();
    sc.setParameters("vpcOffId", networkOfferingId);
    if (services != null) {
        String[] servicesStr = new String[services.length];
        int i = 0;
        for (Service service : services) {
            servicesStr[i] = service.getName();
            i++;
        }
        sc.setParameters("service", (Object[]) servicesStr);
    }
    List<VpcOfferingServiceMapVO> offeringServices = listBy(sc);
    if (services != null) {
        if (offeringServices.size() == services.length) {
            return true;
        }
    } else if (!offeringServices.isEmpty()) {
        return true;
    }
    return false;
}
Also used : VpcOfferingServiceMapVO(com.cloud.network.vpc.VpcOfferingServiceMapVO) Service(com.cloud.network.Network.Service)

Aggregations

Service (com.cloud.network.Network.Service)2 VpcOfferingServiceMapVO (com.cloud.network.vpc.VpcOfferingServiceMapVO)2 Network (com.cloud.network.Network)1 Provider (com.cloud.network.Network.Provider)1 PhysicalNetwork (com.cloud.network.PhysicalNetwork)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 VspNetwork (net.nuage.vsp.acs.client.api.model.VspNetwork)1