lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp, tcp-proxy"); lbCapabilities.put(Capability.SupportedStickinessMethods, getHAProxyStickinessCapability()); lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString());
lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString());
lbProviders.add(lbProvider); if (detail == NetworkOffering.Detail.InternalLbProvider) { _networkModel.checkCapabilityForProvider(lbProviders, Service.Lb, Capability.LbSchemes, Scheme.Internal.toString()); } else if (detail == NetworkOffering.Detail.PublicLbProvider) { _networkModel.checkCapabilityForProvider(lbProviders, Service.Lb, Capability.LbSchemes, Scheme.Public.toString());
private boolean canHandle(Network config, Scheme lbScheme) { //works in Advance zone only DataCenter dc = _entityMgr.findById(DataCenter.class, config.getDataCenterId()); if (dc.getNetworkType() != NetworkType.Advanced) { s_logger.trace("Not hanling zone of network type " + dc.getNetworkType()); return false; } if (config.getGuestType() != Network.GuestType.Isolated || config.getTrafficType() != TrafficType.Guest) { s_logger.trace("Not handling network with Type " + config.getGuestType() + " and traffic type " + config.getTrafficType()); return false; } Map<Capability, String> lbCaps = getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null && lbScheme != null) { if (!schemeCaps.contains(lbScheme.toString())) { s_logger.debug("Scheme " + lbScheme.toString() + " is not supported by the provider " + getName()); return false; } } } if (!_ntwkModel.isProviderSupportServiceInNetwork(config.getId(), Service.Lb, getProvider())) { s_logger.trace("Element " + getProvider().getName() + " doesn't support service " + Service.Lb + " in the network " + config); return false; } return true; }
@Override public void isLbServiceSupportedInNetwork(long networkId, Scheme scheme) { Network network = _networkDao.findById(networkId); //1) Check if the LB service is supported if (!_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb)) { InvalidParameterValueException ex = new InvalidParameterValueException("LB service is not supported in specified network id"); ex.addProxyObject(network.getUuid(), "networkId"); throw ex; } //2) Check if the Scheme is supported\ NetworkOffering off = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); if (scheme == Scheme.Public) { if (!off.isPublicLb()) { throw new InvalidParameterValueException("Scheme " + scheme + " is not supported by the network offering " + off); } } else { if (!off.isInternalLb()) { throw new InvalidParameterValueException("Scheme " + scheme + " is not supported by the network offering " + off); } } //3) Check if the provider supports the scheme LoadBalancingServiceProvider lbProvider = _networkMgr.getLoadBalancingProviderForNetwork(network, scheme); if (lbProvider == null) { throw new InvalidParameterValueException("Lb rule with scheme " + scheme.toString() + " is not supported by lb providers in network " + network); } }
@Override public LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(final Network network, final Scheme lbScheme) { final List<NetworkElement> lbElements = getElementForServiceInNetwork(network, Service.Lb); NetworkElement lbElement = null; if (lbElements.size() > 1) { String providerName = null; //get network offering details final NetworkOffering off = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); if (lbScheme == Scheme.Public) { providerName = _ntwkOffDetailsDao.getDetail(off.getId(), NetworkOffering.Detail.PublicLbProvider); } else { providerName = _ntwkOffDetailsDao.getDetail(off.getId(), NetworkOffering.Detail.InternalLbProvider); } if (providerName == null) { throw new InvalidParameterValueException("Can't find Lb provider supporting scheme " + lbScheme.toString() + " in network " + network); } lbElement = _networkModel.getElementImplementingProvider(providerName); } else if (lbElements.size() == 1) { lbElement = lbElements.get(0); } assert lbElement != null; assert lbElement instanceof LoadBalancingServiceProvider; return (LoadBalancingServiceProvider)lbElement; }
private static Map<Service, Map<Capability, String>> setCapabilities() { final Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>(); // L2 Support : SDN provisioning final Map<Capability, String> connectivityCapabilities = new HashMap<Capability, String>(); connectivityCapabilities.put(Capability.DistributedRouter, null); connectivityCapabilities.put(Capability.StretchedL2Subnet, null); connectivityCapabilities.put(Capability.RegionLevelVpc, null); capabilities.put(Service.Connectivity, connectivityCapabilities); // L3 Support : Port Forwarding capabilities.put(Service.PortForwarding, null); // L3 support : StaticNat capabilities.put(Service.StaticNat, null); // L3 support : Load Balancer // Set capabilities for LB service final Map<Capability, String> lbCapabilities = new HashMap<Capability, String>(); lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn,source"); lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated"); lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp"); lbCapabilities.put(Capability.SupportedStickinessMethods, getHAProxyStickinessCapability()); lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString()); capabilities.put(Service.Lb, lbCapabilities); return capabilities; }
private boolean canHandle(Network network, List<LoadBalancingRule> rules) { if (network.getGuestType() != Network.GuestType.Shared || network.getTrafficType() != TrafficType.Guest) { s_logger.debug("Not handling network with type " + network.getGuestType() + " and traffic type " + network.getTrafficType()); return false; } Map<Capability, String> lbCaps = this.getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null) { for (LoadBalancingRule rule : rules) { if (!schemeCaps.contains(rule.getScheme().toString())) { s_logger.debug("Scheme " + rules.get(0).getScheme() + " is not supported by the provider " + this.getName()); return false; } } } } return true; }
private boolean canHandleLbRules(final List<LoadBalancingRule> rules) { final Map<Capability, String> lbCaps = getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { final String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null) { for (final LoadBalancingRule rule : rules) { if (!schemeCaps.contains(rule.getScheme().toString())) { s_logger.debug("Scheme " + rules.get(0).getScheme() + " is not supported by the provider " + getName()); return false; } } } } return true; }
private boolean canHandleLbRules(List<LoadBalancingRule> rules) { Map<Capability, String> lbCaps = getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null) { for (LoadBalancingRule rule : rules) { if (!schemeCaps.contains(rule.getScheme().toString())) { s_logger.debug("Scheme " + rules.get(0).getScheme() + " is not supported by the provider " + getName()); return false; } } } } return true; }
private boolean canHandleLbRules(final List<LoadBalancingRule> rules) { final Map<Capability, String> lbCaps = getCapabilities().get(Service.Lb); if (!lbCaps.isEmpty()) { final String schemeCaps = lbCaps.get(Capability.LbSchemes); if (schemeCaps != null) { for (final LoadBalancingRule rule : rules) { if (!schemeCaps.contains(rule.getScheme().toString())) { s_logger.debug("Scheme " + rules.get(0).getScheme() + " is not supported by the provider " + getName()); return false; } } } } return true; }
public Scheme getScheme() { if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) { return Scheme.Internal; } else { throw new InvalidParameterValueException("Invalid value for scheme. Supported value is internal"); } }
public Scheme getScheme() { if (scheme != null) { if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) { return Scheme.Internal; } else { throw new InvalidParameterValueException("Invalid value for scheme. Supported value is internal"); } } return null; }
private static Map<Service, Map<Capability, String>> setCapabilities() { Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>(); Map<Capability, String> lbCapabilities = new HashMap<Capability, String>(); lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn,source"); lbCapabilities.put(Capability.SupportedLBIsolation, "shared"); lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp"); lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString()); capabilities.put(Service.Lb, lbCapabilities); return capabilities; }
private static Map<Service, Map<Capability, String>> setCapabilities() { Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>(); // Set capabilities for LB service Map<Capability, String> lbCapabilities = new HashMap<Capability, String>(); lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn,source"); lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated"); lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp"); lbCapabilities.put(Capability.SupportedStickinessMethods, VirtualRouterElement.getHAProxyStickinessCapability()); lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Internal.toString()); capabilities.put(Service.Lb, lbCapabilities); return capabilities; }