Review 16080 Move Netscaler plugin from non-oss to oss and upgrade the nitro API to 10.1

Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
This commit is contained in:
Syed Ahmed 2014-02-05 14:03:49 +01:00 committed by Hugo Trippaers
parent 28ac2f758e
commit 356daf3eed
4 changed files with 87 additions and 102 deletions

View File

@ -95,6 +95,11 @@
<artifactId>cloud-plugin-network-palo-alto</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-netscaler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-ovs</artifactId>
@ -659,21 +664,6 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>netscaler</id>
<activation>
<property>
<name>noredist</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-netscaler</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>srx</id>
<activation>

View File

@ -30,12 +30,12 @@
<dependency>
<groupId>com.citrix.netscaler.nitro</groupId>
<artifactId>nitro</artifactId>
<version>10.0.e</version>
<version>10.1</version>
</dependency>
<dependency>
<groupId>com.cloud.com.citrix</groupId>
<artifactId>netscaler-sdx</artifactId>
<version>1.0</version>
<groupId>com.citrix.netscaler.nitro</groupId>
<artifactId>sdx_nitro</artifactId>
<version>10.1</version>
</dependency>
</dependencies>
</project>

View File

@ -72,10 +72,10 @@ import com.citrix.netscaler.nitro.resource.config.ssl.sslvserver_sslcertkey_bind
import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats;
import com.citrix.netscaler.nitro.service.nitro_service;
import com.citrix.netscaler.nitro.util.filtervalue;
import com.citrix.sdx.nitro.resource.config.device_profile;
import com.citrix.sdx.nitro.resource.config.mps;
import com.citrix.sdx.nitro.resource.config.ns;
import com.citrix.sdx.nitro.resource.config.xen_vpx_image;
import com.citrix.sdx.nitro.resource.config.mps.device_profile;
import com.citrix.sdx.nitro.resource.config.mps.mps;
import com.citrix.sdx.nitro.resource.config.ns.ns;
import com.citrix.sdx.nitro.resource.config.xen.xen_nsvpx_image;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
@ -692,7 +692,7 @@ public class NetscalerResource implements ServerResource {
String intermediateCertFileName = intermediateCertKeyName + ".pem";
if (!SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName)) {
byte[] certData = intermediateCert.getEncoded();
intermediateCert.getEncoded();
StringWriter textWriter = new StringWriter();
PEMWriter pemWriter = new PEMWriter(textWriter);
pemWriter.writeObject(intermediateCert);
@ -914,8 +914,8 @@ public class NetscalerResource implements ServerResource {
ns_obj.set_password(password);
// configure VPX instances with defaults
ns_obj.set_feature_license("Standard");
ns_obj.set_memory_total(new Double(2048));
ns_obj.set_license("Standard");
ns_obj.set_vm_memory_total(new Double(2048));
ns_obj.set_throughput(new Double(1000));
ns_obj.set_pps(new Double(1000000));
ns_obj.set_number_of_ssl_cores(0);
@ -927,11 +927,11 @@ public class NetscalerResource implements ServerResource {
" as there are no admin profile to use for creating VPX."));
}
String profileName = profiles[0].get_name();
ns_obj.set_nsroot_profile(profileName);
ns_obj.set_profile_name(profileName);
// use the first VPX image of the available VPX images on the SDX to create an instance of VPX
// TODO: should enable the option to choose the template while adding the SDX device in to CloudStack
xen_vpx_image[] vpxImages = xen_vpx_image.get(_netscalerSdxService);
xen_nsvpx_image[] vpxImages = xen_nsvpx_image.get(_netscalerSdxService);
if (!(vpxImages != null && vpxImages.length >= 1)) {
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
" as there are no VPX images on SDX to use for creating VPX."));
@ -955,7 +955,7 @@ public class NetscalerResource implements ServerResource {
// wait for VPX instance to start-up
long startTick = System.currentTimeMillis();
long startWaitMilliSeconds = 600000;
while (!newVpx.get_ns_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
while (!newVpx.get_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
@ -966,7 +966,7 @@ public class NetscalerResource implements ServerResource {
}
// if vpx instance never came up then error out
if (!newVpx.get_ns_state().equalsIgnoreCase("up")) {
if (!newVpx.get_state().equalsIgnoreCase("up")) {
return new Answer(cmd, new ExecutionException("Failed to start VPX instance " + vpxName + " created on the netscaler SDX device " + _ip));
}
@ -1108,8 +1108,7 @@ public class NetscalerResource implements ServerResource {
// Unbind GSLB service with GSLB virtual server
GSLB.deleteVserverServiceBinding(_netscalerService, serviceName, vserverName);
// delete 'gslbservice' object
gslbservice service = GSLB.getServiceObject(_netscalerService, serviceName);
GSLB.getServiceObject(_netscalerService, serviceName);
GSLB.deleteService(_netscalerService, serviceName);
// delete the GSLB service monitor
@ -2380,7 +2379,10 @@ public class NetscalerResource implements ServerResource {
// remove subnet IP
try {
nsip subnetIp = nsip.get(_netscalerService, vlanSelfIp);
nsip _vlanSelfIp = new nsip();
_vlanSelfIp.set_ipaddress(vlanSelfIp);
nsip subnetIp = nsip.get(_netscalerService, _vlanSelfIp);
apiCallResult = nsip.delete(_netscalerService, subnetIp);
if (apiCallResult.errorcode != 0) {
throw new ExecutionException("Failed to remove subnet ip:" + vlanSelfIp + " from the NetScaler device due to" + apiCallResult.message);
@ -2425,9 +2427,12 @@ public class NetscalerResource implements ServerResource {
}
}
private boolean nsSnipExists(String subnetIP) throws ExecutionException {
private boolean nsSnipExists(String subnetIp) throws ExecutionException {
try {
nsip snip = nsip.get(_netscalerService, subnetIP);
nsip _subnetIp = new nsip();
_subnetIp.set_ipaddress(subnetIp);
nsip snip = nsip.get(_netscalerService, _subnetIp);
return (snip != null);
} catch (nitro_exception e) {
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
@ -2603,7 +2608,7 @@ public class NetscalerResource implements ServerResource {
private boolean isServiceGroupBoundToVirtualServer(String nsVirtualServerName, String serviceGroupName) throws ExecutionException {
lbvserver_servicegroup_binding vserver_servicegroup_binding = new lbvserver_servicegroup_binding();
new lbvserver_servicegroup_binding();
try {
lbvserver_servicegroup_binding[] result =
@ -2955,7 +2960,7 @@ public class NetscalerResource implements ServerResource {
int srcPort = loadBalancerTO.getSrcPort();
String lbProtocol = getNetScalerProtocol(loadBalancerTO);
String lbAlgorithm = loadBalancerTO.getAlgorithm();
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
generateAutoScaleVmGroupIdentifier(loadBalancerTO);
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
if (s_logger.isDebugEnabled()) {
@ -3008,7 +3013,7 @@ public class NetscalerResource implements ServerResource {
private synchronized boolean removeAutoScaleConfig(LoadBalancerTO loadBalancerTO) throws Exception, ExecutionException {
String srcIp = loadBalancerTO.getSrcIp();
int srcPort = loadBalancerTO.getSrcPort();
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
generateAutoScaleVmGroupIdentifier(loadBalancerTO);
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
@ -3064,7 +3069,7 @@ public class NetscalerResource implements ServerResource {
AutoScaleVmProfileTO profileTO = vmGroupTO.getProfile();
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
int interval = vmGroupTO.getInterval();
List<Pair<String, String>> counterParams = profileTO.getCounterParamList();
profileTO.getCounterParamList();
String snmpCommunity = null;
int snmpPort = DEFAULT_SNMP_PORT;
long cur_prirotiy = 1;
@ -3572,7 +3577,7 @@ public class NetscalerResource implements ServerResource {
}
private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException {
autoscaleprofile autoscaleProfile = new autoscaleprofile();
new autoscaleprofile();
try {
autoscaleprofile.get(_netscalerService);
} catch (Exception ex) {

View File

@ -47,6 +47,7 @@
<module>network-elements/ovs</module>
<module>network-elements/juniper-contrail</module>
<module>network-elements/palo-alto</module>
<module>network-elements/netscaler</module>
<module>network-elements/nicira-nvp</module>
<module>network-elements/bigswitch-vns</module>
<module>network-elements/midonet</module>
@ -136,17 +137,6 @@
<module>network-elements/f5</module>
</modules>
</profile>
<profile>
<id>netscaler</id>
<activation>
<property>
<name>noredist</name>
</property>
</activation>
<modules>
<module>network-elements/netscaler</module>
</modules>
</profile>
<profile>
<id>srx</id>
<activation>