You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2012/06/22 03:56:11 UTC
[3/6] moving out NetScaler network element code from CloudStack core
into plugins/network-elements/netscaler
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/deployment-planner/user-dispersing/build.xml
----------------------------------------------------------------------
diff --git a/plugins/deployment-planner/user-dispersing/build.xml b/plugins/deployment-planner/user-dispersing/build.xml
deleted file mode 100644
index 60a1f2d..0000000
--- a/plugins/deployment-planner/user-dispersing/build.xml
+++ /dev/null
@@ -1,609 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-
-<project name="Cloud Stack User Dispersing Deployment Planner" default="help" basedir=".">
- <description>
- Cloud Stack ant build file
- </description>
-
- <!--
- Test
- Always use this variable to refer to the base directory because this
- variable is changeable
- -->
- <dirname property="base.dir" file="${ant.file.Cloud Stack}/.." />
- <property name="build.dir" location="${base.dir}/build" />
-
- <!-- Import anything that the user wants to set-->
- <!-- Import properties files and environment variables here -->
-
- <property environment="env" />
-
- <condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
- <available file="${build.dir}/override/build-cloud.properties" />
- </condition>
-
- <condition property="cloud.properties.file" value="${build.dir}/override/cloud.properties" else="${build.dir}/cloud.properties">
- <available file="${build.dir}/override/cloud.properties" />
- </condition>
-
- <condition property="override.file" value="${build.dir}/override/replace.properties" else="${build.dir}/replace.properties">
- <available file="${build.dir}/override/replace.properties" />
- </condition>
-
- <echo message="Using build parameters from ${build-cloud.properties.file}" />
- <property file="${build-cloud.properties.file}" />
-
- <echo message="Using company info from ${cloud.properties.file}" />
- <property file="${cloud.properties.file}" />
-
- <echo message="Using override file from ${override.file}" />
- <property file="${override.file}" />
-
- <property file="${base.dir}/build/build.number" />
-
- <import file="${build.dir}/build-common.xml" />
-
- <!-- In case these didn't get defined in the build-cloud.properties -->
- <property name="branding.name" value="default" />
- <property name="tomcat.home" value="${env.CATALINA_HOME}" />
- <property name="deprecation" value="off" />
- <property name="target.compat.version" value="1.6" />
- <property name="source.compat.version" value="1.6" />
- <property name="debug" value="true" />
- <property name="debuglevel" value="lines,source"/>
-
- <!-- directories for build and distribution -->
- <property name="dist.dir" location="${base.dir}/dist/" />
- <property name="target.dir" location="${base.dir}/target" />
- <property name="classes.dir" location="${target.dir}/classes" />
- <property name="jar.dir" location="${target.dir}/jar" />
- <property name="dep.cache.dir" location="${target.dir}/dep-cache" />
- <property name="build.log" location="${target.dir}/ant_verbose.txt" />
-
- <property name="deps.dir" location="${base.dir}/deps" />
- <property name="tools.jar.dir" location="${base.dir}/tools/tooljars" />
-
- <!-- directories for client compilation-->
- <property name="client.dir" location="${base.dir}/client" />
- <property name="client.test.dir" location="${client.dir}/test" />
- <property name="client.target.dir" location="${target.dir}/ui" />
- <property name="ui.user.dir" location="${base.dir}/ui" />
- <property name="setup.db.dir" location="${base.dir}/setup/db" />
- <property name="setup.apidoc.dir" location="${base.dir}/setup/apidoc" />
-
- <!-- directories for server compilation-->
- <property name="server.dir" location="${base.dir}/server" />
- <property name="server.test.dir" location="${server.dir}/test" />
- <property name="server.dist.dir" location="${dist.dir}/client" />
- <property name="db.scripts.dir" location="${target.dir}/db"/>
- <property name="apidoc.scripts.dir" location="${base.dir}/setup/apidoc/"/>
-
- <!-- directories for core code compilation-->
- <property name="core.dir" location="${base.dir}/core" />
- <property name="core.test.dir" location="${core.dir}/test/" />
-
- <!-- directories for agent code compilation-->
- <property name="agent.dir" location="${base.dir}/agent" />
- <property name="agent.test.dir" location="${utils.dir}/test/" />
- <property name="agent.dist.dir" location="${dist.dir}/agent" />
-
- <property name="scripts.dir" location="${base.dir}/scripts" />
- <property name="scripts.target.dir" location="${target.dir}/scripts"/>
-
- <!-- directories for console proxy compilation-->
- <property name="console-proxy.dir" location="${base.dir}/console-proxy" />
- <property name="console-proxy.dist.dir" location="${dist.dir}/console-proxy" />
-
- <property name="tools.dir" location="${base.dir}/tools" />
- <!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />-->
- <property name="deploy.dir" location="${build.dir}/deploy" />
- <property name="production.dir" location="${deploy.dir}/production" />
- <property name="meld.home" location="/usr/local/bin" />
- <property name="assertion" value="-da" />
-
- <!-- directory for vmware-base library -->
- <property name="vmware-base.dir" location="${base.dir}/vmware-base" />
-
- <!-- directories for branding -->
- <property name="branding.dir" location="${build.dir}/deploy/branding/${branding.name}" />
-
- <property name="core.jar" value="cloud-core.jar" />
- <property name="utils.jar" value="cloud-utils.jar" />
- <property name="server.jar" value="cloud-server.jar" />
- <property name="agent.jar" value="cloud-agent.jar" />
- <property name="console-proxy.jar" value="cloud-console-proxy.jar" />
- <property name="api.jar" value="cloud-api.jar"/>
- <property name="vmware-base.jar" value="cloud-vmware-base.jar" />
-
- <!--
- Import information about the build version and company information
- -->
- <property name="version" value="${company.major.version}.${company.minor.version}.${company.patch.version}" />
-
- <!-- Class paths -->
- <path id="prod.src.path">
- <pathelement location="${server.dir}/src" />
- <pathelement location="${utils.dir}/src" />
- <pathelement location="${core.dir}/src" />
- <pathelement location="${agent.dir}/src" />
- </path>
-
- <path id="src.classpath">
- </path>
-
- <path id="compile.deps.classpath">
- <fileset dir="${tools.jar.dir}" erroronmissingdir="true">
- <include name="*.jar" />
- </fileset>
- </path>
-
- <path id="deps.classpath">
- <!--filelist files="${deps.classpath}" /-->
- <fileset dir="${deps.dir}" erroronmissingdir="false">
- <include name="*.jar" />
- </fileset>
- <path refid="compile.deps.classpath" />
- </path>
-
- <path id="dist.classpath">
- <fileset dir="${target.dir}">
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="${target.dir}/jar">
- <include name="**/*.jar" />
- </fileset>
- </path>
-
- <path id="test.classpath">
- <fileset dir="${dist.dir}">
- <include name="**/*.jar" />
- </fileset>
- </path>
-
- <!-- directories for util code compilation-->
- <property name="utils.dir" location="${base.dir}/utils" />
- <property name="utils.test.dir" location="${utils.dir}/test/" />
- <path id="utils.classpath">
- <path refid="deps.classpath" />
- </path>
- <target name="compile-utils" depends="-init" description="Compile the utilities jar that is shared.">
- <compile-java jar.name="${utils.jar}" top.dir="${utils.dir}" classpath="utils.classpath" >
- <include-files>
- <fileset dir="${utils.dir}/certs">
- <include name="*.keystore" />
- </fileset>
- </include-files>
- </compile-java>
- </target>
-
- <property name="api.dir" location="${base.dir}/api" />
- <property name="api.test.dir" location="${api.dir}/test/" />
- <path id="api.classpath">
- <path refid="deps.classpath" />
- <path refid="dist.classpath"/>
- </path>
- <target name="compile-api" depends="-init, compile-utils" description="Compile the utilities jar that is shared.">
- <compile-java jar.name="${api.jar}" top.dir="${api.dir}" classpath="api.classpath" />
- </target>
-
- <path id="core.classpath">
- <path refid="deps.classpath" />
- <path refid="dist.classpath" />
- </path>
- <target name="compile-core" depends="-init, compile-utils, compile-api, compile-vmware-base" description="Compile the core business logic.">
- <compile-java jar.name="${core.jar}" top.dir="${core.dir}" classpath="core.classpath" />
- </target>
-
- <path id="vmware-base.classpath">
- <path refid="deps.classpath" />
- <path refid="dist.classpath" />
- </path>
- <target name="compile-vmware-base" depends="-init, compile-utils" description="Compile the VMware support library">
- <compile-java jar.name="${vmware-base.jar}" top.dir="${vmware-base.dir}" classpath="vmware-base.classpath" />
- </target>
-
- <path id="server.classpath">
- <path refid="deps.classpath" />
- <path refid="dist.classpath" />
- </path>
- <target name="compile-server" depends="-init, compile-utils, compile-core, compile-agent" description="Compile the management server.">
- <compile-java jar.name="${server.jar}" top.dir="${server.dir}" classpath="server.classpath" />
- </target>
-
- <path id="client.classpath">
- <path refid="deps.classpath" />
- <path refid="dist.classpath" />
- </path>
-
- <target name="build-scripts" depends="-init">
- <copy todir="${scripts.target.dir}">
- <fileset dir="${scripts.dir}">
- <include name="**/*"/>
- <exclude name="**/fsimage.so"/>
- <exclude name="**/ping.tar.bz2"/>
- <exclude name="**/vhd-util"/>
- <exclude name="**/.*" />
- </fileset>
- <filterset>
- <filter token="VERSION" value="${impl.version}"/>
- </filterset>
- </copy>
- <copy todir="${scripts.target.dir}">
- <fileset dir="${scripts.dir}">
- <include name="**/fsimage.so"/>
- <include name="**/ping.tar.bz2"/>
- <include name="**/vhd-util"/>
- </fileset>
- </copy>
- </target>
-
- <target name="build-ui" depends="-init" description="Builds the UI">
- <mkdir dir="${client.target.dir}" />
- <copy todir="${client.target.dir}">
- <fileset dir="${ui.user.dir}">
- <include name="**/*.html" />
- <include name="**/*.js"/>
- <include name="**/*.jsp"/>
- <exclude name="**/.classpath" />
- <exclude name="**/.project" />
- </fileset>
- <filterset>
- <filter token="VERSION" value="${impl.version}"/>
- </filterset>
- </copy>
- <copy todir="${client.target.dir}">
- <fileset dir="${ui.user.dir}">
- <include name="**/*"/>
- <exclude name="**/*.html" />
- <exclude name="**/*.js"/>
- <exclude name="**/*.jsp"/>
- <exclude name="**/.classpath" />
- <exclude name="**/.project" />
- </fileset>
- </copy>
- <copy todir="${client.target.dir}">
- <fileset dir="${client.dir}/WEB-INF/classes">
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- </target>
-
- <target name="build-ovm" depends="compile-ovm" />
-
- <target name="build-server" depends="compile-server">
- <mkdir dir="${server.dist.dir}" />
- <mkdir dir="${server.dist.dir}/lib" />
- <mkdir dir="${server.dist.dir}/conf" />
-
- <copy todir="${jar.dir}">
- <fileset dir="${deps.dir}">
- <include name="cloud-*.jar"/>
- </fileset>
- </copy>
-
- <copy overwrite="true" todir="${server.dist.dir}/conf">
- <fileset dir="${base.dir}/client/tomcatconf">
- <include name="*.in" />
- </fileset>
- <globmapper from="*.in" to="*" />
- <filterchain>
- <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
- <param type="propertiesfile" value="${override.file}" />
- </filterreader>
- </filterchain>
- </copy>
-
- <copy overwrite="true" todir="${server.dist.dir}/conf">
- <fileset dir="${server.dir}/src/com/cloud/migration">
- <include name="*.xml" />
- </fileset>
- </copy>
-
- <copy overwrite="true" todir="${db.scripts.dir}">
- <fileset dir="${setup.db.dir}">
- <include name="**/*"/>
- </fileset>
- <filterset>
- <filter token="VERSION" value="${impl.version}"/>
- </filterset>
- </copy>
- </target>
-
- <path id="console-proxy.classpath">
- <path refid="deps.classpath" />
- <path refid="dist.classpath" />
- </path>
- <target name="compile-console-proxy" depends="-init" description="Compile the console proxy.">
- <compile-java jar.name="${console-proxy.jar}" top.dir="${console-proxy.dir}" classpath="console-proxy.classpath" >
- <include-files>
- <fileset dir="${console-proxy.dir}/certs">
- <include name="*.keystore" />
- <include name="*.crt" />
- <include name="*.key" />
- </fileset>
- </include-files>
- </compile-java>
- </target>
-
- <target name="copy-console-proxy" depends="-init">
- <property name="copyto.dir" value="${console-proxy.dist.dir}" />
- <mkdir dir="${copyto.dir}" />
- <mkdir dir="${copyto.dir}/conf" />
- <mkdir dir="${copyto.dir}/logs" />
- <mkdir dir="${copyto.dir}/applet" />
- <mkdir dir="${copyto.dir}/images" />
- <mkdir dir="${copyto.dir}/js" />
- <mkdir dir="${copyto.dir}/ui" />
- <mkdir dir="${copyto.dir}/css" />
- <mkdir dir="${copyto.dir}/certs" />
-
- <copy todir="${copyto.dir}">
- <fileset dir="${deps.dir}">
- <include name="log4j-1.2.15.jar" />
- <include name="apache-log4j-extras-1.0.jar" />
- <include name="gson.jar" />
- </fileset>
- </copy>
-
- <copy todir="${copyto.dir}">
- <fileset dir="${jar.dir}">
- <include name="cloud-console-proxy.jar" />
- </fileset>
- </copy>
- <copy todir="${copyto.dir}/conf">
- <fileset dir="${production.dir}/consoleproxy/conf">
- <include name="log4j-cloud.xml" />
- <include name="consoleproxy.properties" />
- </fileset>
- </copy>
- <copy todir="${copyto.dir}/images">
- <fileset dir="${console-proxy.dir}/images">
- <include name="*.jpg" />
- <include name="*.gif" />
- <include name="*.png" />
- <include name="*.cur" />
- </fileset>
- </copy>
- <copy todir="${copyto.dir}/js">
- <fileset dir="${console-proxy.dir}/js">
- <include name="*.js" />
- </fileset>
- </copy>
- <copy todir="${copyto.dir}/ui">
- <fileset dir="${console-proxy.dir}/ui">
- <include name="*.ftl" />
- </fileset>
- </copy>
- <copy todir="${copyto.dir}/css">
- <fileset dir="${console-proxy.dir}/css">
- <include name="*.css" />
- </fileset>
- </copy>
- <copy todir="${copyto.dir}/certs">
- <fileset dir="${console-proxy.dir}/certs">
- <include name="*.keystore" />
- <include name="*.crt" />
- <include name="*.key" />
- </fileset>
- </copy>
- </target>
-
- <target name="build-console-proxy" depends="-init, compile-console-proxy, copy-console-proxy">
- <copy todir="${console-proxy.dist.dir}">
- <fileset dir="${console-proxy.dir}/scripts">
- </fileset>
- </copy>
- <copy todir="${console-proxy.dist.dir}/conf">
- <fileset dir="${console-proxy.dir}/conf">
- </fileset>
- </copy>
- </target>
-
-
- <path id="agent.classpath">
- <path refid="deps.classpath" />
- <fileset dir="${target.dir}">
- <include name="**/${core.jar}" />
- <include name="**/${utils.jar}" />
- <include name="**/${api.jar}"/>
- </fileset>
- </path>
- <target name="compile-agent" depends="-init, compile-utils, compile-core, compile-api" description="Compile the management agent.">
- <compile-java jar.name="${agent.jar}" top.dir="${agent.dir}" classpath="agent.classpath" />
- </target>
-
- <target name="build-agent" depends="-init, compile-agent">
- <mkdir dir="${agent.dist.dir}" />
- <mkdir dir="${agent.dist.dir}/scripts" />
- <mkdir dir="${agent.dist.dir}/conf" />
- <mkdir dir="${agent.dist.dir}/logs" />
- <mkdir dir="${agent.dist.dir}/db" />
- <mkdir dir="${agent.dist.dir}/storagehdpatch" />
-
- <condition property="agent.properties" value="override/agent.properties" else="agent.properties">
- <available file="${agent.dir}/conf/override/agent.properties" />
- </condition>
-
- <condition property="developer.properties" value="override/developer.properties" else="developer.properties">
- <available file="${agent.dir}/conf/override/developer.properties" />
- </condition>
-
- <copy overwrite="true" todir="${agent.dist.dir}/conf" flatten="true">
- <fileset dir="${agent.dir}/conf">
- <include name="${agent.properties}" />
- <include name="${developer.properties}" />
- </fileset>
- <filterchain>
- <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
- <param type="propertiesfile" value="${override.file}" />
- </filterreader>
- </filterchain>
- </copy>
-
- <copy overwrite="true" todir="${agent.dist.dir}/conf" flatten="true">
- <fileset dir="${agent.dir}/conf">
- <include name="log4j-cloud.xml.in" />
- </fileset>
- <globmapper from="*.in" to="*" />
- <filterchain>
- <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
- <param type="propertiesfile" value="${override.file}" />
- </filterreader>
- </filterchain>
- </copy>
- <delete file="${agent.dist.dir}/conf/log4j-cloud.xml.in"/>
-
- <copy todir="${agent.dist.dir}">
- <fileset dir="${agent.dir}/scripts">
- <include name="agent.sh" />
- <include name="run.sh" />
- </fileset>
- </copy>
- </target>
-
- <target name="build-servers" depends="-init, build-server" />
-
- <target name="build-opensource" depends="-init, build-server, build-agent, build-scripts, build-ui, build-ovm, package-oss-systemvm-iso">
- <copy overwrite="true" todir="${dist.dir}">
- <fileset dir="${base.dir}/build/deploy/">
- <include name="deploy-agent.sh" />
- <include name="deploy-server.sh" />
- <include name="deploy-console-proxy.sh" />
- <include name="install.sh" />
- </fileset>
- <fileset dir="${base.dir}/client">
- <include name="setup/**/*" />
- </fileset>
- </copy>
-
- <copy overwrite="true" todir="${jar.dir}">
- <fileset dir="${deps.dir}">
- <include name="vmware-*.jar" />
- </fileset>
- </copy>
-
- <chmod file="${dist.dir}/deploy-agent.sh" perm="uog+xr" />
- <chmod file="${dist.dir}/deploy-server.sh" perm="uog+xr" />
- </target>
-
-
- <target name="build-systemvm-patch" depends="-init">
- <mkdir dir="${dist.dir}" />
- <mkdir dir="${dist.dir}/build-patch" />
- <mkdir dir="${dist.dir}/build-patch/usr/sbin" />
- <copy overwrite="true" todir="${dist.dir}/build-patch">
- <fileset dir="${base.dir}/patches/systemvm/debian/config/" >
- <include name="**/*"/>
- </fileset>
- <fileset dir="${base.dir}/patches/systemvm/debian/vpn/" >
- <include name="**/*"/>
- </fileset>
- <fileset dir="${base.dir}/patches/systemvm/debian/xe/" >
- <include name="**/*"/>
- <exclude name="**/xe-*" />
- <exclude name="**/xen-*" />
- </fileset>
- </copy>
- <copy overwrite="true" todir="${dist.dir}/build-patch/usr/sbin/">
- <fileset dir="${base.dir}/patches/systemvm/debian/xe/" >
- <include name="**/xe-*" />
- <include name="**/xen-*" />
- </fileset>
- </copy>
- <tar destfile="${dist.dir}/patch.tar">
- <tarfileset dir="${dist.dir}/build-patch/" filemode="755">
- <include name="**/*"/>
- <exclude name="**/.classpath" />
- <exclude name="**/.project" />
- <exclude name="**/wscript_build" />
- </tarfileset>
- </tar>
- <copy file="${base.dir}/patches/systemvm/debian/config/root/.ssh/authorized_keys" todir="${dist.dir}/"/>
- <gzip destfile="${dist.dir}/cloud-scripts.tgz" src="${dist.dir}/patch.tar"/>
- <delete file="${dist.dir}/patch.tar"/>
- <delete dir="${dist.dir}/build-patch"/>
- </target>
-
- <target name="help">
- <echo level="info" message="Ant Build File for CloudStack" />
- <echo level="info" message="Type 'ant -projecthelp' to get a list of targets and their descriptions." />
- </target>
- <target name="usage" depends="help" />
-
- <target name="-init">
- <mkdir dir="${dist.dir}" />
- <mkdir dir="${target.dir}" />
- <record name="${build.log}" loglevel="verbose" action="start" />
-
- <!-- create a UTC build timestamp using ISO 8601 formatting -->
- <tstamp>
- <format property="utc.build.timestamp" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'" timezone="GMT" />
- </tstamp>
-
- <!-- remember who/where did the build -->
- <exec executable="hostname" outputproperty="host.name" />
- <property name="builder.at" value="${user.name} at ${host.name}" />
- <property name="builder.id" value="${builder.at}, on ${utc.build.timestamp}" />
- <property name="built.by" value="${builder.at}, ${utc.build.timestamp}" />
- <echo level="info" message="builder: ${builder.id}" />
-
- <!-- set build.number property, stored in eponymous file -->
- <buildnumber file="${build.dir}/build.number" />
- <condition property="impl.version" value="${version}.${manual.build.number}" else="${version}.${utc.build.timestamp}">
- <isset property="manual.build.number"/>
- </condition>
-
- <echo message="Build number is ${impl.version}" />
-
- <!-- Create the build directory structure used by compile -->
- <mkdir dir="${jar.dir}" />
- <mkdir dir="${docs.dir}" />
- <mkdir dir="${dep.cache.dir}" />
- <record name="${build.log}" action="stop" />
- </target>
-
- <target name="clean" description="clean up files generated by the build">
- <delete file="${build.log}" />
- <delete dir="${classes.dir}" />
- <delete dir="${jar.dir}" />
- <delete dir="${dist.dir}" />
- <delete dir="${unittest.dir}"/>
- </target>
-
- <!-- ===================== Ovm.Jar ===================== -->
- <property name="ovm.jar" value="cloud-ovm.jar" />
- <property name="ovm.dir" location="${base.dir}/ovm" />
- <property name="ovm-scripts.dir" location="${ovm.dir}/scripts" />
- <path id="ovm.classpath" >
- <path refid="deps.classpath" />
- <path refid="dist.classpath" />
- </path>
- <target name="compile-ovm" depends="-init, compile-server" description="Compile OVM">
- <compile-java jar.name="${ovm.jar}" top.dir="${ovm.dir}" classpath="ovm.classpath" />
- </target>
-
- <target name="compile-all" description="Compile all of the jars" depends="compile-utils, compile-api, compile-core, compile-server, compile-ovm"/>
-
- <target name="clean-all" depends="clean, clean-awsapi" description="Clean all of the generated files, including dependency cache and javadoc">
- <delete dir="${target.dir}" />
- </target>
-</project>
-
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/deployment-planner/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planner/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java b/plugins/deployment-planner/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
deleted file mode 100644
index dcad1e7..0000000
--- a/plugins/deployment-planner/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2012 Citrix Systems, Inc. Licensed under the
-// Apache License, Version 2.0 (the "License"); you may not use this
-// file except in compliance with the License. Citrix Systems, Inc.
-// reserves all rights not expressly granted by the License.
-// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// Automatically generated by addcopyright.py at 04/03/2012
-package com.cloud.deploy;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.configuration.Config;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-
-@Local(value=DeploymentPlanner.class)
-public class UserDispersingPlanner extends FirstFitPlanner implements DeploymentPlanner {
-
- private static final Logger s_logger = Logger.getLogger(UserDispersingPlanner.class);
-
- /**
- * This method should reorder the given list of Cluster Ids by applying any necessary heuristic
- * for this planner
- * For UserDispersingPlanner we need to order the clusters by considering the number of VMs for this account
- * @return List<Long> ordered list of Cluster Ids
- */
- @Override
- protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
- List<Long> clusterIdsByCapacity = clusterCapacityInfo.first();
- if(vmProfile.getOwner() == null){
- return clusterIdsByCapacity;
- }
- long accountId = vmProfile.getOwner().getAccountId();
- Pair<List<Long>, Map<Long, Double>> clusterIdsVmCountInfo = listClustersByUserDispersion(id, isZone, accountId);
-
- //now we have 2 cluster lists - one ordered by capacity and the other by number of VMs for this account
- //need to apply weights to these to find the correct ordering to follow
-
- if(_userDispersionWeight == 1.0f){
- List<Long> clusterIds = clusterIdsVmCountInfo.first();
- clusterIds.retainAll(clusterIdsByCapacity);
- return clusterIds;
- }else{
- //apply weights to the two lists
- return orderByApplyingWeights(clusterCapacityInfo, clusterIdsVmCountInfo, accountId);
- }
-
-
- }
-
- /**
- * This method should reorder the given list of Pod Ids by applying any necessary heuristic
- * for this planner
- * For UserDispersingPlanner we need to order the pods by considering the number of VMs for this account
- * @return List<Long> ordered list of Pod Ids
- */
- @Override
- protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
- List<Long> podIdsByCapacity = podCapacityInfo.first();
- if(vmProfile.getOwner() == null){
- return podIdsByCapacity;
- }
- long accountId = vmProfile.getOwner().getAccountId();
-
- Pair<List<Long>, Map<Long, Double>> podIdsVmCountInfo = listPodsByUserDispersion(plan.getDataCenterId(), accountId);
-
- //now we have 2 pod lists - one ordered by capacity and the other by number of VMs for this account
- //need to apply weights to these to find the correct ordering to follow
-
- if(_userDispersionWeight == 1.0f){
- List<Long> podIds = podIdsVmCountInfo.first();
- podIds.retainAll(podIdsByCapacity);
- return podIds;
- }else{
- //apply weights to the two lists
- return orderByApplyingWeights(podCapacityInfo, podIdsVmCountInfo, accountId);
- }
-
- }
-
- protected Pair<List<Long>, Map<Long, Double>> listClustersByUserDispersion(long id, boolean isZone, long accountId){
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Applying Userdispersion heuristic to clusters for account: "+ accountId);
- }
- Pair<List<Long>, Map<Long, Double>> clusterIdsVmCountInfo;
- if(isZone){
- clusterIdsVmCountInfo = _vmInstanceDao.listClusterIdsInZoneByVmCount(id, accountId);
- }else{
- clusterIdsVmCountInfo = _vmInstanceDao.listClusterIdsInPodByVmCount(id, accountId);
- }
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("List of clusters in ascending order of number of VMs: "+ clusterIdsVmCountInfo.first());
- }
- return clusterIdsVmCountInfo;
- }
-
- protected Pair<List<Long>, Map<Long, Double>> listPodsByUserDispersion(long dataCenterId, long accountId) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Applying Userdispersion heuristic to pods for account: "+ accountId);
- }
- Pair<List<Long>, Map<Long, Double>> podIdsVmCountInfo = _vmInstanceDao.listPodIdsInZoneByVmCount(dataCenterId, accountId);
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("List of pods in ascending order of number of VMs: "+ podIdsVmCountInfo.first());
- }
-
- return podIdsVmCountInfo;
- }
-
-
- private List<Long> orderByApplyingWeights(Pair<List<Long>, Map<Long, Double>> capacityInfo, Pair<List<Long>, Map<Long, Double>> vmCountInfo, long accountId){
- List<Long> capacityOrderedIds = capacityInfo.first();
- List<Long> vmCountOrderedIds = vmCountInfo.first();
- Map<Long, Double> capacityMap = capacityInfo.second();
- Map<Long, Double> vmCountMap = vmCountInfo.second();
-
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("Capacity Id list: "+ capacityOrderedIds + " , capacityMap:"+capacityMap);
- }
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("Vm Count Id list: "+ vmCountOrderedIds + " , vmCountMap:"+vmCountMap);
- }
-
-
- List<Long> idsReorderedByWeights = new ArrayList<Long>();
- float capacityWeight = (1.0f -_userDispersionWeight);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Applying userDispersionWeight: "+ _userDispersionWeight);
- }
- //normalize the vmCountMap
- LinkedHashMap<Long, Double> normalisedVmCountIdMap= new LinkedHashMap<Long, Double>();
-
- Long totalVmsOfAccount = _vmInstanceDao.countRunningByAccount(accountId);
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Total VMs for account: "+ totalVmsOfAccount);
- }
- for(Long id : vmCountOrderedIds){
- Double normalisedCount = vmCountMap.get(id) / totalVmsOfAccount;
- normalisedVmCountIdMap.put(id, normalisedCount);
- }
-
- //consider only those ids that are in capacity map.
-
- SortedMap<Double, List<Long>> sortedMap= new TreeMap<Double, List<Long>>();
- for(Long id : capacityOrderedIds){
- Double weightedCapacityValue = capacityMap.get(id) * capacityWeight;
- Double weightedVmCountValue = normalisedVmCountIdMap.get(id) * _userDispersionWeight;
- Double totalWeight = weightedCapacityValue + weightedVmCountValue;
- if(sortedMap.containsKey(totalWeight)){
- List<Long> idList = sortedMap.get(totalWeight);
- idList.add(id);
- sortedMap.put(totalWeight, idList);
- }else{
- List<Long> idList = new ArrayList<Long>();
- idList.add(id);
- sortedMap.put(totalWeight, idList);
- }
- }
-
- for(List<Long> idList : sortedMap.values()){
- idsReorderedByWeights.addAll(idList);
- }
-
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("Reordered Id list: "+ idsReorderedByWeights);
- }
-
- return idsReorderedByWeights;
- }
-
-
- @Override
- public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
- if(vm.getHypervisorType() != HypervisorType.BareMetal){
- //check the allocation strategy
- if (_allocationAlgorithm != null && _allocationAlgorithm.equals(AllocationAlgorithm.userdispersing.toString())) {
- return true;
- }
- }
- return false;
- }
-
- float _userDispersionWeight;
-
-
- @Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- super.configure(name, params);
-
- String weight = _configDao.getValue(Config.VmUserDispersionWeight.key());
- _userDispersionWeight = NumbersUtil.parseFloat(weight, 1.0f);
-
-
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/.classpath
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/.classpath b/plugins/network-elements/netscaler/.classpath
new file mode 100644
index 0000000..1c573a6
--- /dev/null
+++ b/plugins/network-elements/netscaler/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/api"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/server"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/utils"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/.project
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/.project b/plugins/network-elements/netscaler/.project
new file mode 100644
index 0000000..9ec4c23
--- /dev/null
+++ b/plugins/network-elements/netscaler/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>netscaler</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/build.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/build.xml b/plugins/network-elements/netscaler/build.xml
new file mode 100755
index 0000000..dcf8663
--- /dev/null
+++ b/plugins/network-elements/netscaler/build.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+<project name="Cloud Stack NetScaler network element" default="help" basedir=".">
+ <description>
+ Cloud Stack ant build file
+ </description>
+
+ <dirname property="netscaler.base.dir" file="${ant.file.Cloud Stack NetScaler network element}/"/>
+ <!-- This directory must be set -->
+ <property name="top.dir" location="${netscaler.base.dir}/../../.."/>
+ <property name="build.dir" location="${top.dir}/build"/>
+
+ <echo message="build.dir=${build.dir}; top.dir=${top.dir}; netscaler.base.dir=${netscaler.base.dir}"/>
+
+ <!-- Import anything that the user wants to set-->
+ <!-- Import properties files and environment variables here -->
+
+ <property environment="env" />
+
+ <condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
+ <available file="${build.dir}/override/build-cloud.properties" />
+ </condition>
+
+ <condition property="cloud.properties.file" value="${build.dir}/override/cloud.properties" else="${build.dir}/cloud.properties">
+ <available file="${build.dir}/override/cloud.properties" />
+ </condition>
+
+ <condition property="override.file" value="${build.dir}/override/replace.properties" else="${build.dir}/replace.properties">
+ <available file="${build.dir}/override/replace.properties" />
+ </condition>
+
+ <echo message="Using build parameters from ${build-cloud.properties.file}" />
+ <property file="${build-cloud.properties.file}" />
+
+ <echo message="Using company info from ${cloud.properties.file}" />
+ <property file="${cloud.properties.file}" />
+
+ <echo message="Using override file from ${override.file}" />
+ <property file="${override.file}" />
+
+ <property file="${build.dir}/build.number" />
+
+ <!-- In case these didn't get defined in the build-cloud.properties -->
+ <property name="branding.name" value="default" />
+ <property name="deprecation" value="off" />
+ <property name="target.compat.version" value="1.6" />
+ <property name="source.compat.version" value="1.6" />
+ <property name="debug" value="true" />
+ <property name="debuglevel" value="lines,source"/>
+
+ <echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
+ <!-- directories for build and distribution -->
+ <property name="target.dir" location="${top.dir}/target" />
+ <property name="classes.dir" location="${target.dir}/classes" />
+ <property name="jar.dir" location="${target.dir}/jar" />
+ <property name="dep.cache.dir" location="${target.dir}/dep-cache" />
+ <property name="build.log" location="${target.dir}/ant_verbose.txt" />
+
+ <property name="deps.dir" location="${top.dir}/deps" />
+
+ <property name="cloud-plugin-netscaler.jar" value="cloud-plugin-netscaler.jar" />
+
+ <import file="${build.dir}/build-common.xml"/>
+
+ <echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
+
+ <!-- This section needs to be replaced by some kind of dependency library-->
+ <path id="deps.classpath">
+ <!--filelist files="${deps.classpath}" /-->
+ <fileset dir="${deps.dir}" erroronmissingdir="false">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+ <path id="cloudstack.classpath">
+ <fileset dir="${jar.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="netscaler.classpath">
+ <path refid="deps.classpath"/>
+ <path refid="cloudstack.classpath"/>
+ </path>
+
+ <!-- This section needs to be replaced by some kind of dependency library-->
+
+ <target name="deploy-netscaler" >
+ </target>
+
+ <target name="init" description="Initialize binaries directory">
+ <mkdir dir="${classes.dir}/${cloud-plugin-netscaler.jar}"/>
+ <mkdir dir="${jar.dir}"/>
+ </target>
+
+ <target name="compile-netscaler" depends="init" description="Compile NetScaler">
+ <compile-java jar.name="${cloud-plugin-netscaler.jar}" top.dir="${netscaler.base.dir}" classpath="netscaler.classpath" />
+ </target>
+
+ <target name="clean-netscaler">
+ <delete dir="${classes.dir}/${cloud-plugin-netscaler.jar}"/>
+ </target>
+
+ <target name="build" depends="compile-netscaler"/>
+ <target name="clean" depends="clean-netscaler"/>
+
+ <target name="help" description="help">
+ <echo level="info" message="This is the build file for NetScaler"/>
+ <echo level="info" message="You can do a build by doing ant build or clean by doing ant clean" />
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
new file mode 100644
index 0000000..283293f
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java
@@ -0,0 +1,129 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.api.commands;
+
+import org.apache.log4j.Logger;
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.PlugService;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.NetscalerLoadBalancerResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.ExternalLoadBalancerDeviceVO;
+import com.cloud.network.element.NetscalerLoadBalancerElementService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NetscalerLoadBalancerResponse.class, description="Adds a netscaler load balancer device")
+public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(AddNetscalerLoadBalancerCmd.class.getName());
+ private static final String s_name = "addnetscalerloadbalancerresponse";
+ @PlugService NetscalerLoadBalancerElementService _netsclarLbService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
+ private Long physicalNetworkId;
+
+ @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the netscaler load balancer appliance.")
+ private String url;
+
+ @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="Credentials to reach netscaler load balancer device")
+ private String username;
+
+ @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Credentials to reach netscaler load balancer device")
+ private String password;
+
+ @Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, required = true, description = "Netscaler device type supports NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer")
+ private String deviceType;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getDeviceType() {
+ return deviceType;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+ try {
+ ExternalLoadBalancerDeviceVO lbDeviceVO = _netsclarLbService.addNetscalerLoadBalancer(this);
+ if (lbDeviceVO != null) {
+ NetscalerLoadBalancerResponse response = _netsclarLbService.createNetscalerLoadBalancerResponse(lbDeviceVO);
+ response.setObjectName("netscalerloadbalancer");
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add netscaler load balancer due to internal error.");
+ }
+ } catch (InvalidParameterValueException invalidParamExcp) {
+ throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ } catch (CloudRuntimeException runtimeExcp) {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Adding a netscaler load balancer device";
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_EXTERNAL_LB_DEVICE_ADD;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return UserContext.current().getCaller().getId();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java
new file mode 100644
index 0000000..f5633a3
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java
@@ -0,0 +1,136 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.api.commands;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.PlugService;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.BaseCmd.CommandType;
+import com.cloud.api.response.NetscalerLoadBalancerResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.ExternalLoadBalancerDeviceVO;
+import com.cloud.network.element.NetscalerLoadBalancerElementService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NetscalerLoadBalancerResponse.class, description="configures a netscaler load balancer device")
+public class ConfigureNetscalerLoadBalancerCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ConfigureNetscalerLoadBalancerCmd.class.getName());
+ private static final String s_name = "configurenetscalerloadbalancerresponse";
+ @PlugService NetscalerLoadBalancerElementService _netsclarLbService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="external_load_balancer_devices")
+ @Parameter(name=ApiConstants.LOAD_BALANCER_DEVICE_ID, type=CommandType.LONG, required=true, description="Netscaler load balancer device ID")
+ private Long lbDeviceId;
+
+ @Parameter(name=ApiConstants.LOAD_BALANCER_DEVICE_CAPACITY, type=CommandType.LONG, required=false, description="capacity of the device, Capacity will be interpreted as number of networks device can handle")
+ private Long capacity;
+
+ @Parameter(name=ApiConstants.LOAD_BALANCER_DEVICE_DEDICATED, type=CommandType.BOOLEAN, required=false, description="true if this netscaler device to dedicated for a account, false if the netscaler device will be shared by multiple accounts")
+ private Boolean dedicatedUse;
+
+ @Parameter (name=ApiConstants.INLINE, type=CommandType.BOOLEAN, required=false, description="true if netscaler load balancer is intended to be used in in-line with firewall, false if netscaler load balancer will side-by-side with firewall")
+ private Boolean inline;
+
+ @IdentityMapper(entityTableName="host_pod_ref")
+ @Parameter(name=ApiConstants.POD_IDS, type=CommandType.LIST, required=false, description="Used when NetScaler device is provider of EIP service." +
+ " This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to " +
+ "route pod's subnet IP to a NetScaler device.")
+ private List<Long> podIds;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getLoadBalancerDeviceId() {
+ return lbDeviceId;
+ }
+
+ public Long getLoadBalancerCapacity() {
+ return capacity;
+ }
+
+ public Boolean getLoadBalancerDedicated() {
+ return dedicatedUse;
+ }
+
+ public Boolean getLoadBalancerInline() {
+ return inline;
+ }
+
+ public List<Long> getPodIds() {
+ return podIds;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+ try {
+ ExternalLoadBalancerDeviceVO lbDeviceVO = _netsclarLbService.configureNetscalerLoadBalancer(this);
+ if (lbDeviceVO != null) {
+ NetscalerLoadBalancerResponse response = _netsclarLbService.createNetscalerLoadBalancerResponse(lbDeviceVO);
+ response.setObjectName("netscalerloadbalancer");
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to configure netscaler load balancer due to internal error.");
+ }
+ } catch (InvalidParameterValueException invalidParamExcp) {
+ throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ } catch (CloudRuntimeException runtimeExcp) {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Configuring a netscaler load balancer device";
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_EXTERNAL_LB_DEVICE_CONFIGURE;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return UserContext.current().getCaller().getId();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java
new file mode 100644
index 0000000..a2cb540
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java
@@ -0,0 +1,100 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.api.commands;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.PlugService;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.element.NetscalerLoadBalancerElementService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=SuccessResponse.class, description=" delete a netscaler load balancer device")
+public class DeleteNetscalerLoadBalancerCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(DeleteNetscalerLoadBalancerCmd.class.getName());
+ private static final String s_name = "deletenetscalerloadbalancerresponse";
+ @PlugService NetscalerLoadBalancerElementService _netsclarLbService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="external_load_balancer_devices")
+ @Parameter(name=ApiConstants.LOAD_BALANCER_DEVICE_ID, type=CommandType.LONG, required=true, description="netscaler load balancer device ID")
+ private Long lbDeviceId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getLoadBalancerDeviceId() {
+ return lbDeviceId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+ try {
+ boolean result = _netsclarLbService.deleteNetscalerLoadBalancer(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete netscaler load balancer.");
+ }
+ } catch (InvalidParameterValueException invalidParamExcp) {
+ throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ } catch (CloudRuntimeException runtimeExcp) {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Deleting a netscaler load balancer device";
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_LOAD_BALANCER_DELETE;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return UserContext.current().getCaller().getId();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
new file mode 100644
index 0000000..9099560
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java
@@ -0,0 +1,94 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.BaseListCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.PlugService;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.NetworkResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.network.element.NetscalerLoadBalancerElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NetworkResponse.class, description="lists network that are using a netscaler load balancer device")
+public class ListNetscalerLoadBalancerNetworksCmd extends BaseListCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ListNetscalerLoadBalancerNetworksCmd.class.getName());
+ private static final String s_name = "listnetscalerloadbalancernetworksresponse";
+ @PlugService NetscalerLoadBalancerElementService _netsclarLbService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="external_load_balancer_devices")
+ @Parameter(name=ApiConstants.LOAD_BALANCER_DEVICE_ID, type=CommandType.LONG, required = true, description="netscaler load balancer device ID")
+ private Long lbDeviceId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getLoadBalancerDeviceId() {
+ return lbDeviceId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+ try {
+ List<? extends Network> networks = _netsclarLbService.listNetworks(this);
+ ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
+ List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
+
+ if (networks != null && !networks.isEmpty()) {
+ for (Network network : networks) {
+ NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
+ networkResponses.add(networkResponse);
+ }
+ }
+
+ response.setResponses(networkResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } catch (InvalidParameterValueException invalidParamExcp) {
+ throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ } catch (CloudRuntimeException runtimeExcp) {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java
new file mode 100644
index 0000000..daca111
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java
@@ -0,0 +1,102 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.BaseListCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.PlugService;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.NetscalerLoadBalancerResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.ExternalLoadBalancerDeviceVO;
+import com.cloud.network.element.NetscalerLoadBalancerElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NetscalerLoadBalancerResponse.class, description="lists netscaler load balancer devices")
+public class ListNetscalerLoadBalancersCmd extends BaseListCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ListNetscalerLoadBalancersCmd.class.getName());
+ private static final String s_name = "listnetscalerloadbalancerresponse";
+ @PlugService NetscalerLoadBalancerElementService _netsclarLbService;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID")
+ private Long physicalNetworkId;
+
+ @IdentityMapper(entityTableName="external_load_balancer_devices")
+ @Parameter(name=ApiConstants.LOAD_BALANCER_DEVICE_ID, type=CommandType.LONG, description="netscaler load balancer device ID")
+ private Long lbDeviceId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getLoadBalancerDeviceId() {
+ return lbDeviceId;
+ }
+
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+ try {
+ List<ExternalLoadBalancerDeviceVO> lbDevices = _netsclarLbService.listNetscalerLoadBalancers(this);
+ ListResponse<NetscalerLoadBalancerResponse> response = new ListResponse<NetscalerLoadBalancerResponse>();
+ List<NetscalerLoadBalancerResponse> lbDevicesResponse = new ArrayList<NetscalerLoadBalancerResponse>();
+
+ if (lbDevices != null && !lbDevices.isEmpty()) {
+ for (ExternalLoadBalancerDeviceVO lbDeviceVO : lbDevices) {
+ NetscalerLoadBalancerResponse lbdeviceResponse = _netsclarLbService.createNetscalerLoadBalancerResponse(lbDeviceVO);
+ lbDevicesResponse.add(lbdeviceResponse);
+ }
+ }
+
+ response.setResponses(lbDevicesResponse);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } catch (InvalidParameterValueException invalidParamExcp) {
+ throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
+ } catch (CloudRuntimeException runtimeExcp) {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
new file mode 100644
index 0000000..bbbfca5
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
@@ -0,0 +1,116 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.response;
+
+import java.util.List;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.Parameter;
+import com.cloud.api.BaseCmd.CommandType;
+import com.cloud.utils.IdentityProxy;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class NetscalerLoadBalancerResponse extends BaseResponse {
+
+ @SerializedName(ApiConstants.LOAD_BALANCER_DEVICE_ID) @Param(description="device id of the netscaler load balancer")
+ private IdentityProxy id = new IdentityProxy("external_load_balancer_devices");
+
+ @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network to which this netscaler device belongs to")
+ private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
+
+ @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider")
+ private String providerName;
+
+ @SerializedName(ApiConstants.LOAD_BALANCER_DEVICE_NAME) @Param(description="device name")
+ private String deviceName;
+
+ @SerializedName(ApiConstants.LOAD_BALANCER_DEVICE_STATE) @Param(description="device state")
+ private String deviceState;
+
+ @SerializedName(ApiConstants.LOAD_BALANCER_DEVICE_CAPACITY) @Param(description="device capacity")
+ private Long deviceCapacity;
+
+ @SerializedName(ApiConstants.LOAD_BALANCER_DEVICE_DEDICATED) @Param(description="true if device is dedicated for an account")
+ private Boolean dedicatedLoadBalancer;
+
+ @SerializedName(ApiConstants.INLINE) @Param(description="true if device is inline with firewall device")
+ private Boolean inlineLoadBalancer;
+
+ @SerializedName(ApiConstants.PUBLIC_INTERFACE) @Param(description="the public interface of the load balancer")
+ private String publicInterface;
+
+ @SerializedName(ApiConstants.PRIVATE_INTERFACE) @Param(description="the private interface of the load balancer")
+ private String privateInterface;
+
+ @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the management IP address of the external load balancer")
+ private String ipAddress;
+
+ @SerializedName(ApiConstants.POD_IDS) @Param(description="Used when NetScaler device is provider of EIP service." +
+ " This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to " +
+ "route pod's subnet IP to a NetScaler device.")
+ private List<Long> podIds;
+
+ public void setId(long lbDeviceId) {
+ this.id.setValue(lbDeviceId);
+ }
+
+ public void setPhysicalNetworkId(long physicalNetworkId) {
+ this.physicalNetworkId.setValue(physicalNetworkId);
+ }
+
+ public void setProvider(String provider) {
+ this.providerName = provider;
+ }
+
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
+
+ public void setDeviceCapacity(long deviceCapacity) {
+ this.deviceCapacity = deviceCapacity;
+ }
+
+ public void setDedicatedLoadBalancer(boolean isDedicated) {
+ this.dedicatedLoadBalancer = isDedicated;
+ }
+
+ public void setDeviceState(String deviceState) {
+ this.deviceState = deviceState;
+ }
+
+ public void setInlineMode(boolean inline) {
+ this.inlineLoadBalancer = inline;
+ }
+
+ public void setPublicInterface(String publicInterface) {
+ this.publicInterface = publicInterface;
+ }
+
+ public void setPrivateInterface(String privateInterface) {
+ this.privateInterface = privateInterface;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public void setAssociatedPods(List<Long> pods) {
+ this.podIds = pods;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/network/NetScalerPodVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/NetScalerPodVO.java b/plugins/network-elements/netscaler/src/com/cloud/network/NetScalerPodVO.java
new file mode 100644
index 0000000..9325c14
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/NetScalerPodVO.java
@@ -0,0 +1,61 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.cloud.network;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * NetScalerPodVO contains information about a EIP deployment where on datacenter L3 router a PBR (policy
+ * based routing) is setup between a POD's subnet IP range to a NetScaler device. This VO object
+ * represents a mapping between a POD and NetScaler device where PBR is setup.
+ *
+ */
+@Entity
+@Table(name="netscaler_pod_ref")
+public class NetScalerPodVO {
+
+ @Column(name="external_load_balancer_device_id")
+ private long netscalerDeviceId;
+
+ @Id
+ @Column(name="id")
+ private long id;
+
+ @Column(name="pod_id")
+ private long podId;
+
+ public NetScalerPodVO() {
+
+ }
+
+ public NetScalerPodVO(long netscalerDeviceId, long podId) {
+ this.netscalerDeviceId = netscalerDeviceId;
+ this.podId = podId;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public long getPodId() {
+ return podId;
+ }
+
+ public long getNetscalerDeviceId() {
+ return netscalerDeviceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDao.java b/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDao.java
new file mode 100644
index 0000000..4a45861
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDao.java
@@ -0,0 +1,24 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.NetScalerPodVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface NetScalerPodDao extends GenericDao<NetScalerPodVO, Long> {
+
+ NetScalerPodVO findByPodId(long podId);
+
+ List<NetScalerPodVO> listByNetScalerDeviceId(long netscalerDeviceId);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/49b88472/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java b/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java
new file mode 100644
index 0000000..f4df313
--- /dev/null
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java
@@ -0,0 +1,57 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License. Citrix Systems, Inc.
+// reserves all rights not expressly granted by the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import com.cloud.network.NetScalerPodVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Local(value=NetScalerPodDao.class) @DB(txn=false)
+public class NetScalerPodDaoImpl extends GenericDaoBase<NetScalerPodVO, Long> implements NetScalerPodDao {
+
+ final SearchBuilder<NetScalerPodVO> podIdSearch;
+ final SearchBuilder<NetScalerPodVO> deviceIdSearch;
+
+ protected NetScalerPodDaoImpl() {
+ super();
+
+ podIdSearch = createSearchBuilder();
+ podIdSearch.and("pod_id", podIdSearch.entity().getPodId(), Op.EQ);
+ podIdSearch.done();
+
+ deviceIdSearch = createSearchBuilder();
+ deviceIdSearch.and("netscalerDeviceId", deviceIdSearch.entity().getNetscalerDeviceId(), Op.EQ);
+ deviceIdSearch.done();
+ }
+
+ @Override
+ public NetScalerPodVO findByPodId(long podId) {
+ SearchCriteria<NetScalerPodVO> sc = podIdSearch.create();
+ sc.setParameters("pod_id", podId);
+ return findOneBy(sc);
+ }
+
+ @Override
+ public List<NetScalerPodVO> listByNetScalerDeviceId(long netscalerDeviceId) {
+ SearchCriteria<NetScalerPodVO> sc = deviceIdSearch.create();
+ sc.setParameters("netscalerDeviceId", netscalerDeviceId);
+ return search(sc, null);
+ }
+
+}