use of com.cloud.network.rules.LbStickinessMethod in project cloudstack by apache.
the class OvsElement method getHAProxyStickinessCapability.
public static String getHAProxyStickinessCapability() {
LbStickinessMethod method;
final List<LbStickinessMethod> methodList = new ArrayList<LbStickinessMethod>(1);
method = new LbStickinessMethod(StickinessMethodType.LBCookieBased, "This is loadbalancer cookie based stickiness method.");
method.addParam("cookie-name", false, "Cookie name passed in http header by the LB to the client.", false);
method.addParam("mode", false, "Valid values: insert, rewrite, prefix. Default value: insert. In the insert mode cookie will be created" + " by the LB. In other modes, cookie will be created by the server and LB modifies it.", false);
method.addParam("nocache", false, "This option is recommended in conjunction with the insert mode when there is a cache between the client" + " and HAProxy, as it ensures that a cacheable response will be tagged non-cacheable if a cookie needs " + "to be inserted. This is important because if all persistence cookies are added on a cacheable home page" + " for instance, then all customers will then fetch the page from an outer cache and will all share the " + "same persistence cookie, leading to one server receiving much more traffic than others. See also the " + "insert and postonly options. ", true);
method.addParam("indirect", false, "When this option is specified in insert mode, cookies will only be added when the server was not reached" + " after a direct access, which means that only when a server is elected after applying a load-balancing algorithm," + " or after a redispatch, then the cookie will be inserted. If the client has all the required information" + " to connect to the same server next time, no further cookie will be inserted. In all cases, when the " + "indirect option is used in insert mode, the cookie is always removed from the requests transmitted to " + "the server. The persistence mechanism then becomes totally transparent from the application point of view.", true);
method.addParam("postonly", false, "This option ensures that cookie insertion will only be performed on responses to POST requests. It is an" + " alternative to the nocache option, because POST responses are not cacheable, so this ensures that the " + "persistence cookie will never get cached.Since most sites do not need any sort of persistence before the" + " first POST which generally is a login request, this is a very efficient method to optimize caching " + "without risking to find a persistence cookie in the cache. See also the insert and nocache options.", true);
method.addParam("domain", false, "This option allows to specify the domain at which a cookie is inserted. It requires exactly one parameter:" + " a valid domain name. If the domain begins with a dot, the browser is allowed to use it for any host " + "ending with that name. It is also possible to specify several domain names by invoking this option multiple" + " times. Some browsers might have small limits on the number of domains, so be careful when doing that. " + "For the record, sending 10 domains to MSIE 6 or Firefox 2 works as expected.", false);
methodList.add(method);
method = new LbStickinessMethod(StickinessMethodType.AppCookieBased, "This is App session based sticky method. Define session stickiness on an existing application cookie. " + "It can be used only for a specific http traffic");
method.addParam("cookie-name", false, "This is the name of the cookie used by the application and which LB will " + "have to learn for each new session. Default value: Auto geneared based on ip", false);
method.addParam("length", false, "This is the max number of characters that will be memorized and checked in " + "each cookie value. Default value:52", false);
method.addParam("holdtime", false, "This is the time after which the cookie will be removed from memory if unused. The value should be in " + "the format Example : 20s or 30m or 4h or 5d . only seconds(s), minutes(m) hours(h) and days(d) are valid," + " cannot use th combinations like 20h30m. Default value:3h ", false);
method.addParam("request-learn", false, "If this option is specified, then haproxy will be able to learn the cookie found in the request in case the server does not specify any in response. This is typically what happens with PHPSESSID cookies, or when haproxy's session expires before the application's session and the correct server is selected. It is recommended to specify this option to improve reliability", true);
method.addParam("prefix", false, "When this option is specified, haproxy will match on the cookie prefix (or URL parameter prefix). " + "The appsession value is the data following this prefix. Example : appsession ASPSESSIONID len 64 timeout 3h prefix This will match the cookie ASPSESSIONIDXXXX=XXXXX, the appsession value will be XXXX=XXXXX.", true);
method.addParam("mode", false, "This option allows to change the URL parser mode. 2 modes are currently supported : - path-parameters " + ": The parser looks for the appsession in the path parameters part (each parameter is separated by a semi-colon), " + "which is convenient for JSESSIONID for example.This is the default mode if the option is not set. - query-string :" + " In this mode, the parser will look for the appsession in the query string.", false);
methodList.add(method);
method = new LbStickinessMethod(StickinessMethodType.SourceBased, "This is source based Stickiness method, " + "it can be used for any type of protocol.");
method.addParam("tablesize", false, "Size of table to store source ip addresses. example: tablesize=200k or 300m" + " or 400g. Default value:200k", false);
method.addParam("expire", false, "Entry in source ip table will expire after expire duration. units can be s,m,h,d ." + " example: expire=30m 20s 50h 4d. Default value:3h", false);
methodList.add(method);
final Gson gson = new Gson();
final String capability = gson.toJson(methodList);
return capability;
}
use of com.cloud.network.rules.LbStickinessMethod in project cloudstack by apache.
the class VirtualRouterElement method getHAProxyStickinessCapability.
public static String getHAProxyStickinessCapability() {
LbStickinessMethod method;
final List<LbStickinessMethod> methodList = new ArrayList<LbStickinessMethod>(1);
method = new LbStickinessMethod(StickinessMethodType.LBCookieBased, "This is loadbalancer cookie based stickiness method.");
method.addParam("cookie-name", false, "Cookie name passed in http header by the LB to the client.", false);
method.addParam("mode", false, "Valid values: insert, rewrite, prefix. Default value: insert. In the insert mode cookie will be created" + " by the LB. In other modes, cookie will be created by the server and LB modifies it.", false);
method.addParam("nocache", false, "This option is recommended in conjunction with the insert mode when there is a cache between the client" + " and HAProxy, as it ensures that a cacheable response will be tagged non-cacheable if a cookie needs " + "to be inserted. This is important because if all persistence cookies are added on a cacheable home page" + " for instance, then all customers will then fetch the page from an outer cache and will all share the " + "same persistence cookie, leading to one server receiving much more traffic than others. See also the " + "insert and postonly options. ", true);
method.addParam("indirect", false, "When this option is specified in insert mode, cookies will only be added when the server was not reached" + " after a direct access, which means that only when a server is elected after applying a load-balancing algorithm," + " or after a redispatch, then the cookie will be inserted. If the client has all the required information" + " to connect to the same server next time, no further cookie will be inserted. In all cases, when the " + "indirect option is used in insert mode, the cookie is always removed from the requests transmitted to " + "the server. The persistence mechanism then becomes totally transparent from the application point of view.", true);
method.addParam("postonly", false, "This option ensures that cookie insertion will only be performed on responses to POST requests. It is an" + " alternative to the nocache option, because POST responses are not cacheable, so this ensures that the " + "persistence cookie will never get cached.Since most sites do not need any sort of persistence before the" + " first POST which generally is a login request, this is a very efficient method to optimize caching " + "without risking to find a persistence cookie in the cache. See also the insert and nocache options.", true);
method.addParam("domain", false, "This option allows to specify the domain at which a cookie is inserted. It requires exactly one parameter:" + " a valid domain name. If the domain begins with a dot, the browser is allowed to use it for any host " + "ending with that name. It is also possible to specify several domain names by invoking this option multiple" + " times. Some browsers might have small limits on the number of domains, so be careful when doing that. " + "For the record, sending 10 domains to MSIE 6 or Firefox 2 works as expected.", false);
methodList.add(method);
method = new LbStickinessMethod(StickinessMethodType.AppCookieBased, "This is App session based sticky method. Define session stickiness on an existing application cookie. " + "It can be used only for a specific http traffic");
method.addParam("cookie-name", false, "This is the name of the cookie used by the application and which LB will " + "have to learn for each new session. Default value: Auto geneared based on ip", false);
method.addParam("length", false, "This is the max number of characters that will be memorized and checked in " + "each cookie value. Default value:52", false);
method.addParam("holdtime", false, "This is the time after which the cookie will be removed from memory if unused. The value should be in " + "the format Example : 20s or 30m or 4h or 5d . only seconds(s), minutes(m) hours(h) and days(d) are valid," + " cannot use th combinations like 20h30m. Default value:3h ", false);
method.addParam("request-learn", false, "If this option is specified, then haproxy will be able to learn the cookie found in the request in case the server does not specify any in response. This is typically what happens with PHPSESSID cookies, or when haproxy's session expires before the application's session and the correct server is selected. It is recommended to specify this option to improve reliability", true);
method.addParam("prefix", false, "When this option is specified, haproxy will match on the cookie prefix (or URL parameter prefix). " + "The appsession value is the data following this prefix. Example : appsession ASPSESSIONID len 64 timeout 3h prefix This will match the cookie ASPSESSIONIDXXXX=XXXXX, the appsession value will be XXXX=XXXXX.", true);
method.addParam("mode", false, "This option allows to change the URL parser mode. 2 modes are currently supported : - path-parameters " + ": The parser looks for the appsession in the path parameters part (each parameter is separated by a semi-colon), " + "which is convenient for JSESSIONID for example.This is the default mode if the option is not set. - query-string :" + " In this mode, the parser will look for the appsession in the query string.", false);
methodList.add(method);
method = new LbStickinessMethod(StickinessMethodType.SourceBased, "This is source based Stickiness method, " + "it can be used for any type of protocol.");
method.addParam("tablesize", false, "Size of table to store source ip addresses. example: tablesize=200k or 300m" + " or 400g. Default value:200k", false);
method.addParam("expire", false, "Entry in source ip table will expire after expire duration. units can be s,m,h,d ." + " example: expire=30m 20s 50h 4d. Default value:3h", false);
methodList.add(method);
final Gson gson = new Gson();
final String capability = gson.toJson(methodList);
return capability;
}
use of com.cloud.network.rules.LbStickinessMethod in project cloudstack by apache.
the class LoadBalancingRulesManagerImpl method getStickinessMethods.
@Override
public List<LbStickinessMethod> getStickinessMethods(long networkid) {
String capability = getLBCapability(networkid, Capability.SupportedStickinessMethods.getName());
if (capability == null) {
return null;
}
Gson gson = new Gson();
java.lang.reflect.Type listType = new TypeToken<List<LbStickinessMethod>>() {
}.getType();
List<LbStickinessMethod> result = gson.fromJson(capability, listType);
return result;
}
use of com.cloud.network.rules.LbStickinessMethod in project cloudstack by apache.
the class NetscalerElement method getCapabilities.
@Override
public Map<Service, Map<Capability, String>> getCapabilities() {
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>();
// Specifies that the RoundRobin and Leastconn algorithms are supported for load balancing rules
lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin, leastconn, source");
// specifies that Netscaler network element can provided both shared and isolation modes
lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated, shared");
// Specifies that load balancing rules can be made for either TCP or UDP traffic
lbCapabilities.put(Capability.SupportedProtocols, "tcp,udp");
// Specifies that this element can measure network usage on a per public IP basis
lbCapabilities.put(Capability.TrafficStatistics, "per public ip");
// Specifies that load balancing rules can only be made with public IPs that aren't source NAT IPs
lbCapabilities.put(Capability.LoadBalancingSupportedIps, "additional");
// Supports only Public load balancing
lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString());
// Specifies that load balancing rules can support autoscaling and the list of counters it supports
AutoScaleCounter counter;
List<AutoScaleCounter> counterList = new ArrayList<AutoScaleCounter>();
counter = new AutoScaleCounter(AutoScaleCounterSnmp);
counterList.add(counter);
counter.addParam("snmpcommunity", true, "the community string that has to be used to do a SNMP GET on the AutoScaled Vm", false);
counter.addParam("snmpport", false, "the port at which SNMP agent is running on the AutoScaled Vm", false);
counter = new AutoScaleCounter(AutoScaleCounterNetscaler);
counterList.add(counter);
Gson gson = new Gson();
String autoScaleCounterList = gson.toJson(counterList);
lbCapabilities.put(Capability.AutoScaleCounters, autoScaleCounterList);
LbStickinessMethod method;
List<LbStickinessMethod> methodList = new ArrayList<LbStickinessMethod>();
method = new LbStickinessMethod(StickinessMethodType.LBCookieBased, "This is cookie based sticky method, can be used only for http");
methodList.add(method);
method.addParam("holdtime", false, "time period in minutes for which persistence is in effect.", false);
method = new LbStickinessMethod(StickinessMethodType.AppCookieBased, "This is app session based sticky method, can be used only for http");
methodList.add(method);
method.addParam("name", true, "cookie name passed in http header by apllication to the client", false);
method = new LbStickinessMethod(StickinessMethodType.SourceBased, "This is source based sticky method, can be used for any type of protocol.");
methodList.add(method);
method.addParam("holdtime", false, "time period for which persistence is in effect.", false);
String stickyMethodList = gson.toJson(methodList);
lbCapabilities.put(Capability.SupportedStickinessMethods, stickyMethodList);
lbCapabilities.put(Capability.ElasticLb, "true");
//Setting HealthCheck Capability to True for Netscaler element
lbCapabilities.put(Capability.HealthCheckPolicy, "true");
capabilities.put(Service.Lb, lbCapabilities);
Map<Capability, String> staticNatCapabilities = new HashMap<Capability, String>();
staticNatCapabilities.put(Capability.ElasticIp, "true");
capabilities.put(Service.StaticNat, staticNatCapabilities);
// Supports SSL offloading
lbCapabilities.put(Capability.SslTermination, "true");
// TODO - Murali, please put correct capabilities here
Map<Capability, String> firewallCapabilities = new HashMap<Capability, String>();
firewallCapabilities.put(Capability.TrafficStatistics, "per public ip");
firewallCapabilities.put(Capability.SupportedProtocols, "tcp,udp,icmp");
firewallCapabilities.put(Capability.MultipleIps, "true");
capabilities.put(Service.Firewall, firewallCapabilities);
return capabilities;
}
use of com.cloud.network.rules.LbStickinessMethod in project cloudstack by apache.
the class F5ExternalLoadBalancerElement method getCapabilities.
@Override
public Map<Service, Map<Capability, String>> getCapabilities() {
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>();
// Specifies that the RoundRobin and Leastconn algorithms are supported for load balancing rules
lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn");
// specifies that F5 BIG IP network element can provide shared mode only
lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated, shared");
// Specifies that load balancing rules can be made for either TCP or UDP traffic
lbCapabilities.put(Capability.SupportedProtocols, "tcp,udp");
// Specifies that this element can measure network usage on a per public IP basis
lbCapabilities.put(Capability.TrafficStatistics, "per public ip");
// Specifies that load balancing rules can only be made with public IPs that aren't source NAT IPs
lbCapabilities.put(Capability.LoadBalancingSupportedIps, "additional");
// Support inline mode with firewall
lbCapabilities.put(Capability.InlineMode, "true");
//support only for public lb
lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString());
LbStickinessMethod method;
List<LbStickinessMethod> methodList = new ArrayList<LbStickinessMethod>();
method = new LbStickinessMethod(StickinessMethodType.LBCookieBased, "This is cookie based sticky method, can be used only for http");
methodList.add(method);
method.addParam("holdtime", false, "time period (in seconds) for which persistence is in effect.", false);
Gson gson = new Gson();
String stickyMethodList = gson.toJson(methodList);
lbCapabilities.put(Capability.SupportedStickinessMethods, stickyMethodList);
capabilities.put(Service.Lb, lbCapabilities);
return capabilities;
}
Aggregations