use of com.cloud.network.as.AutoScaleCounter 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.as.AutoScaleCounter in project cloudstack by apache.
the class VirtualRouterElement method setCapabilities.
private static Map<Service, Map<Capability, String>> setCapabilities() {
final Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>();
// 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, tcp-proxy");
lbCapabilities.put(Capability.SupportedStickinessMethods, getHAProxyStickinessCapability());
lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString());
// specifies that LB rules can support autoscaling and the list of
// counters it supports
AutoScaleCounter counter;
final List<AutoScaleCounter> counterList = new ArrayList<AutoScaleCounter>();
counter = new AutoScaleCounter(AutoScaleCounterCpu);
counterList.add(counter);
counter = new AutoScaleCounter(AutoScaleCounterMemory);
counterList.add(counter);
final Gson gson = new Gson();
final String autoScaleCounterList = gson.toJson(counterList);
lbCapabilities.put(Capability.AutoScaleCounters, autoScaleCounterList);
capabilities.put(Service.Lb, lbCapabilities);
// Set capabilities for Firewall service
final 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.SupportedEgressProtocols, "tcp,udp,icmp, all");
firewallCapabilities.put(Capability.SupportedTrafficDirection, "ingress, egress");
firewallCapabilities.put(Capability.MultipleIps, "true");
capabilities.put(Service.Firewall, firewallCapabilities);
// Set capabilities for vpn
final Map<Capability, String> vpnCapabilities = new HashMap<Capability, String>();
vpnCapabilities.put(Capability.SupportedVpnProtocols, "pptp,l2tp,ipsec");
vpnCapabilities.put(Capability.VpnTypes, "removeaccessvpn");
capabilities.put(Service.Vpn, vpnCapabilities);
final Map<Capability, String> dnsCapabilities = new HashMap<Capability, String>();
dnsCapabilities.put(Capability.AllowDnsSuffixModification, "true");
capabilities.put(Service.Dns, dnsCapabilities);
capabilities.put(Service.UserData, null);
final Map<Capability, String> dhcpCapabilities = new HashMap<Capability, String>();
dhcpCapabilities.put(Capability.DhcpAccrossMultipleSubnets, "true");
capabilities.put(Service.Dhcp, dhcpCapabilities);
capabilities.put(Service.Gateway, null);
final Map<Capability, String> sourceNatCapabilities = new HashMap<Capability, String>();
sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, "peraccount");
sourceNatCapabilities.put(Capability.RedundantRouter, "true");
capabilities.put(Service.SourceNat, sourceNatCapabilities);
capabilities.put(Service.StaticNat, null);
capabilities.put(Service.PortForwarding, null);
return capabilities;
}
Aggregations