diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/bindirbak/cloud-run-test.in ./vogxn-asf-marvin-updates-f66caa0/test/bindirbak/cloud-run-test.in
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/bindirbak/cloud-run-test.in	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/bindirbak/cloud-run-test.in	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+set -e
+
+LIBS="
+commons-httpclient
+commons-httpclient-3.1
+commons-logging
+commons-logging-1.1.1
+commons-codec
+commons-codec-1.3
+log4j
+log4j-1.2.15
+cloud-test
+cloud-utils
+trilead-ssh2
+trilead-ssh2-build213
+"
+
+JAVADIR="@JAVADIR@"
+VMOPSCONF="@SYSCONFDIR@"/vmops/test
+if [ "$OSTYPE" == "cygwin" ] ; then
+  true
+else
+  set +e
+  CLASSPATH=$(build-classpath $LIBS 2>/dev/null)
+  set -e
+  CLASSPATH="$CLASSPATH":"$VMOPSCONF"
+  export CLASSPATH
+fi
+
+test="$1"
+shift || true
+if [ "$test" == "" ] ; then
+   echo usage: $0 test.to.run \<parameters...\> > /dev/stderr
+   exit 64
+fi
+java -cp "$CLASSPATH" com.cloud.test."$test" "$@"
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/.classpath ./vogxn-asf-marvin-updates-f66caa0/test/.classpath
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/.classpath	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/.classpath	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,31 @@
+<?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.
+-->
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/utils"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/server"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/api"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/tools"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/config.xml ./vogxn-asf-marvin-updates-f66caa0/test/conf/config.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/config.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/config.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,103 @@
+<config>
+<!--
+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.
+-->
+<!-- HERE IS THE POST DEPLOYMENT SECTIION; YOU ADD HOSTS/SECONDARY AND PRIMARY STORAGE HERE -->
+	<command>
+		<name>addSecondaryStorage</name>
+		<parameters>
+			<item>
+				<name>zoneid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>nfs://192.168.161.21/export/regression/secondary</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>addHost</name>
+		<parameters>
+			<item>
+				<name>zoneid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>podid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.161.25</value>
+			</item>
+			<item>
+				<name>username</name>
+				<value>root</value>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>clustername</name>
+				<value>firstcluster</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 3 min to ensure that host is in UP state</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>180</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createStoragePool</name>
+		<parameters>
+			<item>
+				<name>zoneid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>podid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>nfs://192.168.161.21/export/regression/primary</value>
+			</item>
+			<item>
+				<name>clusterid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+</config>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/deploy.properties ./vogxn-asf-marvin-updates-f66caa0/test/conf/deploy.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/deploy.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/deploy.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,31 @@
+#!/bin/bash
+# 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.
+
+COMPUTE="192.168.161.25"
+SERVER="192.168.131.168"
+SECONDARY_STORAGE="192.168.161.21"
+SECONDARY_STORAGE_DIR=/export/regression/secondary
+PRIMARY_STORAGE="192.168.161.21"
+PRIMARY_STORAGE_DIR=/export/regression/primary
+#Db server ip address
+DB="192.168.131.168"
+#Equal to management server ip if management server is not running in cluster
+LB="192.168.131.168"
+USER=root
+CONFIGDIR=/root/test
+LOGDIR=/var/log/cloud/management
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/deploy.xml ./vogxn-asf-marvin-updates-f66caa0/test/conf/deploy.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/deploy.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/deploy.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,184 @@
+<!--
+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.
+-->
+<deploy>
+
+<!-- SETUP YOUR ZONES, PODS, VLANS HERE -->
+
+<!-- Zone configuration (I do delete default pod and zone)-->
+	<command>
+		<name>deletePod</name>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteZone</name>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>createZone</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>ZONE1</value>
+			</item>
+			<item>
+				<name>dns1</name>
+				<value>192.168.10.253</value>
+			</item>
+			<item>
+				<name>dns2</name>
+				<value>192.168.10.254</value>
+			</item>
+			<item>
+				<name>internaldns1</name>
+				<value>192.168.10.253</value>
+			</item>
+			<item>
+				<name>vlan</name>
+				<value>400-499</value>
+			</item>
+			<item>
+                	<name>guestcidraddress</name>
+                    <value>10.1.1.0/24</value>
+            </item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createVlanIpRange</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>Public</value>
+			</item>
+			<item>
+				<name>zoneid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>vlan</name>
+				<value>19</value>
+			</item>
+			<item>
+				<name>gateway</name>
+				<value>172.19.0.1</value>
+			</item>
+			<item>
+				<name>netmask</name>
+				<value>255.255.0.0</value>
+			</item>
+			<item>
+				<name>startip</name>
+				<value>172.19.0.100</value>
+			</item>
+			<item>
+				<name>endip</name>
+				<value>172.19.0.254</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createPod</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>POD1</value>
+			</item>
+			<item>
+				<name>zoneid</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>cidr</name>
+				<value>192.168.161.0/24</value>
+			</item>
+			<item>
+				<name>startip</name>
+				<value>192.168.161.100</value>
+			</item>
+			<item>
+				<name>endip</name>
+				<value>192.168.161.200</value>
+			</item>
+			<item>
+				<name>gateway</name>
+				<value>192.168.161.1</value>
+			</item>
+		</parameters>
+	</command>
+
+
+<!-- SETUP YOUR CONFIGURATION VALUES HERE -->
+
+<!--  Network setup - vmName, guest network config -->
+	<command>
+		<name>updateConfiguration</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>instance.name</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>sanity</value>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>updateConfiguration</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>expunge.delay</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>updateConfiguration</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>expunge.interval</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+
+</deploy>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/log4j.properties ./vogxn-asf-marvin-updates-f66caa0/test/conf/log4j.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/log4j.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/log4j.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,31 @@
+# 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.
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+log4j.appender.stdout.threshold=INFO
+log4j.rootLogger=INFO, stdout, rolling
+log4j.appender.rolling=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
+log4j.appender.rolling.layout.ConversionPattern=%d %-5p [%c{3}] (%t:%x) %m%n
+log4j.appender.rolling.file.threshold=DEBUG
+log4j.appender.rolling.File=./logs/testclient.log
+log4j.appender.rolling.DatePattern='.'yyy-MM-dd
+log4j.appender.rolling.file.append=false
+log4j.category.org.apache=INFO, rolling, stdout
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/log4j-stdout.properties ./vogxn-asf-marvin-updates-f66caa0/test/conf/log4j-stdout.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/log4j-stdout.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/log4j-stdout.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,23 @@
+# 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.
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+log4j.appender.stdout.threshold=INFO
+log4j.rootLogger=INFO, stdout
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/README ./vogxn-asf-marvin-updates-f66caa0/test/conf/README
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/README	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/README	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,8 @@
+To run submitCertEC2 and deleteCertEC2 scripts, update parameters in conf/tool.properties file:
+
+* host - ip address of the host where cloud-bridge software is installed
+* port - port cloud-bridge software is listening to
+* accesspoint - access point for cloud-bridge REST request
+* version - Amazon EC2 api version supported by cloud-bridge
+* signaturemethod - HmacSHA1 or HmacSHA256
+* expires - the date when certificate expires
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/templates.sql ./vogxn-asf-marvin-updates-f66caa0/test/conf/templates.sql
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/templates.sql	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/templates.sql	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,17 @@
+-- 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.
+INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, ready, display_text, enable_password, format, guest_os_id, create_status, cross_zones)    VALUES (1, 'routing', 'DomR Template', 0, now(), 'ext3', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/latest/routing.vhd.bz2', 0, 'DomR Template', 0, 'VHD', 10, 'Creating', 1);INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, ready, display_text, enable_password, format, guest_os_id, create_status, cross_zones)    VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/ami-ccb35ea5/ami-ccb35ea5.vhd.bz2', 0, 'CentOS 5.3(x86_64) no GUI', 0, 'VHD', 10, 'Creating', 1);INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, created, type,hvm, bits, account_id, url, ready, display_text, enable_password, format, guest_os_id, create_status)    VALUES (5, 'ubuntu iso', 'Ubuntu iso', 1, now(), 'cdfs', 1, 64, 1, 'http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso', 0, 'Ubuntu iso', 0, 'ISO', 51, 'Creating');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (1, 'CentOS');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (2, 'Citrix');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (3, 'Debian');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (4, 'Oracle');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (5, 'RedHat');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (6, 'SUSE');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (7, 'Windows');INSERT INTO `vmops`.`guest_os_category` (id, name) VALUES (8, 'Other');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (1, 1, 'CentOS 4.5', 'CentOS 4.5');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (2, 1, 'CentOS 4.6', 'CentOS 4.6');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (3, 1, 'CentOS 4.7', 'CentOS 4.7');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (4, 1, 'CentOS 5.0', 'CentOS 5.0');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (5, 1, 'CentOS 5.0 x64', 'CentOS 5.0 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (6, 1, 'CentOS 5.1', 'CentOS 5.1');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (7, 1, 'CentOS 5.1 x64', 'CentOS 5.1 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (8, 1, 'CentOS 5.2', 'CentOS 5.2');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (9, 1, 'CentOS 5.2 x64', 'CentOS 5.2 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (10, 1, 'CentOS 5.3', 'CentOS 5.3');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (11, 1, 'CentOS 5.3 x64', 'CentOS 5.3 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (12, 2, 'Citrix XenApp', 'Citrix XenApp');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (13, 2, 'Citrix XenApp x64', 'Citrix XenApp x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (14, 3, 'Debian Lenny 5.0', 'Debian Lenny 5.0');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (15, 4, 'Oracle Enterprise Linux 5.0', 'Oracle Enterprise Linux 5.0');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (16, 4, 'Oracle Enterprise Linux 5.0 x64', 'Oracle Enterprise Linux 5.0 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (17, 4, 'Oracle Enterprise Linux 5.1', 'Oracle Enterprise Linux 5.1');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (18, 4, 'Oracle Enterprise Linux 5.1 x64', 'Oracle Enterprise Linux 5.1 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (19, 4, 'Oracle Enterprise Linux 5.2', 'Oracle Enterprise Linux 5.2');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (20, 4, 'Oracle Enterprise Linux 5.2 x64', 'Oracle Enterprise Linux 5.2 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (21, 5, 'Red Hat Enterprise Linux 4.5', 'Red Hat Enterprise Linux 4.5');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (22, 5, 'Red Hat Enterprise Linux 4.6', 'Red Hat Enterprise Linux 4.6');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (23, 5, 'Red Hat Enterprise Linux 4.7', 'Red Hat Enterprise Linux 4.7');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (24, 5, 'Red Hat Enterprise Linux 5.0', 'Red Hat Enterprise Linux 5.0');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (25, 5, 'Red Hat Enterprise Linux 5.0 x64', 'Red Hat Enterprise Linux 5.0 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (26, 5, 'Red Hat Enterprise Linux 5.1', 'Red Hat Enterprise Linux 5.1');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (27, 5, 'Red Hat Enterprise Linux 5.1 x64', 'Red Hat Enterprise Linux 5.1 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (28, 5, 'Red Hat Enterprise Linux 5.2', 'Red Hat Enterprise Linux 5.2');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (29, 5, 'Red Hat Enterprise Linux 5.2 x64', 'Red Hat Enterprise Linux 5.2 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (30, 5, 'Red Hat Enterprise Linux 5.3', 'Red Hat Enterprise Linux 5.3');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (31, 5, 'Red Hat Enterprise Linux 5.3 x64', 'Red Hat Enterprise Linux 5.3 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (32, 6, 'SUSE Linux Enterprise Server 9 SP4', 'SUSE Linux Enterprise Server 9 SP4');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (33, 6, 'SUSE Linux Enterprise Server 10 SP1', 'SUSE Linux Enterprise Server 10 SP1');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (34, 6, 'SUSE Linux Enterprise Server 10 SP1 x64', 'SUSE Linux Enterprise Server 10 SP1 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (35, 6, 'SUSE Linux Enterprise Server 10 SP2', 'SUSE Linux Enterprise Server 10 SP2');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (36, 6, 'SUSE Linux Enterprise Server 10 SP2 x64', 'SUSE Linux Enterprise Server 10 SP2 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (37, 6, 'SUSE Linux Enterprise Server 11', 'SUSE Linux Enterprise Server 11');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (38, 6, 'SUSE Linux Enterprise Server 11 x64', 'SUSE Linux Enterprise Server 11 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (39, 7, 'Windows 7', 'Windows 7');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (40, 7, 'Windows 7 x64', 'Windows 7 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (41, 7, 'Windows Server 2003', 'Windows Server 2003');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (42, 7, 'Windows Server 2003 x64', 'Windows Server 2003 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (43, 7, 'Windows Server 2008', 'Windows Server 2008');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (44, 7, 'Windows Server 2008 x64', 'Windows Server 2008 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (45, 7, 'Windows Server 2008 R2 x64', 'Windows Server 2008 R2 x64');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (46, 7, 'Windows 2000 SP4', 'Windows 2000 SP4');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (47, 7, 'Windows Vista', 'Windows Vista');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (48, 7, 'Windows XP SP2', 'Windows XP SP2');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (49, 7, 'Windows XP SP3', 'Windows XP SP3');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (50, 8, 'Other install media', 'Ubuntu');INSERT INTO `vmops`.`guest_os` (id, category_id, name, display_name) VALUES (51, 8, 'Other install media', 'Other');
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/tool.properties ./vogxn-asf-marvin-updates-f66caa0/test/conf/tool.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/conf/tool.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/conf/tool.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,23 @@
+# 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.
+
+host=172.16.1.227
+expires=2010-11-15
+version=2010-08-31
+port=8080
+signaturemethod=HmacSHA1
+accesspoint=bridge/rest/AmazonEC2
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/__init__.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/__init__.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/__init__.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/__init__.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,16 @@
+# 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.
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/README ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/README
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/README	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/README	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,41 @@
+P1 Cases
+--------------------------------------
+These test cases are the core functionality tests that ensure the application is stable and can be tested thoroughly.
+These P1 cases definitions are located at : https://docs.google.com/a/clogeny.com/spreadsheet/ccc?key=0Aq5M2ldK6eyedDJBa0EzM0RPNmdVNVZOWnFnOVJJcHc&hl=en_US
+
+
+Guidelines
+----------
+P1 test cases are being developed using Python's unittests2. Following are certain guidelines being followed
+    1. Tests exercised for the same resource should ideally be present under a single suite or file.
+
+    2. Time-consuming operations that create new cloud resources like server creation, volume creation etc 
+        should not necessarily be exercised per unit test. The resources can be shared by creating them at 
+        the class-level using setUpClass and shared across all instances during a single run.
+
+    3. Certain tests pertaining to NAT, Firewall and Load Balancing warrant fresh resources per test. Hence a call should be
+        taken by the stakeholders regarding sharing resources.
+
+    4. Ensure that the tearDown/tearDownClass functions clean up all the resources created during the test run. 
+
+For more information about unittests: http://docs.python.org/library/unittest.html
+
+
+P1 Tests
+----------
+The following files contain these P1 cases:
+
+1. test_snapshots.py - Snapshots related tests
+2. test_routers.py - Router related tests
+3. test_usage.py - Usage realted tests
+4. test_account.py - Account related tests
+5. test_resource_limits.py - Resource limits tests
+6. test_security_groups.py - Security groups related tests
+7. test_templates.py - templates related tests
+8. test_volumes.py - Volumes related tests
+9. test_blocker_bugs.py - Blocker bugs tests
+10. test_project_configs.py - Project global configuration related tests
+11. test_project_limits.py - Project resource limits related tests
+12. test_project_resources.py - Project resource creation related tests
+13. test_project_usage.py - Project usage related tests
+14. test_projects - Projects functionality tests
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_accounts.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_accounts.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_accounts.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_accounts.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1976 @@
+# 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.
+""" P1 tests for Account
+"""
+#Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test Account Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                                   },
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "fr3sca",
+                         },
+                         "user": {
+                                    "email": "user@test.com",
+                                    "firstname": "User",
+                                    "lastname": "User",
+                                    "username": "User",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "fr3sca",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    # in MHz
+                                    "memory": 64,
+                                    # In MBs
+                        },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                         },
+                         "template": {
+                                "displaytext": "Public Template",
+                                "name": "Public template",
+                                "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                                "hypervisor": 'XenServer',
+                                "format": 'VHD',
+                                "isfeatured": True,
+                                "ispublic": True,
+                                "isextractable": True,
+                        },
+                        "natrule": {
+                                    "publicport": 22,
+                                    "privateport": 22,
+                                    "protocol": 'TCP',
+                        },
+                        "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced'
+                    }
+
+
+class TestAccounts(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestAccounts,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [cls.service_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_create_account(self):
+        """Test Create Account and user for that account
+        """
+
+        # Validate the following
+        # 1. Create an Account. Verify the account is created.
+        # 2. Create User associated with that account. Verify the created user
+
+        # Create an account
+        account = Account.create(
+                            self.apiclient,
+                            self.services["account"]
+                            )
+        self.debug("Created account: %s" % account.account.name)
+        self.cleanup.append(account)
+        list_accounts_response = list_accounts(
+                                               self.apiclient,
+                                               id=account.account.id
+                                               )
+        self.assertEqual(
+                         isinstance(list_accounts_response, list),
+                         True,
+                         "Check list accounts for valid data"
+                         )
+        self.assertNotEqual(
+                            len(list_accounts_response),
+                            0,
+                            "Check List Account response"
+                            )
+
+        account_response = list_accounts_response[0]
+        self.assertEqual(
+                            account.account.accounttype,
+                            account_response.accounttype,
+                            "Check Account Type of Created account"
+                            )
+        self.assertEqual(
+                            account.account.name,
+                            account_response.name,
+                            "Check Account Name of Created account"
+                            )
+        # Create an User associated with account
+        user = User.create(
+                            self.apiclient,
+                            self.services["user"],
+                            account=account.account.name,
+                            domainid=account.account.domainid
+                            )
+        self.debug("Created user: %s" % user.id)
+        list_users_response = list_users(
+                                         self.apiclient,
+                                         id=user.id
+                                      )
+        self.assertEqual(
+                         isinstance(list_users_response, list),
+                         True,
+                         "Check list users for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(list_users_response),
+                            0,
+                            "Check List User response"
+                            )
+
+        user_response = list_users_response[0]
+        self.assertEqual(
+                            user.username,
+                            user_response.username,
+                            "Check username of Created user"
+                            )
+        self.assertEqual(
+                            user.state,
+                            user_response.state,
+                            "Check state of created user"
+                            )
+        return
+
+
+class TestRemoveUserFromAccount(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestRemoveUserFromAccount,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        # Create an account
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"]
+                            )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, users etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_user_remove_VM_running(self):
+        """Test Remove one user from the account
+        """
+
+        # Validate the following
+        # 1. Create an account with 2 users.
+        # 2. Start 2 VMs; one for each user of the account
+        # 3. Remove one user from the account. Verify that account still exists.
+        # 4. Verify that VM started by the removed user are still running
+
+        # Create an User associated with account and VMs
+        user_1 = User.create(
+                            self.apiclient,
+                            self.services["user"],
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid
+                            )
+        self.debug("Created user: %s" % user_1.id)
+        user_2 = User.create(
+                            self.apiclient,
+                            self.services["user"],
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid
+                            )
+        self.debug("Created user: %s" % user_2.id)
+        self.cleanup.append(user_2)
+
+        vm_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        self.debug("Deployed VM in account: %s, ID: %s" % (
+                                                           self.account.account.name,
+                                                           vm_1.id
+                                                           ))
+        self.cleanup.append(vm_1)
+
+        vm_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        self.debug("Deployed VM in account: %s, ID: %s" % (
+                                                           self.account.account.name,
+                                                           vm_2.id
+                                                           ))
+        self.cleanup.append(vm_2)
+
+        # Remove one of the user
+        self.debug("Deleting user: %s" % user_1.id)
+        user_1.delete(self.apiclient)
+
+        # Account should exist after deleting user
+        accounts_response = list_accounts(
+                                          self.apiclient,
+                                          id=self.account.account.id
+                                        )
+        self.assertEqual(
+                         isinstance(accounts_response, list),
+                         True,
+                         "Check for valid list accounts response"
+                         )
+
+        self.assertNotEqual(
+                            len(accounts_response),
+                            0,
+                            "Check List Account response"
+                            )
+        vm_response = list_virtual_machines(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                         isinstance(vm_response, list),
+                         True,
+                         "Check for valid list VM response"
+                         )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check List VM response"
+                            )
+
+        # VMs associated with that account should be running
+        for vm in vm_response:
+            self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check state of VMs associated with account"
+                            )
+        return
+
+    @unittest.skip("Open Questions")
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_02_remove_all_users(self):
+        """Test Remove both users from the account
+        """
+
+        # Validate the following
+        # 1. Remove both the users from the account.
+        # 2. Verify account is removed
+        # 3. Verify all VMs associated with that account got removed
+
+        # Create an User associated with account and VMs
+        user_1 = User.create(
+                            self.apiclient,
+                            self.services["user"],
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid
+                            )
+        self.debug("Created user: %s" % user_1.id)
+        user_2 = User.create(
+                            self.apiclient,
+                            self.services["user"],
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid
+                            )
+        self.debug("Created user: %s" % user_2.id)
+        vm_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        self.debug("Deployed VM in account: %s, ID: %s" % (
+                                                           self.account.account.name,
+                                                           vm_1.id
+                                                           ))
+        vm_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        self.debug("Deployed VM in account: %s, ID: %s" % (
+                                                           self.account.account.name,
+                                                           vm_2.id
+                                                           ))
+        # Get users associated with an account
+        # (Total 3: 2 - Created & 1 default generated while account creation)
+        users = list_users(
+                          self.apiclient,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid
+                          )
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "Check for valid list users response"
+                         )
+        for user in users:
+
+            self.debug("Deleting user: %s" % user.id)
+            cmd = deleteUser.deleteUserCmd()
+            cmd.id = user.id
+            self.apiclient.deleteUser(cmd)
+
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+        self.assertEqual(
+                         isinstance(interval, list),
+                         True,
+                         "Check for valid list configurations response"
+                         )
+        self.debug("account.cleanup.interval: %s" % interval[0].value)
+
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value))
+
+        # Account is removed after last user is deleted
+        account_response = list_accounts(
+                                         self.apiclient,
+                                         id=self.account.account.id
+                                         )
+        self.assertEqual(
+                            account_response,
+                            None,
+                            "Check List VM response"
+                            )
+        # All VMs associated with account are removed.
+        vm_response = list_virtual_machines(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            vm_response,
+                            None,
+                            "Check List VM response"
+                            )
+        # DomR associated with account is deleted
+        with self.assertRaises(Exception):
+            list_routers(
+                          self.apiclient,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid
+                        )
+        return
+
+
+class TestNonRootAdminsPrivileges(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNonRootAdminsPrivileges,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone settings
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create an account, domain etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"],
+                                   )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls._cleanup = [
+                        cls.account,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_non_root_admin_Privileges(self):
+        """Test to verify Non Root admin previleges"""
+
+        # Validate the following
+        # 1. Create few accounts/users in ROOT domain
+        # 2. Verify listAccounts API gives only accounts associated with new
+        #    domain.
+
+        # Create accounts for ROOT domain
+        account_1 = Account.create(
+                            self.apiclient,
+                            self.services["account"]
+                            )
+        self.debug("Created account: %s" % account_1.account.name)
+        self.cleanup.append(account_1)
+        account_2 = Account.create(
+                            self.apiclient,
+                            self.services["account"]
+                            )
+        self.debug("Created account: %s" % account_2.account.name)
+        self.cleanup.append(account_2)
+
+        accounts_response = list_accounts(
+                                          self.apiclient,
+                                          domainid=self.domain.id
+                                          )
+
+        self.assertEqual(
+                         isinstance(accounts_response, list),
+                         True,
+                         "Check list accounts response for valid data"
+                        )
+
+        self.assertEqual(
+                            len(accounts_response),
+                            1,
+                            "Check List accounts response"
+                            )
+        # Verify only account associated with domain is listed
+        for account in accounts_response:
+            self.assertEqual(
+                            account.domainid,
+                            self.domain.id,
+                            "Check domain ID of account"
+                            )
+        return
+
+
+class TestServiceOfferingSiblings(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestServiceOfferingSiblings,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Create Domains, accounts etc
+        cls.domain_1 = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+        cls.domain_2 = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            domainid=cls.domain_1.id
+                                            )
+        # Create account for doamin_1
+        cls.account_1 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain_1.id
+                            )
+
+        # Create an account for domain_2
+        cls.account_2 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain_2.id
+                            )
+
+        cls._cleanup = [
+                        cls.account_1,
+                        cls.account_2,
+                        cls.service_offering,
+                        cls.domain_1,
+                        cls.domain_2,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created domains, accounts
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_service_offering_siblings(self):
+        """Test to verify service offerings at same level in hierarchy"""
+
+        # Validate the following
+        # 1. Verify service offering is visible for domain_1
+        # 2. Verify service offering is not visible for domain_2
+
+        service_offerings = list_service_offering(
+                                                  self.apiclient,
+                                                  domainid=self.domain_1.id
+                                                  )
+        self.assertEqual(
+                         isinstance(service_offerings, list),
+                         True,
+                         "Check if valid list service offerings response"
+                        )
+
+        self.assertNotEqual(
+                            len(service_offerings),
+                            0,
+                            "Check List Service Offerings response"
+                            )
+
+        for service_offering in service_offerings:
+            self.debug("Validating service offering: %s" % service_offering.id)
+            self.assertEqual(
+               service_offering.id,
+               self.service_offering.id,
+               "Check Service offering ID for domain" + str(self.domain_1.name)
+            )
+        # Verify private service offering is not visible to other domain
+        service_offerings = list_service_offering(
+                                                  self.apiclient,
+                                                  domainid=self.domain_2.id
+                                                  )
+        self.assertEqual(
+                    service_offerings,
+                    None,
+                    "Check List Service Offerings response for other domain"
+                    )
+        return
+
+
+@unittest.skip("Open Questions")
+class TestServiceOfferingHierarchy(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestServiceOfferingHierarchy,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Create domain, service offerings etc
+        cls.domain_1 = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+        cls.domain_2 = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"],
+                                   parentdomainid=cls.domain_1.id
+                                   )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            domainid=cls.domain_1.id
+                                            )
+        # Create account for doamin_1
+        cls.account_1 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain_1.id
+                            )
+
+        # Create an account for domain_2
+        cls.account_2 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain_2.id
+                            )
+
+        cls._cleanup = [
+                        cls.account_1,
+                        cls.account_2,
+                        cls.service_offering,
+                        cls.domain_1,
+                        cls.domain_2,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_service_offering_hierarchy(self):
+        """Test to verify service offerings at same level in hierarchy"""
+
+        # Validate the following
+        # 1. Verify service offering is visible for domain_1
+        # 2. Verify service offering is also visible for domain_2
+
+        service_offerings = list_service_offering(
+                                                  self.apiclient,
+                                                  domainid=self.domain_1.id
+                                                  )
+        self.assertEqual(
+                            isinstance(service_offerings, list),
+                            True,
+                            "Check List Service Offerings for a valid response"
+                        )
+        self.assertNotEqual(
+                            len(service_offerings),
+                            0,
+                            "Check List Service Offerings response"
+                            )
+
+        for service_offering in service_offerings:
+            self.assertEqual(
+               service_offering.id,
+               self.service_offering.id,
+               "Check Service offering ID for domain" + str(self.domain_1.name)
+            )
+
+        # Verify private service offering is not visible to other domain
+        service_offerings = list_service_offering(
+                                                  self.apiclient,
+                                                  domainid=self.domain_2.id
+                                                  )
+        self.assertEqual(
+                            isinstance(service_offerings, list),
+                            True,
+                            "Check List Service Offerings for a valid response"
+                        )
+        self.assertNotEqual(
+                            len(service_offerings),
+                            0,
+                            "Check List Service Offerings response"
+                            )
+
+        for service_offering in service_offerings:
+            self.assertEqual(
+               service_offering.id,
+               self.service_offering.id,
+               "Check Service offering ID for domain" + str(self.domain_2.name)
+            )
+        return
+
+
+@unittest.skip("Open Questions")
+class TesttemplateHierarchy(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TesttemplateHierarchy,
+                               cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone settings
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["template"]["zoneid"] = cls.zone.id
+
+        # Create domains, accounts and template
+        cls.domain_1 = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+        cls.domain_2 = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"],
+                                   parentdomainid=cls.domain_1.id
+                                   )
+
+        # Create account for doamin_1
+        cls.account_1 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain_1.id
+                            )
+
+        # Create an account for domain_2
+        cls.account_2 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain_2.id
+                            )
+
+        cls.template = Template.register(
+                                            cls.api_client,
+                                            cls.services["template"],
+                                            account=cls.account_1.account.name,
+                                            domainid=cls.domain_1.id
+                                        )
+        cls._cleanup = [
+                        cls.template,
+                        cls.account_1,
+                        cls.account_2,
+                        cls.domain_1,
+                        cls.domain_2,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_template_hierarchy(self):
+        """Test to verify template at same level in hierarchy"""
+
+        # Validate the following
+        # 1. Verify template is visible for domain_1
+        # 2. Verify template is also visible for domain_2
+
+        # Sleep to ensure that template state is reflected across
+        time.sleep(self.services["sleep"])
+
+        templates = list_templates(
+                                    self.apiclient,
+                                    templatefilter='self',
+                                    account=self.account_1.account.name,
+                                    domainid=self.domain_1.id
+                                )
+        self.assertEqual(
+                            isinstance(templates, list),
+                            True,
+                            "Check List templates for a valid response"
+                        )
+        self.assertNotEqual(
+                            len(templates),
+                            0,
+                            "Check List Template response"
+                            )
+
+        for template in templates:
+            self.assertEqual(
+               template.id,
+               self.template.id,
+               "Check Template ID for domain" + str(self.domain_1.name)
+            )
+
+        # Verify private service offering is not visible to other domain
+        templates = list_templates(
+                                    self.apiclient,
+                                    templatefilter='self',
+                                    account=self.account_2.account.name,
+                                    domainid=self.domain_2.id
+                                )
+        self.assertEqual(
+                            isinstance(templates, list),
+                            True,
+                            "Check List templates for a valid response"
+                        )
+        self.assertNotEqual(
+                            len(templates),
+                            0,
+                            "Check List Service Offerings response"
+                            )
+
+        for template in templates:
+            self.assertEqual(
+               template.id,
+               self.template.id,
+               "Check Template ID for domain" + str(self.domain_2.name)
+            )
+        return
+
+
+class TestAddVmToSubDomain(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestAddVmToSubDomain,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Setup working Environment- Create domain, zone, pod cluster etc.
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+        cls.zone = get_zone(
+                               cls.api_client,
+                               cls.services,
+                               )
+        cls.sub_domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"],
+                                   parentdomainid=cls.domain.id
+                                   )
+
+        # Create account for doamin_1
+        cls.account_1 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        # Create an account for domain_2
+        cls.account_2 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.sub_domain.id
+                            )
+
+        cls.service_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offering"],
+                                    domainid=cls.domain.id
+                                    )
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=cls.template.id,
+                                    accountid=cls.account_1.account.name,
+                                    domainid=cls.account_1.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+
+        cls.vm_2 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=cls.template.id,
+                                    accountid=cls.account_2.account.name,
+                                    domainid=cls.account_2.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls._cleanup = [
+                        cls.account_2,
+                        cls.account_1,
+                        cls.sub_domain,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Clean up, terminate the created resources
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created resources
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_add_vm_to_subdomain(self):
+        """ Test Sub domain allowed to launch VM  when a Domain level zone is
+            created"""
+
+        # Validate the following
+        # 1. Verify VM created by Account_1 is in Running state
+        # 2. Verify VM created by Account_2 is in Running state
+
+        vm_response = list_virtual_machines(
+                                    self.apiclient,
+                                    id=self.vm_1.id
+                                )
+        self.assertEqual(
+                            isinstance(vm_response, list),
+                            True,
+                            "Check List VM for a valid response"
+                        )
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check List Template response"
+                            )
+
+        for vm in vm_response:
+            self.debug("VM ID: %s and state: %s" % (vm.id, vm.state))
+            self.assertEqual(
+                             vm.state,
+                             'Running',
+                             "Check State of Virtual machine"
+                             )
+
+        vm_response = list_virtual_machines(
+                                    self.apiclient,
+                                    id=self.vm_2.id
+                                )
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check List Template response"
+                            )
+
+        for vm in vm_response:
+            self.debug("VM ID: %s and state: %s" % (vm.id, vm.state))
+            self.assertEqual(
+                             vm.state,
+                             'Running',
+                             "Check State of Virtual machine"
+                             )
+        return
+
+
+class TestUserDetails(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUserDetails,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain etc
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=[
+                "role",
+                "accounts",
+                "simulator",
+                "advanced",
+                "advancedns",
+                "basic",
+                "eip",
+                "sg"
+                ])
+    def test_updateUserDetails(self):
+        """Test user update API
+        """
+
+        # Steps for test scenario
+        # 1. create a user account
+        # 2. update the user details (firstname, lastname, user) with
+        #    updateUser API
+        # 3. listUsers in the account
+        # 4. delete the account
+        # Validate the following
+        # 1. listAccounts should show account created successfully
+        # 2. updateUser API should return valid response
+        # 3. user should be updated with new details
+
+        self.debug("Creating an user account..")
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup.append(self.account)
+
+        # Fetching the user details of account
+        self.debug(
+                   "Fetching user details for account: %s" %
+                                            self.account.account.name)
+        users = User.list(
+                          self.apiclient,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid
+                          )
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "List users should return a valid list for account"
+                         )
+        user_1 = users[0]
+        self.debug("Updating the details of user: %s" % user_1.name)
+        firstname = random_gen()
+        lastname = random_gen()
+
+        self.debug("New firstname: %s, lastname: %s" % (firstname, lastname))
+        User.update(
+                    self.apiclient,
+                    user_1.id,
+                    firstname=firstname,
+                    lastname=lastname
+                    )
+
+        # Fetching the user details of account
+        self.debug(
+                   "Fetching user details for user: %s" % user_1.name)
+        users = User.list(
+                          self.apiclient,
+                          id=user_1.id,
+                          listall=True
+                          )
+
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "List users should return a valid list for account"
+                         )
+        user_1 = users[0]
+        self.assertEqual(
+                         user_1.firstname,
+                         firstname,
+                         "User's first name should be updated with new one"
+                         )
+        self.assertEqual(
+                         user_1.lastname,
+                         lastname,
+                         "User's last name should be updated with new one"
+                         )
+        return
+
+    @attr(tags=[
+                "role",
+                "accounts",
+                "simulator",
+                "advanced",
+                "advancedns",
+                "basic",
+                "eip",
+                "sg"
+                ])
+    def test_updateAdminDetails(self):
+        """Test update admin details
+        """
+
+        # Steps for test scenario
+        # 1. create a admin account
+        # 2. update the user details (firstname, lastname, user) with
+        #    updateUser API
+        # 3. listUsers in the account
+        # 4. delete the account
+        # Validate the following
+        # 1. listAccounts should show account created successfully
+        # 2. updateUser API should return valid response
+        # 3. user should be updated with new details
+
+        self.debug("Creating a ROOT admin account")
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     )
+        self.cleanup.append(self.account)
+
+        # Fetching the user details of account
+        self.debug(
+                   "Fetching user details for account: %s" %
+                                            self.account.account.name)
+        users = User.list(
+                          self.apiclient,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid
+                          )
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "List users should return a valid list for account"
+                         )
+        user_1 = users[0]
+        self.debug("Updating the details of user: %s" % user_1.name)
+        firstname = random_gen()
+        lastname = random_gen()
+
+        self.debug("New firstname: %s, lastname: %s" % (firstname, lastname))
+        User.update(
+                    self.apiclient,
+                    user_1.id,
+                    firstname=firstname,
+                    lastname=lastname
+                    )
+
+        # Fetching the user details of account
+        self.debug(
+                   "Fetching user details for user: %s" % user_1.name)
+        users = User.list(
+                          self.apiclient,
+                          id=user_1.id,
+                          listall=True
+                          )
+
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "List users should return a valid list for account"
+                         )
+        user_1 = users[0]
+        self.assertEqual(
+                         user_1.firstname,
+                         firstname,
+                         "User's first name should be updated with new one"
+                         )
+        self.assertEqual(
+                         user_1.lastname,
+                         lastname,
+                         "User's last name should be updated with new one"
+                         )
+        return
+
+    @attr(tags=[
+                "role",
+                "accounts",
+                "simulator",
+                "advanced",
+                "advancedns",
+                "basic",
+                "eip",
+                "sg"
+                ])
+    def test_updateDomainAdminDetails(self):
+        """Test update domain admin details
+        """
+
+        # Steps for test scenario
+        # 2. update the user details (firstname, lastname, user) with
+        #    updateUser API
+        # 3. listUsers in the account
+        # 4. delete the account
+        # Validate the following
+        # 1. listAccounts should show account created successfully
+        # 2. updateUser API should return valid response
+        # 3. user should be updated with new details
+
+        self.debug("Creating a domain admin account")
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup.append(self.account)
+
+        # Fetching the user details of account
+        self.debug(
+                   "Fetching user details for account: %s" %
+                                            self.account.account.name)
+        users = User.list(
+                          self.apiclient,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid
+                          )
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "List users should return a valid list for account"
+                         )
+        user_1 = users[0]
+        self.debug("Updating the details of user: %s" % user_1.name)
+        firstname = random_gen()
+        lastname = random_gen()
+
+        self.debug("New firstname: %s, lastname: %s" % (firstname, lastname))
+        User.update(
+                    self.apiclient,
+                    user_1.id,
+                    firstname=firstname,
+                    lastname=lastname
+                    )
+
+        # Fetching the user details of account
+        self.debug(
+                   "Fetching user details for user: %s" % user_1.name)
+        users = User.list(
+                          self.apiclient,
+                          id=user_1.id,
+                          listall=True
+                          )
+
+        self.assertEqual(
+                         isinstance(users, list),
+                         True,
+                         "List users should return a valid list for account"
+                         )
+        user_1 = users[0]
+        self.assertEqual(
+                         user_1.firstname,
+                         firstname,
+                         "User's first name should be updated with new one"
+                         )
+        self.assertEqual(
+                         user_1.lastname,
+                         lastname,
+                         "User's last name should be updated with new one"
+                         )
+        return
+
+@unittest.skip("Login API response returns nothing")
+class TestUserLogin(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUserLogin,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain etc
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["login", "accounts", "simulator", "advanced",
+                        "advancedns", "basic", "eip", "sg"])
+    def test_LoginApiUuidResponse(self):
+        """Test if Login API does not return UUID's
+        """
+
+        # Steps for test scenario
+        # 1. create a user account
+        # 2. login to the user account with given credentials (loginCmd)
+        # 3. delete the user account
+        # Validate the following
+        # 1. listAccounts should return account created
+        # 2. loginResponse should have UUID only is response. Assert by
+        #    checking database id is not same as response id
+        #    Login also succeeds with non NULL sessionId in response
+
+        self.debug("Creating an user account..")
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup.append(self.account)
+
+        self.debug("Logging into the cloudstack with login API")
+        respose = User.login(
+                             self.apiclient,
+                             username=self.account.account.name,
+                             password=self.services["account"]["password"]
+                             )
+        self.assertEqual(respose, None, "Login response should not be none")
+        self.debug("Login API response: %s" % respose)
+
+        self.assertNotEqual(
+                            respose.sessionkey,
+                            None,
+                            "Login to the CloudStack should be successful" +
+                            "response shall have non Null key"
+                            )
+        return
+
+    @attr(tags=["login", "accounts", "simulator", "advanced",
+                        "advancedns", "basic", "eip", "sg"])
+    def test_LoginApiDomain(self):
+        """Test login API with domain
+        """
+
+        # Steps for test scenario
+        # 1. create a domain
+        # 2. create user in the domain
+        # 3. login to the user account above using UUID domain/user
+        # 4. delete the user account
+        # Validate the following
+        # 1. listDomains returns created domain
+        # 2. listAccounts returns created user
+        # 3. loginResponse should have UUID only in responses
+        #    Login also succeeds with non NULL sessionId in response
+
+        self.debug("Creating a domain for login with API domain test")
+        domain = Domain.create(
+                                self.apiclient,
+                                self.services["domain"],
+                                parentdomainid=self.domain.id
+                                )
+        self.debug("Domain: %s is created succesfully." % domain.name)
+        self.debug(
+            "Checking if the created domain is listed in list domains API")
+        domains = Domain.list(self.apiclient, id=domain.id, listall=True)
+
+        self.assertEqual(
+                         isinstance(domains, list),
+                         True,
+                         "List domains shall return a valid response"
+                         )
+        self.debug("Creating an user account in domain: %s" % domain.name)
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=domain.id
+                                     )
+        self.cleanup.append(self.account)
+
+        accounts = Account.list(
+                                self.apiclient,
+                                name=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                listall=True
+                                )
+
+        self.assertEqual(
+                         isinstance(accounts, list),
+                         True,
+                         "List accounts should return a valid response"
+                         )
+
+        self.debug("Logging into the cloudstack with login API")
+        respose = User.login(
+                             self.apiclient,
+                             username=self.account.account.name,
+                             password=self.services["account"]["password"]
+                             )
+        self.assertEqual(respose, None, "Login response should not be none")
+        self.debug("Login API response: %s" % respose)
+
+        self.assertNotEqual(
+                            respose.sessionkey,
+                            None,
+                            "Login to the CloudStack should be successful" +
+                            "response shall have non Null key"
+                            )
+        return
+
+
+class TestDomainForceRemove(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDomainForceRemove,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Setup working Environment- Create domain, zone, pod cluster etc.
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+        cls.zone = get_zone(
+                               cls.api_client,
+                               cls.services,
+                               )
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Clean up, terminate the created resources
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created resources
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["domains", "advanced", "advancedns", "simulator"])
+    def test_forceDeleteDomain(self):
+        """ Test delete domain with force option"""
+
+        # Steps for validations
+        # 1. create a domain DOM
+        # 2. create 2 users under this domain
+        # 3. deploy 1 VM into each of these user accounts
+        # 4. create PF / FW rules for port 22 on these VMs for their
+        #    respective accounts
+        # 5. delete the domain with force=true option
+        # Validate the following
+        # 1. listDomains should list the created domain
+        # 2. listAccounts should list the created accounts
+        # 3. listvirtualmachines should show the Running VMs
+        # 4. PF and FW rules should be shown in listFirewallRules
+        # 5. domain should delete successfully and above three list calls
+        #    should show all the resources now deleted. listRouters should
+        #    not return any routers in the deleted accounts/domains
+
+        self.debug("Creating a domain for login with API domain test")
+        domain = Domain.create(
+                                self.apiclient,
+                                self.services["domain"],
+                                parentdomainid=self.domain.id
+                                )
+        self.debug("Domain is created succesfully.")
+        self.debug(
+            "Checking if the created domain is listed in list domains API")
+        domains = Domain.list(self.apiclient, id=domain.id, listall=True)
+
+        self.assertEqual(
+                         isinstance(domains, list),
+                         True,
+                         "List domains shall return a valid response"
+                         )
+        self.debug("Creating 2 user accounts in domain: %s" % domain.name)
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=domain.id
+                                     )
+
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=domain.id
+                                     )
+
+        self.debug("Creating a tiny service offering for VM deployment")
+        self.service_offering = ServiceOffering.create(
+                                    self.apiclient,
+                                    self.services["service_offering"],
+                                    domainid=self.domain.id
+                                    )
+
+        self.debug("Deploying virtual machine in account 1: %s" %
+                                                self.account_1.account.name)
+        vm_1 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        self.debug("Deploying virtual machine in account 2: %s" %
+                                                self.account_2.account.name)
+        vm_2 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account_2.account.name,
+                                    domainid=self.account_2.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        networks = Network.list(
+                                self.apiclient,
+                                account=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                listall=True
+                                )
+        self.assertEqual(
+                         isinstance(networks, list),
+                         True,
+                         "List networks should return a valid response"
+                         )
+        network_1 = networks[0]
+        self.debug("Default network in account 1: %s is %s" % (
+                                                self.account_1.account.name,
+                                                network_1.name))
+        src_nat_list = PublicIPAddress.list(
+                                    self.apiclient,
+                                    associatednetworkid=network_1.id,
+                                    account=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    listall=True,
+                                    issourcenat=True,
+                                    )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                                  self.apiclient,
+                                  vm_1,
+                                  self.services["natrule"],
+                                  ipaddressid=src_nat.id
+                           )
+        self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
+
+        nat_rules = NATRule.list(self.apiclient, id=nat_rule.id)
+
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT should return a valid port forwarding rules"
+                         )
+
+        self.assertNotEqual(
+                    len(nat_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+
+        self.debug("Deleting domain with force option")
+        try:
+            domain.delete(self.apiclient, cleanup=True)
+        except Exception as e:
+            self.fail("Failed to delete domain: %s" % e)
+
+        self.debug("Waiting for account.cleanup.interval" +
+                   " to cleanup any remaining resouces")
+
+        configurations = Configurations.list(
+                                            self.apiclient,
+                                            name="account.cleanup.interval",
+                                            listall=True
+                                            )
+        self.debug("account.cleanup.interval: %s" %
+                                            int(configurations[0].value))
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(configurations[0].value) * 2)
+        self.debug("Checking if the resources in domain are deleted or not..")
+        accounts = Account.list(
+                                self.apiclient,
+                                name=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                listall=True
+                                )
+
+        self.assertEqual(
+            accounts,
+            None,
+            "Account should get automatically deleted after domain removal"
+            )
+        return
+
+    @attr(tags=["domains", "advanced", "advancedns", "simulator"])
+    def test_DeleteDomain(self):
+        """ Test delete domain with force option"""
+
+        # Steps for validations
+        # 1. create a domain DOM
+        # 2. create 2 users under this domain
+        # 3. deploy 1 VM into each of these user accounts
+        # 4. create PF / FW rules for port 22 on these VMs for their
+        #    respective accounts
+        # 5. delete the domain with force=false option
+        # Validate the following
+        # 1. listDomains should list the created domain
+        # 2. listAccounts should list the created accounts
+        # 3. listvirtualmachines should show the Running VMs
+        # 4. PF and FW rules should be shown in listFirewallRules
+        # 5. domain deletion should fail saying there are resources under use
+
+        self.debug("Creating a domain for login with API domain test")
+        domain = Domain.create(
+                                self.apiclient,
+                                self.services["domain"],
+                                parentdomainid=self.domain.id
+                                )
+        self._cleanup.append(domain)
+        self.debug("Domain: %s is created successfully." % domain.name)
+        self.debug(
+            "Checking if the created domain is listed in list domains API")
+        domains = Domain.list(self.apiclient, id=domain.id, listall=True)
+
+        self.assertEqual(
+                         isinstance(domains, list),
+                         True,
+                         "List domains shall return a valid response"
+                         )
+        self.debug("Creating 2 user accounts in domain: %s" % domain.name)
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=domain.id
+                                     )
+        self.cleanup.append(self.account_1)
+
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     domainid=domain.id
+                                     )
+        self.cleanup.append(self.account_2)
+
+        self.debug("Creating a tiny service offering for VM deployment")
+        self.service_offering = ServiceOffering.create(
+                                    self.apiclient,
+                                    self.services["service_offering"],
+                                    domainid=self.domain.id
+                                    )
+        self.cleanup.append(self.service_offering)
+
+        self.debug("Deploying virtual machine in account 1: %s" %
+                                                self.account_1.account.name)
+        vm_1 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        self.debug("Deploying virtual machine in account 2: %s" %
+                                                self.account_2.account.name)
+        vm_2 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account_2.account.name,
+                                    domainid=self.account_2.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        networks = Network.list(
+                                self.apiclient,
+                                account=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                listall=True
+                                )
+        self.assertEqual(
+                         isinstance(networks, list),
+                         True,
+                         "List networks should return a valid response"
+                         )
+        network_1 = networks[0]
+        self.debug("Default network in account 1: %s is %s" % (
+                                                self.account_1.account.name,
+                                                network_1.name))
+        src_nat_list = PublicIPAddress.list(
+                                    self.apiclient,
+                                    associatednetworkid=network_1.id,
+                                    account=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    listall=True,
+                                    issourcenat=True,
+                                    )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                                  self.apiclient,
+                                  vm_1,
+                                  self.services["natrule"],
+                                  ipaddressid=src_nat.id
+                           )
+        self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
+
+        nat_rules = NATRule.list(self.apiclient, id=nat_rule.id)
+
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT should return a valid port forwarding rules"
+                         )
+
+        self.assertNotEqual(
+                    len(nat_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+
+        self.debug("Deleting domain without force option")
+        with self.assertRaises(Exception):
+            domain.delete(self.apiclient, cleanup=False)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_allocation_states.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_allocation_states.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_allocation_states.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_allocation_states.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,274 @@
+# -*- encoding: utf-8 -*-
+# 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
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+import datetime
+
+
+class Services:
+    """Test Resource Limits Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                                   },
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                   "diskname": "TestDiskServ",
+                        },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                        },
+                        "template": {
+                                    "displaytext": "Cent OS Template",
+                                    "name": "Cent OS Template",
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                        },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced',
+                    }
+
+
+class TestAllocationState(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestResources,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_01_zones(self):
+        """Check the status of zones"""
+
+        # Validate the following
+        # 1. List zones
+        # 2. Check allocation state is "enabled" or not
+
+        zones = Zone.list(
+                          self.apiclient,
+                          id=self.zone.id,
+              listall=True
+                          )
+        self.assertEqual(
+                         isinstance(zones, list),
+                         True,
+                         "Check if listZones returns a valid response"
+                         )
+        for zone in zones:
+            self.assertEqual(
+                             zone.allocationstate,
+                             'Enabled',
+                             "Zone allocation state should be enabled"
+                             )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_02_pods(self):
+        """Check the status of pods"""
+
+        # Validate the following
+        # 1. List pods
+        # 2. Check allocation state is "enabled" or not
+
+        pods = Pod.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+              listall=True
+                          )
+        self.assertEqual(
+                         isinstance(pods, list),
+                         True,
+                         "Check if listPods returns a valid response"
+                         )
+        for pod in pods:
+            self.assertEqual(
+                             pod.allocationstate,
+                             'Enabled',
+                             "Pods allocation state should be enabled"
+                             )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_03_clusters(self):
+        """Check the status of clusters"""
+
+        # Validate the following
+        # 1. List clusters
+        # 2. Check allocation state is "enabled" or not
+
+        clusters = Cluster.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+              listall=True
+                          )
+        self.assertEqual(
+                         isinstance(clusters, list),
+                         True,
+                         "Check if listClusters returns a valid response"
+                         )
+        for cluster in clusters:
+            self.assertEqual(
+                             cluster.allocationstate,
+                             'Enabled',
+                             "Clusters allocation state should be enabled"
+                             )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_04_hosts(self):
+        """Check the status of hosts"""
+
+        # Validate the following
+        # 1. List hosts with type=Routing
+        # 2. Check state is "Up" or not
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          type='Routing',
+              listall=True
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "Check if listHosts returns a valid response"
+                         )
+        for host in hosts:
+            self.assertEqual(
+                             host.state,
+                             'Up',
+                             "Host should be in Up state and running"
+                             )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_05_storage_pools(self):
+        """Check the status of Storage pools"""
+
+        # Validate the following
+        # 1. List storage pools for the zone
+        # 2. Check state is "enabled" or not
+
+        storage_pools = StoragePool.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+              listall=True
+                          )
+        self.assertEqual(
+                         isinstance(storage_pools, list),
+                         True,
+                         "Check if listStoragePools returns a valid response"
+                         )
+        for storage_pool in storage_pools:
+            self.assertEqual(
+                             storage_pool.state,
+                             'Up',
+                             "storage pool should be in Up state and running"
+                             )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_06_secondary_storage(self):
+        """Check the status of secondary storage"""
+
+        # Validate the following
+        # 1. List secondary storage
+        # 2. Check state is "Up" or not
+
+        sec_storages = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          type='SecondaryStorageVM',
+              listall=True
+                          )
+        self.assertEqual(
+                         isinstance(sec_storages, list),
+                         True,
+                         "Check if listHosts returns a valid response"
+                         )
+        for sec_storage in sec_storages:
+            self.assertEqual(
+                             sec_storage.state,
+                             'Up',
+                             "Secondary storage should be in Up state"
+                             )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_blocker_bugs.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_blocker_bugs.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_blocker_bugs.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_blocker_bugs.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1296 @@
+# 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.
+""" Tests for Blocker bugs
+"""
+import marvin
+from nose.plugins.attrib import attr
+from integration.lib.base import *
+from integration.lib.utils import *
+from integration.lib.common import *
+
+#Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+
+
+class Services:
+    """Test Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "domain": {
+                                   "name": "Domain",
+                        },
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                        },
+                        "volume": {
+                                   "diskname": "APP Data Volume",
+                                   "size": 1,   # in GBs
+                                   "diskdevice": "/dev/xvdb",   # Data Disk
+                        },
+                        "templates": {
+                                    "displaytext": 'Template from snapshot',
+                                    "name": 'Template from snapshot',
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                                    "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                                    "hypervisor": 'XenServer',
+                                    "format": 'VHD',
+                                    "isfeatured": True,
+                                    "ispublic": True,
+                                    "isextractable": True,
+                                    "passwordenabled": True,
+                        },
+                        "paths": {
+                                    "mount_dir": "/mnt/tmp",
+                                    "sub_dir": "test",
+                                    "sub_lvl_dir1": "test1",
+                                    "sub_lvl_dir2": "test2",
+                                    "random_data": "random.data",
+                        },
+                        "static_nat": {
+                                    "startport": 22,
+                                    "endport": 22,
+                                    "protocol": "TCP"
+                        },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "mode": 'advanced',
+                        # Networking mode, Advanced, Basic
+                     }
+
+
+class TestSnapshots(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshots, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = cls.template.id
+        cls.services["zoneid"] = cls.zone.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["virtual_machine"],
+                                templateid=cls.template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_volume_from_snapshot(self):
+        """TS_BUG_001-Test Creating snapshot from volume having spaces in name(KVM)
+        """
+
+
+        # Validate the following
+        #1. Create a virtual machine and data volume
+        #2. Attach data volume to VM
+        #3. Login to machine; create temp/test directories on data volume
+        #4. Snapshot the Volume
+        #5. Create another Volume from snapshot
+        #6. Mount/Attach volume to another server
+        #7. Compare data
+
+        random_data_0 = random_gen(100)
+        random_data_1 = random_gen(100)
+
+        volume = Volume.create(
+                               self.apiclient,
+                               self.services["volume"],
+                               zoneid=self.zone.id,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               diskofferingid=self.disk_offering.id
+                               )
+        self.debug("Created volume with ID: %s" % volume.id)
+        self.virtual_machine.attach_volume(
+                                           self.apiclient,
+                                           volume
+                                           )
+        self.debug("Attach volume: %s to VM: %s" %
+                                (volume.id, self.virtual_machine.id))
+        try:
+            ssh_client = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH failed for VM: %s" %
+                      self.virtual_machine.ipaddress)
+
+        self.debug("Formatting volume: %s to ext3" % volume.id)
+        #Format partition using ext3
+        format_volume_to_ext3(
+                              ssh_client,
+                              self.services["volume"]["diskdevice"]
+                              )
+        cmds = [
+                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["volume"]["diskdevice"],
+                                      self.services["paths"]["mount_dir"]
+                                      ),
+                    "mkdir -p %s/%s/{%s,%s} " % (
+                                    self.services["paths"]["mount_dir"],
+                                    self.services["paths"]["sub_dir"],
+                                    self.services["paths"]["sub_lvl_dir1"],
+                                    self.services["paths"]["sub_lvl_dir2"]
+                                    ),
+                    "echo %s > %s/%s/%s/%s" % (
+                                    random_data_0,
+                                    self.services["paths"]["mount_dir"],
+                                    self.services["paths"]["sub_dir"],
+                                    self.services["paths"]["sub_lvl_dir1"],
+                                    self.services["paths"]["random_data"]
+                                    ),
+                    "echo %s > %s/%s/%s/%s" % (
+                                    random_data_1,
+                                    self.services["paths"]["mount_dir"],
+                                    self.services["paths"]["sub_dir"],
+                                    self.services["paths"]["sub_lvl_dir2"],
+                                    self.services["paths"]["random_data"]
+                                    ),
+                ]
+        for c in cmds:
+            self.debug("Command: %s" % c)
+            ssh_client.execute(c)
+
+        # Unmount the Sec Storage
+        cmds = [
+                    "umount %s" % (self.services["paths"]["mount_dir"]),
+                ]
+        for c in cmds:
+            self.debug("Command: %s" % c)
+            ssh_client.execute(c)
+
+        list_volume_response = Volume.list(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+
+        self.assertEqual(
+                         isinstance(list_volume_response, list),
+                         True,
+                         "Check list volume response for valid data"
+                         )
+        volume_response = list_volume_response[0]
+        #Create snapshot from attached volume
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volume_response.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.debug("Created snapshot: %s" % snapshot.id)
+        #Create volume from snapshot
+        volume_from_snapshot = Volume.create_from_snapshot(
+                                        self.apiclient,
+                                        snapshot.id,
+                                        self.services["volume"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.debug("Created Volume: %s from Snapshot: %s" % (
+                                            volume_from_snapshot.id,
+                                            snapshot.id))
+        volumes = Volume.list(
+                                self.apiclient,
+                                id=volume_from_snapshot.id
+                                )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(volumes),
+                            None,
+                            "Check Volume list Length"
+                      )
+        self.assertEqual(
+                        volumes[0].id,
+                        volume_from_snapshot.id,
+                        "Check Volume in the List Volumes"
+                    )
+        #Attaching volume to new VM
+        new_virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    mode=self.services["mode"]
+                                )
+        self.debug("Deployed new VM for account: %s" % self.account.account.name)
+        self.cleanup.append(new_virtual_machine)
+
+        self.debug("Attaching volume: %s to VM: %s" % (
+                                            volume_from_snapshot.id,
+                                            new_virtual_machine.id
+                                            ))
+
+        cmd = attachVolume.attachVolumeCmd()
+        cmd.id = volume_from_snapshot.id
+        cmd.virtualmachineid = new_virtual_machine.id
+        self.apiclient.attachVolume(cmd)
+
+        try:
+            #Login to VM to verify test directories and files
+            ssh = new_virtual_machine.get_ssh_client()
+
+            cmds = [
+                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["volume"]["diskdevice"],
+                                      self.services["paths"]["mount_dir"]
+                                      ),
+               ]
+
+            for c in cmds:
+                self.debug("Command: %s" % c)
+                ssh.execute(c)
+
+            returned_data_0 = ssh.execute(
+                            "cat %s/%s/%s/%s" % (
+                                    self.services["paths"]["mount_dir"],
+                                    self.services["paths"]["sub_dir"],
+                                    self.services["paths"]["sub_lvl_dir1"],
+                                    self.services["paths"]["random_data"]
+                            ))
+            returned_data_1 = ssh.execute(
+                            "cat %s/%s/%s/%s" % (
+                                    self.services["paths"]["mount_dir"],
+                                    self.services["paths"]["sub_dir"],
+                                    self.services["paths"]["sub_lvl_dir2"],
+                                    self.services["paths"]["random_data"]
+                            ))
+        except Exception as e:
+            self.fail("SSH access failed for VM: %s" %
+                                new_virtual_machine.ipaddress)
+        #Verify returned data
+        self.assertEqual(
+                random_data_0,
+                returned_data_0[0],
+                "Verify newly attached volume contents with existing one"
+                )
+        self.assertEqual(
+                random_data_1,
+                returned_data_1[0],
+                "Verify newly attached volume contents with existing one"
+                )
+        # Unmount the Sec Storage
+        cmds = [
+                    "umount %s" % (self.services["paths"]["mount_dir"]),
+                ]
+        for c in cmds:
+            self.debug("Command: %s" % c)
+            ssh_client.execute(c)
+        return
+
+
+class TestTemplate(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestTemplate, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["templates"]["zoneid"] = cls.zone.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestTemplate, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "advancedns", "basic", "sg"])
+    def test_01_create_template(self):
+        """TS_BUG_002-Test to create and deploy VM using password enabled template
+        """
+
+
+        # Validate the following:
+        #1. Create a password enabled template
+        #2. Deploy VM using this template
+        #3. Deploy VM should return password set in template.
+
+        self.debug("Registering a new template")
+        # Register new template
+        template = Template.register(
+                                    self.apiclient,
+                                    self.services["templates"],
+                                    zoneid=self.zone.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.debug("Registering template with ID: %s" % template.id)
+        try:
+            # Wait for template to download
+            template.download(self.apiclient)
+        except Exception as e:
+            self.fail("Exception while downloading template %s: %s"\
+                      % (template.id, e))
+
+        self.cleanup.append(template)
+
+        # Wait for template status to be changed across
+        time.sleep(self.services["sleep"])
+
+        list_template_response = Template.list(
+                                            self.apiclient,
+                                            templatefilter=\
+                                            self.services["templates"]["templatefilter"],
+                                            id=template.id,
+                                            zoneid=self.zone.id
+                                            )
+
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #Verify template response to check whether template added successfully
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+        template_response = list_template_response[0]
+
+        self.assertEqual(
+                            template_response.isready,
+                            True,
+                            "Check display text of newly created template"
+                        )
+
+        # Deploy new virtual machine using template
+        virtual_machine = VirtualMachine.create(
+                                 self.apiclient,
+                                 self.services["virtual_machine"],
+                                 templateid=template.id,
+                                 accountid=self.account.account.name,
+                                 domainid=self.account.account.domainid,
+                                 serviceofferingid=self.service_offering.id,
+                                 )
+        self.debug("Deployed VM with ID: %s " % virtual_machine.id)
+        self.assertEqual(
+                         hasattr(virtual_machine, "password"),
+                         True,
+                         "Check if the deployed VM returned a password"
+                        )
+        return
+
+
+class TestNATRules(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestNATRules, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                admin=True,
+                                domainid=cls.domain.id
+                                )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                cls.api_client,
+                                cls.services["service_offering"]
+                                )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                )
+        cls.public_ip = PublicIPAddress.create(
+                                    cls.api_client,
+                                    accountid=cls.account.account.name,
+                                    zoneid=cls.zone.id,
+                                    domainid=cls.account.account.domainid,
+                                    services=cls.services["virtual_machine"]
+                                    )
+        cls._cleanup = [
+                        cls.virtual_machine,
+                        cls.account,
+                        cls.service_offering
+                        ]
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestNATRules, cls).getClsTestClient().getApiClient()
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @attr(tags = ["advanced"])
+    def test_01_firewall_rules_port_fw(self):
+        """"Checking firewall rules deletion after static NAT disable"""
+
+
+        # Validate the following:
+        #1. Enable static NAT for a VM
+        #2. Open up some ports. At this point there will be new rows in the
+        #   firewall_rules table.
+        #3. Disable static NAT for the VM.
+        #4. Check fire wall rules are deleted from firewall_rules table.
+
+        public_ip = self.public_ip.ipaddress
+
+        # Enable Static NAT for VM
+        StaticNATRule.enable(
+                             self.apiclient,
+                             public_ip.id,
+                             self.virtual_machine.id
+                            )
+        self.debug("Enabled static NAT for public IP ID: %s" %
+                                                    public_ip.id)
+        #Create Static NAT rule
+        nat_rule = StaticNATRule.create(
+                        self.apiclient,
+                        self.services["static_nat"],
+                        public_ip.id
+                        )
+        self.debug("Created Static NAT rule for public IP ID: %s" %
+                                                    public_ip.id)
+        list_rules_repsonse = StaticNATRule.list(
+                                                 self.apiclient,
+                                                 id=nat_rule.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_rules_repsonse, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_rules_repsonse),
+                            0,
+                            "Check IP Forwarding Rule is created"
+                            )
+        self.assertEqual(
+                            list_rules_repsonse[0].id,
+                            nat_rule.id,
+                            "Check Correct IP forwarding Rule is returned"
+                        )
+        # Verify the entries made in firewall_rules tables
+        self.debug(
+                   "select id from user_ip_address where uuid = '%s';" \
+                    % public_ip.id
+                  )
+        qresultset = self.dbclient.execute(
+                        "select id from user_ip_address where uuid = '%s';" \
+                        % public_ip.id
+                        )
+        self.assertEqual(
+                            isinstance(qresultset, list),
+                            True,
+                            "Check database query returns a valid data"
+                        )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+        public_ip_id = qresult[0]
+        # Verify the entries made in firewall_rules tables
+        self.debug(
+                   "select id, state from firewall_rules where ip_address_id = '%s';" \
+                    % public_ip_id
+                  )
+        qresultset = self.dbclient.execute(
+                        "select id, state from firewall_rules where ip_address_id = '%s';" \
+                        % public_ip_id
+                        )
+        self.assertEqual(
+                            isinstance(qresultset, list),
+                            True,
+                            "Check database query returns a valid data for firewall rules"
+                        )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        for qresult in qresultset:
+            self.assertEqual(
+                            qresult[1],
+                            'Active',
+                            "Check state of the static NAT rule in database"
+                            )
+
+        nat_rule.delete(self.apiclient)
+
+        list_rules_repsonse = StaticNATRule.list(
+                                                    self.apiclient,
+                                                    id=nat_rule.id
+                                                    )
+
+        self.assertEqual(
+                            list_rules_repsonse,
+                            None,
+                            "Check Port Forwarding Rule is deleted"
+                            )
+
+        # Verify the entries made in firewall_rules tables
+        self.debug(
+                   "select id, state from firewall_rules where ip_address_id = '%s';" \
+                    % public_ip.id
+                  )
+        qresultset = self.dbclient.execute(
+                        "select id, state from firewall_rules where ip_address_id = '%s';" \
+                        % public_ip.id
+                        )
+
+        self.assertEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        return
+
+
+class TestRouters(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestRouters, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        # Create an account, domain etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"],
+                                   )
+        cls.admin_account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user_account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.admin_account,
+                        cls.user_account,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, users etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_list_routers_admin(self):
+        """TS_BUG_007-Check listRouters() using Admin User
+        """
+
+
+        # Validate the following
+        # 1. PreReq: have rounters that are owned by other account
+        # 2. Create domain and create accounts in that domain
+        # 3. Create one VM for each account
+        # 4. Using Admin , run listRouters. It should return all the routers
+
+        vm_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.admin_account.account.name,
+                                  domainid=self.admin_account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        self.debug("Deployed VM with ID: %s" % vm_1.id)
+        vm_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.user_account.account.name,
+                                  domainid=self.user_account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        self.debug("Deployed VM with ID: %s" % vm_2.id)
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.admin_account.account.name,
+                               domainid=self.admin_account.account.domainid,
+                               )
+        self.assertEqual(
+                            isinstance(routers, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        # ListRouter Should return 2 records
+        self.assertEqual(
+                             len(routers),
+                             1,
+                             "Check list router response"
+                             )
+        for router in routers:
+            self.assertEqual(
+                        router.state,
+                        'Running',
+                        "Check list router response for router state"
+                    )
+        return
+
+
+class TestRouterRestart(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestRouterRestart, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     domainid=cls.domain.id
+                                     )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.cleanup = [
+                       cls.vm_1,
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestRouterRestart, cls).getClsTestClient().getApiClient()
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "advancedns", "eip"])
+    def test_01_restart_network_cleanup(self):
+        """TS_BUG_008-Test restart network
+        """
+
+
+        # Validate the following
+        # 1. When cleanup = true, router is destroyed and a new one created
+        # 2. New router will have new publicIp and linkLocalIp and
+        #    all it's services should resume
+
+        # Find router associated with user account
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        #Store old values before restart
+        old_linklocalip = router.linklocalip
+
+        timeout = 10
+        # Network should be in Implemented or Setup stage before restart
+        while True:
+            networks = Network.list(
+                                 self.apiclient,
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+            network = networks[0]
+            if network.state in ["Implemented", "Setup"]:
+                break
+            elif timeout == 0:
+                break
+            else:
+                time.sleep(60)
+                timeout = timeout - 1
+
+        self.debug("Restarting network: %s" % network.id)
+        cmd = restartNetwork.restartNetworkCmd()
+        cmd.id = network.id
+        cmd.cleanup = True
+        self.apiclient.restartNetwork(cmd)
+
+        # Get router details after restart
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        self.assertNotEqual(
+                            router.linklocalip,
+                            old_linklocalip,
+                            "Check link-local IP after restart"
+                        )
+        return
+
+
+class TestTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.services = Services().services
+        cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, templates etc
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                        )
+
+        # create virtual machine
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    )
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        #Wait before server has be successfully stopped
+        time.sleep(30)
+        list_volume = Volume.list(
+                                   cls.api_client,
+                                   virtualmachineid=cls.virtual_machine.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+        try:
+            if isinstance(list_volume, list):
+                cls.volume = list_volume[0]
+        except Exception as e:
+            raise Exception("Warning: Exception during setup : %s" % e)
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+            #Cleanup created resources such as templates and VMs
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "basic", "sg", "eip"])
+    def test_01_check_template_size(self):
+        """TS_BUG_009-Test the size of template created from root disk
+        """
+
+
+        # Validate the following:
+        # 1. Deploy new VM using the template created from Volume
+        # 2. VM should be in Up and Running state
+
+        #Create template from volume
+        template = Template.create(
+                                   self.apiclient,
+                                   self.services["templates"],
+                                   self.volume.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                )
+        self.debug("Creating template with ID: %s" % template.id)
+        # Volume and Template Size should be same
+        self.assertEqual(
+                             template.size,
+                             self.volume.size,
+                             "Check if size of template and volume are same"
+                             )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "basic", "sg", "eip"])
+    def test_02_check_size_snapshotTemplate(self):
+        """TS_BUG_010-Test check size of snapshot and template
+        """
+
+
+        # Validate the following
+        # 1. Deploy VM using default template, small service offering
+        #    and small data disk offering.
+        # 2. Perform snapshot on the root disk of this VM.
+        # 3. Create a template from snapshot.
+        # 4. Check the size of snapshot and template
+
+        # Create a snapshot from the ROOTDISK
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   self.volume.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.debug("Created snapshot with ID: %s" % snapshot.id)
+        snapshots = Snapshot.list(
+                                   self.apiclient,
+                                   id=snapshot.id
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Generate template from the snapshot
+        template = Template.create_from_snapshot(
+                                    self.apiclient,
+                                    snapshot,
+                                    self.services["templates"]
+                                    )
+        self.cleanup.append(template)
+
+        self.debug("Created template from snapshot with ID: %s" % template.id)
+        templates = Template.list(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+        self.assertEqual(
+                            isinstance(templates, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            templates,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                            templates[0].isready,
+                            True,
+                            "Check new template state in list templates call"
+                        )
+        # check size of template with that of snapshot
+        self.assertEqual(
+                            templates[0].size,
+                            self.volume.size,
+                            "Check if size of snapshot and template matches"
+                        )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "basic", "sg", "eip"])
+    def test_03_resuse_template_name(self):
+        """TS_BUG_011-Test Reusing deleted template name
+        """
+
+
+        # Validate the following
+        # 1. Deploy VM using default template, small service offering
+        #    and small data disk offering.
+        # 2. Perform snapshot on the root disk of this VM.
+        # 3. Create a template from snapshot.
+        # 4. Delete the template and create a new template with same name
+        # 5. Template should be created succesfully
+
+        # Create a snapshot from the ROOTDISK
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   self.volume.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.debug("Created snapshot with ID: %s" % snapshot.id)
+        snapshots = Snapshot.list(
+                                   self.apiclient,
+                                   id=snapshot.id
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Generate template from the snapshot
+        template = Template.create_from_snapshot(
+                                    self.apiclient,
+                                    snapshot,
+                                    self.services["templates"],
+                                    random_name=False
+                                    )
+        self.debug("Created template from snapshot: %s" % template.id)
+        templates = Template.list(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+        self.assertEqual(
+                            isinstance(templates, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            templates,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                            templates[0].isready,
+                            True,
+                            "Check new template state in list templates call"
+                        )
+
+        self.debug("Deleting template: %s" % template.id)
+        template.delete(self.apiclient)
+
+        # Wait for some time to ensure template state is reflected in other calls
+        time.sleep(self.services["sleep"])
+
+        # Generate template from the snapshot
+        self.debug("Creating template from snapshot: %s with same name" %
+                                                                template.id)
+        template = Template.create_from_snapshot(
+                                    self.apiclient,
+                                    snapshot,
+                                    self.services["templates"],
+                                    random_name=False
+                                    )
+
+        templates = Template.list(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+        self.assertEqual(
+                            isinstance(templates, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            templates,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                            templates[0].name,
+                            self.services["templates"]["name"],
+                            "Check the name of the template"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_egress_rules.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_egress_rules.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_egress_rules.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_egress_rules.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2362 @@
+# 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.
+
+""" P1 for Egresss & Ingress rules
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+
+#Import System modules
+import time
+import subprocess
+
+
+class Services:
+    """Test Security groups Services
+    """
+
+    def __init__(self):
+        self.services = {
+                "disk_offering": {
+                    "displaytext": "Small",
+                    "name": "Small",
+                    "disksize": 1
+                },
+                "account": {
+                    "email": "test@test.com",
+                    "firstname": "Test",
+                    "lastname": "User",
+                    "username": "test",
+                    # Random characters are appended in create account to
+                    # ensure unique username generated each time
+                    "password": "password",
+                },
+                "virtual_machine": {
+                # Create a small virtual machine instance with disk offering
+                    "displayname": "Test VM",
+                    "username": "root",     # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                    "userdata": 'This is sample data',
+                },
+                "service_offering": {
+                    "name": "Tiny Instance",
+                    "displaytext": "Tiny Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,    # in MHz
+                    "memory": 64,       # In MBs
+                },
+                "security_group": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '0.0.0.0/0',
+                },
+                "sg_invalid_port": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": -22,
+                    "endport": -22,
+                    "cidrlist": '0.0.0.0/0',
+                },
+                "sg_invalid_cidr": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '0.0.0.10'
+                },
+                "sg_cidr_anywhere": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '0.0.0.0/0'
+                },
+                "sg_cidr_restricted": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '10.0.0.1/24',
+                },
+                "sg_account": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '0.0.0.0/0'
+                },
+                "mgmt_server": {
+                    "username": "root",
+                    "password": "password",
+                    "ipaddress": "192.168.100.21"
+                },
+            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            # CentOS 5.3 (64-bit)
+            "sleep": 60,
+            "timeout": 10,
+            "mode": 'basic',
+            # Networking mode: Basic or Advanced
+        }
+
+
+class TestDefaultSecurityGroupEgress(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestDefaultSecurityGroupEgress,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_deployVM_InDefaultSecurityGroup(self):
+        """Test deploy VM in default security group with no egress rules
+        """
+
+
+        # Validate the following:
+        # 1. Deploy a VM.
+        # 2. Deployed VM should be running, verify with listVirtualMachiens
+        # 3. listSecurityGroups for this account. should list the default
+        #    security group with no egress rules
+        # 4. listVirtualMachines should show that the VM belongs to default
+        #    security group
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                )
+        self.debug("Deployed VM with ID: %s" % self.virtual_machine.id)
+        self.cleanup.append(self.virtual_machine)
+
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check for list VM response"
+                         )
+        vm_response = list_vm_response[0]
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM available in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+
+                            vm_response.id,
+                            self.virtual_machine.id,
+                            "Check virtual machine id in listVirtualMachines"
+                        )
+
+        self.assertEqual(
+                    vm_response.state,
+                    'Running',
+                    "VM state should be running"
+                    )
+        self.assertEqual(
+                    hasattr(vm_response, "securitygroup"),
+                    True,
+                    "List VM response should have atleast one security group"
+                    )
+
+        # Verify listSecurity groups response
+        security_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(security_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(security_groups),
+                            1,
+                            "Check List Security groups response"
+                            )
+        self.debug("List Security groups response: %s" %
+                                            str(security_groups))
+        sec_grp = security_groups[0]
+        self.assertEqual(
+                        sec_grp.name,
+                        'default',
+                        "List Sec Group should only list default sec. group"
+                        )
+        return
+
+
+class TestAuthorizeIngressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestAuthorizeIngressRule,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_authorizeIngressRule(self):
+        """Test authorize ingress rule
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. deployVirtualMachine into this security group (ssh). deployed VM
+        #    should be Running
+        # 5. listSecurityGroups should show two groups, default and ssh
+        # 6. verify that ssh-access into the VM is now allowed
+        # 7. verify from within the VM is able to ping outside world
+        #    (ping www.google.com)
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                self.apiclient,
+                                self.services["security_group"],
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        self.debug("Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+            ssh = self.virtual_machine.get_ssh_client()
+
+            # Ping to outsite world
+            res = ssh.execute("ping -c 1 www.google.com")
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        result = str(res)
+        self.assertEqual(
+                         result.count("1 received"),
+                         1,
+                         "Ping to outside world from VM should be successful"
+                         )
+        return
+
+
+class TestDefaultGroupEgress(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestDefaultGroupEgress,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_default_group_with_egress(self):
+        """Test default group with egress rule before VM deploy and ping, ssh
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    CIDR: 0.0.0.0/0
+        # 5. deployVirtualMachine into this security group (ssh)
+        # 6. deployed VM should be Running, ssh should be allowed into the VM,
+        #    ping out to google.com from the VM should fail,
+        #    ssh from within VM to mgt server should pass
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug("Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        # Authorize Security group to SSH to VM
+        self.debug("Authorizing egress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+
+            ssh = self.virtual_machine.get_ssh_client()
+
+            self.debug("Ping to google.com from VM")
+            # Ping to outsite world
+            res = ssh.execute("ping -c 1 www.google.com")
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        result = str(res)
+        self.assertEqual(
+                         result.count("0 received"),
+                         1,
+                         "Ping to outside world from VM should be successful"
+                         )
+
+        try:
+            self.debug("SSHing into management server from VM")
+            res = ssh.execute("ssh %s@%s" % (
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["ipaddress"]
+                                 ))
+            self.debug("SSH result: %s" % str(res))
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        result = str(res)
+        self.assertNotEqual(
+                    result.count("No route to host"),
+                    1,
+                    "SSH into management server from VM should be successful"
+                    )
+        return
+
+
+class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestDefaultGroupEgressAfterDeploy,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_default_group_with_egress(self):
+        """ Test default group with egress rule added after vm deploy and ping,
+            ssh test
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. deployVirtualMachine into this security group (ssh)
+        # 5. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    CIDR: 0.0.0.0/0
+        # 6. deployed VM should be Running, ssh should be allowed into the VM,
+        #    ping out to google.com from the VM should fail
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug("Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+            ssh = self.virtual_machine.get_ssh_client()
+
+            self.debug("Ping to google.com from VM")
+            # Ping to outsite world
+            res = ssh.execute("ping -c 1 www.google.com")
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+            self.debug("SSH result: %s" % str(res))
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        result = str(res)
+        self.assertEqual(
+                         result.count("0 received"),
+                         1,
+                         "Ping to outside world from VM should be successful"
+                         )
+        return
+
+
+class TestRevokeEgressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestRevokeEgressRule,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_revoke_egress_rule(self):
+        """Test revoke security group egress rule
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    CIDR: 0.0.0.0/0
+        # 5. deployVirtualMachine into this security group (ssh)
+        # 6. deployed VM should be Running, ssh should be allowed into the VM,
+        #    ping out to google.com from the VM should fail,
+        #    ssh from within VM to mgt server should pass
+        # 7. Revoke egress rule. Verify ping and SSH access to management server
+        #    is restored
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+            ssh = self.virtual_machine.get_ssh_client()
+
+            self.debug("Ping to google.com from VM")
+            # Ping to outsite world
+            res = ssh.execute("ping -c 1 www.google.com")
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+            self.debug("SSH result: %s" % str(res))
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        result = str(res)
+        self.assertEqual(
+                         result.count("0 received"),
+                         1,
+                         "Ping to outside world from VM should be successful"
+                         )
+
+        try:
+            self.debug("SSHing into management server from VM")
+            res = ssh.execute("ssh %s@%s" % (
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["ipaddress"]
+                                 ))
+            self.debug("SSH result: %s" % str(res))
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        result = str(res)
+        self.assertNotEqual(
+                    result.count("No route to host"),
+                    1,
+                    "SSH into management server from VM should be successful"
+                    )
+
+        self.debug(
+            "Revoke Egress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        result = security_group.revokeEgress(
+                                self.apiclient,
+                                id=ssh_egress_rule["ruleid"]
+                                )
+        self.debug("Revoke egress rule result: %s" % result)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+            ssh = self.virtual_machine.get_ssh_client(reconnect=True)
+
+            self.debug("Ping to google.com from VM")
+            # Ping to outsite world
+            res = ssh.execute("ping -c 1 www.google.com")
+            # res = 64 bytes from maa03s17-in-f20.1e100.net (74.125.236.212):
+            # icmp_req=1 ttl=57 time=25.9 ms
+            # --- www.l.google.com ping statistics ---
+            # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
+            # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        result = str(res)
+        self.assertEqual(
+                         result.count("1 received"),
+                         1,
+                         "Ping to outside world from VM should be successful"
+                         )
+
+        try:
+            self.debug("SSHing into management server from VM")
+            res = ssh.execute("ssh %s@%s" % (
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["ipaddress"]
+                                 ))
+            self.debug("SSH result: %s" % str(res))
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        result = str(res)
+        self.assertNotEqual(
+                    result.count("No route to host"),
+                    1,
+                    "SSH into management server from VM should be successful"
+                    )
+        return
+
+
+class TestInvalidAccountAuthroize(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestInvalidAccountAuthroize,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_invalid_account_authroize(self):
+        """Test invalid account authroize
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    non-existent random account and default security group
+        # 4. listSecurityGroups should show ssh and default security groups
+        # 5. authorizeSecurityGroupEgress API should fail since there is no
+        #    account
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        with self.assertRaises(Exception):
+            egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=random_gen(),
+                                        domainid=self.account.account.domainid
+                                        )
+        return
+
+
+class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestMultipleAccountsEgressRuleNeg,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.accountA = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.accountB = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.accountA.account.name
+        cls._cleanup = [
+                        cls.accountA,
+                        cls.accountB,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_multiple_account_egress_rule_negative(self):
+        """Test multiple account egress rules negative case
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user A
+        # 2. createaccount of type user B
+        # 3. createsecuritygroup (SSH-A) for account A
+        # 4. authorizeSecurityGroupEgress in account A to allow ssh access
+        #    only out to VMs in account B's default security group
+        # 5. authorizeSecurityGroupIngress in account A to allow ssh incoming
+        #    access from anywhere into Vm's of account A. listSecurityGroups
+        #    for account A should show two groups (default and ssh-a) and ssh
+        #    ingress rule and account based egress rule
+        # 6. deployVM in account A into security group SSH-A. deployed VM
+        #    should be Running
+        # 7. deployVM in account B. deployed VM should be Running
+        # 8. ssh into VM  in account A and from there ssh to VM in account B.
+        #    ssh should fail
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        # Authorize to only account not CIDR
+        user_secgrp_list = {self.accountB.account.name: 'default'}
+
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["sg_account"],
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid,
+                                        user_secgrp_list=user_secgrp_list
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        self.virtual_machineA = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.accountA.account.name,
+                                    domainid=self.accountA.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.cleanup.append(self.virtual_machineA)
+        self.debug("Deploying VM in account: %s" % self.accountA.account.name)
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machineA.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VM should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "VM state after deployment should be running"
+                         )
+        self.debug("VM: %s state: %s" % (vm.id, vm.state))
+
+        self.virtual_machineB = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.accountB.account.name,
+                                    domainid=self.accountB.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(self.virtual_machineB)
+        self.debug("Deploying VM in account: %s" % self.accountB.account.name)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machineB.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VM should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "VM state after deployment should be running"
+                         )
+        self.debug("VM: %s state: %s" % (vm.id, vm.state))
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machineA.ssh_ip)
+            ssh = self.virtual_machineA.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machineA.ipaddress, e)
+                      )
+
+        try:
+            self.debug("SSHing into VM type B from VM A")
+            self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
+            res = ssh.execute("ssh %s@%s" % (
+                                self.services["virtual_machine"]["username"],
+                                self.virtual_machineB.ssh_ip
+                                ))
+            self.debug("SSH result: %s" % str(res))
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machineA.ipaddress, e)
+                      )
+        result = str(res)
+        self.assertEqual(
+                    result.count("Connection timed out"),
+                    1,
+                    "SSH into management server from VM should not be successful"
+                    )
+        return
+
+
+class TestMultipleAccountsEgressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestMultipleAccountsEgressRule,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.accountA = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.accountB = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.accountA.account.name
+        cls._cleanup = [
+                        cls.accountA,
+                        cls.accountB,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_multiple_account_egress_rule_positive(self):
+        """Test multiple account egress rules positive case
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user A
+        # 2. createaccount of type user B
+        # 3. createsecuritygroup (SSH-A) for account A
+        # 4. authorizeSecurityGroupEgress in account A to allow ssh access
+        #    only out to VMs in account B's default security group
+        # 5. authorizeSecurityGroupIngress in account A to allow ssh incoming
+        #    access from anywhere into Vm's of account A. listSecurityGroups
+        #    for account A should show two groups (default and ssh-a) and ssh
+        #    ingress rule and account based egress rule
+        # 6. deployVM in account A into security group SSH-A. deployed VM
+        #    should be Running
+        # 7. deployVM in account B. deployed VM should be Running
+        # 8. ssh into VM  in account A and from there ssh to VM in account B.
+        #    ssh should fail
+
+        security_groupA = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_groupA.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        security_groupB = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.accountB.account.name,
+                                        domainid=self.accountB.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_groupB.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                    self.apiclient,
+                                    account=self.accountB.account.name,
+                                    domainid=self.accountB.account.domainid
+                                    )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_groupA.id)
+        # Authorize to only account not CIDR
+        user_secgrp_list = {self.accountB.account.name: security_groupB.name}
+
+        egress_rule = security_groupA.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["sg_account"],
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid,
+                                        user_secgrp_list=user_secgrp_list
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_groupA.id)
+        ingress_ruleA = security_groupA.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.accountA.account.name,
+                                        domainid=self.accountA.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_ruleA, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_ruleA = (ingress_ruleA["ingressrule"][0]).__dict__
+
+        self.virtual_machineA = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.accountA.account.name,
+                                    domainid=self.accountA.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_groupA.id]
+                                )
+        self.cleanup.append(self.virtual_machineA)
+        self.debug("Deploying VM in account: %s" % self.accountA.account.name)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machineA.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VM should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "VM state after deployment should be running"
+                         )
+        self.debug("VM: %s state: %s" % (vm.id, vm.state))
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_groupB.id)
+        ingress_ruleB = security_groupB.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.accountB.account.name,
+                                        domainid=self.accountB.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_ruleB, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_ruleB = (ingress_ruleB["ingressrule"][0]).__dict__
+
+        self.virtual_machineB = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.accountB.account.name,
+                                    domainid=self.accountB.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_groupB.id]
+                                )
+        self.cleanup.append(self.virtual_machineB)
+        self.debug("Deploying VM in account: %s" % self.accountB.account.name)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machineB.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VM should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "VM state after deployment should be running"
+                         )
+        self.debug("VM: %s state: %s" % (vm.id, vm.state))
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machineA.ssh_ip)
+            ssh = self.virtual_machineA.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machineA.ipaddress, e)
+                      )
+
+        try:
+            self.debug("SSHing into VB type B from VM A")
+            self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
+
+            res = ssh.execute("ssh %s@%s" % (
+                                self.services["virtual_machine"]["username"],
+                                self.virtual_machineB.ssh_ip
+                                ))
+            self.debug("SSH result: %s" % str(res))
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machineA.ipaddress, e)
+                      )
+        result = str(res)
+        self.assertNotEqual(
+                    result.count("Connection timed out"),
+                    1,
+                    "SSH into management server from VM should be successful"
+                    )
+        return
+
+
+class TestStartStopVMWithEgressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestStartStopVMWithEgressRule,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_start_stop_vm_egress(self):
+        """ Test stop start Vm with egress rules
+        """
+
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    CIDR: 0.0.0.0/0
+        # 5. deployVirtualMachine into this security group (ssh)
+        # 6. stopVirtualMachine
+        # 7. startVirtualMachine
+        # 8. ssh in to VM
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug(
+            "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        # Stop virtual machine
+        self.debug("Stopping virtual machine: %s" % self.virtual_machine.id)
+        self.virtual_machine.stop(self.apiclient)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VM should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Stopped",
+                         "VM state should be stopped"
+                         )
+        self.debug("VM: %s state: %s" % (vm.id, vm.state))
+
+        # Start virtual machine
+        self.debug("Starting virtual machine: %s" % self.virtual_machine.id)
+        self.virtual_machine.start(self.apiclient)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VM should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "VM state should be stopped"
+                         )
+        self.debug("VM: %s state: %s" % (vm.id, vm.state))
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+            ssh = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        return
+
+
+@unittest.skip("Valid bug- ID: CS-12647")
+class TestInvalidParametersForEgress(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestInvalidParametersForEgress,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_invalid_parameters(self):
+        """ Test invalid parameters for egress rules
+        """
+
+
+        # Validate the following:
+        # 1. createUserAccount
+        # 2. createSecurityGroup (test)
+        # 3. authorizeEgressRule (negative port) - Should fail
+        # 4. authorizeEgressRule (invalid CIDR) - Should fail
+        # 5. authorizeEgressRule (invalid account) - Should fail
+        # 6. authorizeEgressRule (22, cidr: anywhere) and
+        #    authorizeEgressRule (22, cidr: restricted) - Should pass
+        # 7. authorizeEgressRule (21, cidr : 10.1.1.0/24) and
+        #    authorizeEgressRule (21, cidr: 10.1.1.0/24) - Should fail
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+            "Authorizing egress rule for sec group ID: %s with invalid port"
+                                                        % security_group.id)
+        with self.assertRaises(Exception):
+            egress_rule = security_group.authorizeEgress(
+                                    self.apiclient,
+                                    self.services["sg_invalid_port"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.debug(
+            "Authorizing egress rule for sec group ID: %s with invalid cidr"
+                                                        % security_group.id)
+        with self.assertRaises(Exception):
+            egress_rule = security_group.authorizeEgress(
+                                    self.apiclient,
+                                    self.services["sg_invalid_cidr"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.debug(
+            "Authorizing egress rule for sec group ID: %s with invalid account"
+                                                        % security_group.id)
+        with self.assertRaises(Exception):
+            egress_rule = security_group.authorizeEgress(
+                                    self.apiclient,
+                                    self.services["security_group"],
+                                    account=random_gen(),
+                                    domainid=self.account.account.domainid
+                                    )
+        self.debug(
+            "Authorizing egress rule for sec group ID: %s with cidr: anywhere and port: 22"
+                                                        % security_group.id)
+        egress_rule_A = security_group.authorizeEgress(
+                                    self.apiclient,
+                                    self.services["sg_cidr_anywhere"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+
+        self.assertEqual(
+                          isinstance(egress_rule_A, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+
+        egress_rule_R = security_group.authorizeEgress(
+                                    self.apiclient,
+                                    self.services["sg_cidr_restricted"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+
+        self.assertEqual(
+                          isinstance(egress_rule_R, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+
+        self.debug(
+            "Authorizing egress rule for sec group ID: %s with duplicate port"
+                                                        % security_group.id)
+        with self.assertRaises(Exception):
+            security_group.authorizeEgress(
+                                    self.apiclient,
+                                    self.services["sg_cidr_restricted"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        return
+
+
+class TestEgressAfterHostMaintainance(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestEgressAfterHostMaintainance,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.pod = get_pod(
+                          cls.api_client,
+                          zoneid=cls.zone.id
+                          )
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["sg", "eip", "maintenance"])
+    def test_egress_after_host_maintainance(self):
+        """Test maintenance case for egress
+        """
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    CIDR: 0.0.0.0/0
+        # 5. deployVirtualMachine into this security group (ssh)
+        # 6. deployed VM should be Running, ssh should be allowed into the VM
+        # 7. Enable maintainance mode for host, cance maintainance mode
+        # 8. User should be able to SSH into VM after maintainace
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                      )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                      )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            ssh = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        vms = VirtualMachine.list(
+                                    self.apiclient,
+                                    id=self.virtual_machine.id,
+                                    listall=True
+                          )
+        self.assertEqual(
+                          isinstance(vms, list),
+                          True,
+                          "Check list VMs response for valid host"
+                    )
+        vm = vms[0]
+
+        self.debug("Enabling host maintainance for ID: %s" % vm.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = vm.hostid
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        self.debug("Canceling host maintainance for ID: %s" % vm.hostid)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = vm.hostid
+        self.apiclient.cancelHostMaintenance(cmd)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+        self.debug("Starting VM: %s" % self.virtual_machine.id)
+
+        self.virtual_machine.start(self.apiclient)
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            ssh = self.virtual_machine.get_ssh_client(reconnect=True)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_eip_elb.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_eip_elb.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_eip_elb.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_eip_elb.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1554 @@
+# 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.
+
+""" P1 tests for elastic load balancing and elastic IP
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test elastic load balancing and elastic IP
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                                    },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "openfirewall": False,
+                                },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                                },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "netscaler": {
+                                       "ipaddress": '10.147.40.100',
+                                       "username": 'nsroot',
+                                       "password": 'nsroot'
+                                },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'basic'
+                    }
+
+class TestEIP(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestEIP, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        # Spawn an instance
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id
+                                  )
+        networks = Network.list(
+                                cls.api_client,
+                                zoneid=cls.zone.id,
+                                listall=True
+                                )
+        if isinstance(networks, list):
+            # Basic zone has only one network i.e Basic network
+            cls.guest_network = networks[0]
+        else:
+            raise Exception(
+                "List networks returned empty response for zone: %s" %
+                                                                cls.zone.id)
+
+        ip_addrs = PublicIPAddress.list(
+                                    cls.api_client,
+                                    associatednetworkid=cls.guest_network.id,
+                                    isstaticnat=True,
+                                    account=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    listall=True
+                                    )
+        if isinstance(ip_addrs, list):
+            cls.source_nat = ip_addrs[0]
+            print "source_nat ipaddress : ", cls.source_nat
+        else:
+            raise Exception(
+                    "No Source NAT IP found for guest network: %s" %
+                                                            guest_network.id)
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.dbclient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+    
+
+    @attr(tags = ["eip"])
+    @unittest.skip("skipped - Framework DB Exception")
+    def test_01_eip_by_deploying_instance(self):
+        """Test EIP by deploying an instance
+        """
+
+
+        # Validate the following
+        # 1. Instance gets an IP from GUEST IP range.
+        # 2. One IP from EIP pool is taken and configured on NS
+        #    commands to verify on NS:
+        #    show ip, show inat- make sure that output says USIP : ON
+        # 3. After allowing ingress rule based on source CIDR to the
+        #    respective port, verify that you are able to reach guest with EIP
+        # 4. user_ip_address.is_system=1, user_ip_address.one_to_one_nat=1
+
+        self.debug("Fetching public network IP range for public network")
+        ip_ranges = PublicIpRange.list(
+                                       self.apiclient,
+                                       zoneid=self.zone.id,
+                                       forvirtualnetwork=True
+                                       )
+        self.assertEqual(
+                         isinstance(ip_ranges, list),
+                         True,
+                         "Public IP range should return a valid range"
+                         )
+        # Guest network can have multiple IP ranges. In that case, split IP
+        # address and then compare the values
+        for ip_range in ip_ranges:
+            self.debug("IP range: %s - %s" % (
+                                          ip_range.startip,
+                                          ip_range.endip
+                                          ))
+
+            start_ip_list = ip_range.startip.split(".")
+            end_ip_list = ip_range.endip.split(".")
+            source_nat_list = self.source_nat.ipaddress.split(".")
+
+            flag = True
+            for i in range(3):
+                if int(start_ip_list[i]) != int(source_nat_list[i]):
+                    flag = False
+
+            self.assertGreaterEqual(
+                int(source_nat_list[3]),
+                int(start_ip_list[3]),
+                "The NAT should be greater/equal to start IP of guest network"
+                )
+
+            self.assertLessEqual(
+                int(source_nat_list[3]),
+                int(end_ip_list[3]),
+                "The NAT should be less/equal to start IP of guest network"
+                )
+
+        # Verify listSecurity groups response
+        security_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(security_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(security_groups),
+                            1,
+                            "Check List Security groups response"
+                            )
+        self.debug("List Security groups response: %s" %
+                                            str(security_groups))
+
+        security_group = security_groups[0]
+
+        self.debug(
+            "Creating Ingress rule to allow SSH on default security group")
+
+        cmd = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
+        cmd.domainid = self.account.account.domainid
+        cmd.account = self.account.account.name
+        cmd.securitygroupid = security_group.id
+        cmd.protocol = 'TCP'
+        cmd.startport = 22
+        cmd.endport = 22
+        cmd.cidrlist = '0.0.0.0/0'
+        self.apiclient.authorizeSecurityGroupIngress(cmd)
+#COMMENTED:
+#        try:
+#            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+#            ssh = self.virtual_machine.get_ssh_client(
+#                                        ipaddress=self.source_nat.ipaddress)
+#        except Exception as e:
+#            self.fail("SSH Access failed for %s: %s" % \
+#                      (self.virtual_machine.ipaddress, e)
+#                      )
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % self.source_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % self.source_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                1,
+                "user_ip_address.is_system value should be 1 for static NAT"
+                )
+
+        self.assertEqual(
+                qresult[1],
+                1,
+                "user_ip_address.one_to_one_nat value should be 1 for static NAT"
+                )
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(self.source_nat.ipaddress),
+                    1,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show inat")
+            res = ssh_client.execute("show inat")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("NAME: Cloud-Inat-%s" % self.source_nat.ipaddress),
+                    1,
+                    "User source IP should be enabled for INAT service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["eip"])
+    @unittest.skip("skipped - Framework DB Exception")
+    def test_02_acquire_ip_enable_static_nat(self):
+        """Test associate new IP and enable static NAT for new IP and the VM
+        """
+
+
+        # Validate the following
+        # 1. user_ip_address.is_system = 0 & user_ip_address.one_to_one_nat=1
+        # 2. releases default EIP whose user_ip_address.is_system=1
+        # 3. After allowing ingress rule based on source CIDR to the
+        #    respective port, verify that you are able to reach guest with EIP
+        # 4. check configuration changes for EIP reflects on NS
+        #    commands to verify on NS :
+        #    * "show ip"
+        #    * "show inat" - make sure that output says USIP : ON
+
+        self.debug("Acquiring new IP for network: %s" % self.guest_network.id)
+
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    services=self.services["virtual_machine"]
+                                    )
+        self.debug("IP address: %s is acquired by network: %s" % (
+                                                public_ip.ipaddress.ipaddress,
+                                                self.guest_network.id))
+        self.debug("Enabling static NAT for IP Address: %s" %
+                                                public_ip.ipaddress.ipaddress)
+
+        StaticNATRule.enable(
+                             self.apiclient,
+                             ipaddressid=public_ip.ipaddress.id,
+                             virtualmachineid=self.virtual_machine.id
+                             )
+
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % public_ip.ipaddress.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % public_ip.ipaddress.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                0,
+                "user_ip_address.is_system value should be 0 for new IP"
+                )
+
+        self.assertEqual(
+                qresult[1],
+                1,
+                "user_ip_address.one_to_one_nat value should be 1 for static NAT"
+                )
+
+        self.debug(
+            "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % self.source_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % self.source_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                0,
+                "user_ip_address.is_system value should be 0 old source NAT"
+                )
+
+#        try:
+#            self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
+#            ssh = self.virtual_machine.get_ssh_client(
+#                                    ipaddress=public_ip.ipaddress.ipaddress)
+#        except Exception as e:
+#            self.fail("SSH Access failed for %s: %s" % \
+#                      (public_ip.ipaddress.ipaddress, e)
+#                      )
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(public_ip.ipaddress.ipaddress),
+                    1,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show inat")
+            res = ssh_client.execute("show inat")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("NAME: Cloud-Inat-%s" % public_ip.ipaddress.ipaddress),
+                    1,
+                    "User source IP should be enabled for INAT service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["eip"])
+    @unittest.skip("skipped - Framework DB Exception")
+    def test_03_disable_static_nat(self):
+        """Test disable static NAT and release EIP acquired
+        """
+
+
+        # Validate the following
+        # 1. Disable static NAT. Disables one-to-one NAT and releases EIP
+        #    whose user_ip_address.is_system=0
+        # 2. Gets a new ip from EIP pool whose user_ip_address.is_system=1
+        #    and user_ip_address.one_to_one_nat=1
+        # 3. DisassicateIP should mark this EIP whose is_system=0 as free.
+        #    commands to verify on NS :
+        #    * "show ip"
+        #    * "show inat"-make sure that output says USIP : ON
+
+        self.debug(
+            "Fetching static NAT for VM: %s" % self.virtual_machine.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    associatednetworkid=self.guest_network.id,
+                                    isstaticnat=True,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+        static_nat = ip_addrs[0]
+        self.debug("Static NAT for VM: %s is: %s" % (
+                                            self.virtual_machine.name,
+                                            static_nat.ipaddress
+                                            ))
+
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                0,
+                "user_ip_address.is_system value should be 0"
+                )
+
+        self.debug("Disassociate Static NAT: %s" % static_nat.ipaddress)
+        cmd = disassociateIpAddress.disassociateIpAddressCmd()
+        cmd.id = static_nat.id
+        self.apiclient.disassociateIpAddress(cmd)
+
+        self.debug("Sleeping - after disassociating static NAT")
+        time.sleep(self.services["sleep"])
+
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select state from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select state from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                         qresult[0],
+                         "Free",
+                         "Ip should be marked as Free after disassociate IP"
+                         )
+
+        self.debug(
+            "Fetching static NAT for VM: %s" % self.virtual_machine.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    associatednetworkid=self.guest_network.id,
+                                    isstaticnat=True,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+        static_nat = ip_addrs[0]
+        self.debug("Static NAT for VM: %s is: %s" % (
+                                            self.virtual_machine.name,
+                                            static_nat.ipaddress
+                                            ))
+
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                1,
+                "is_system value should be 1 for automatically assigned IP"
+                )
+        self.assertEqual(
+                qresult[1],
+                1,
+                "one_to_one_nat value should be 1 for automatically assigned IP"
+                )
+#        try:
+#            self.debug("SSH into VM: %s" % static_nat.ipaddress)
+#            ssh = self.virtual_machine.get_ssh_client(
+#                                    ipaddress=static_nat.ipaddress)
+#        except Exception as e:
+#            self.fail("SSH Access failed for %s: %s" % \
+#                                    (static_nat.ipaddress, e))
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(static_nat.ipaddress),
+                    1,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show inat")
+            res = ssh_client.execute("show inat")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("USIP: ON"),
+                    2,
+                    "User source IP should be enabled for INAT service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["eip"])
+    @unittest.skip("skipped - Framework DB Exception")
+    def test_04_disable_static_nat_system(self):
+        """Test disable static NAT with system = True
+        """
+
+
+        # Validate the following
+        # 1. Try to disassociate/disable static NAT on EIP where is_system=1
+        # 2. This operation should fail with proper error message.
+
+        self.debug(
+            "Fetching static NAT for VM: %s" % self.virtual_machine.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    associatednetworkid=self.guest_network.id,
+                                    isstaticnat=True,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+        static_nat = ip_addrs[0]
+        self.debug("Static NAT for VM: %s is: %s" % (
+                                            self.virtual_machine.name,
+                                            static_nat.ipaddress
+                                            ))
+
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                1,
+                "user_ip_address.is_system value should be 1"
+                )
+
+        self.debug("Disassociate Static NAT: %s" % static_nat.ipaddress)
+
+        with self.assertRaises(Exception):
+            cmd = disassociateIpAddress.disassociateIpAddressCmd()
+            cmd.id = static_nat.id
+            apiclient.disassociateIpAddress(cmd)
+
+        self.debug("Disassociate system IP failed")
+        return
+
+    @attr(tags = ["eip"])
+    @unittest.skip("skipped - Framework DB Exception")
+    def test_05_destroy_instance(self):
+        """Test EIO after destroying instance
+        """
+
+
+        # Validate the following
+        # 1. Destroy instance. Destroy should result in is_system=0 for EIP
+        #    and EIP should also be marked as free.
+        # 2. Commands to verify on NS :
+        #    * "show ip"
+        #    * "show inat" - make sure that output says USIP: ON
+
+        self.debug(
+            "Fetching static NAT for VM: %s" % self.virtual_machine.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    associatednetworkid=self.guest_network.id,
+                                    isstaticnat=True,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+        static_nat = ip_addrs[0]
+        self.debug("Static NAT for VM: %s is: %s" % (
+                                            self.virtual_machine.name,
+                                            static_nat.ipaddress
+                                            ))
+
+        self.debug("Destroying an instance: %s" % self.virtual_machine.name)
+        self.virtual_machine.delete(self.apiclient)
+        self.debug("Destroy instance complete!")
+
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='expunge.delay'
+                                     )
+        self.assertEqual(
+                          isinstance(config, list),
+                          True,
+                          "Check list configurations response"
+                    )
+        exp_delay = config[0]
+        self.debug("expunge.delay: %s" % exp_delay.value)
+
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='expunge.interval'
+                                     )
+        self.assertEqual(
+                          isinstance(config, list),
+                          True,
+                          "Check list configurations response"
+                    )
+        exp_interval = config[0]
+        self.debug("expunge.interval: %s" % exp_interval.value)
+
+        # wait for exp_delay+exp_interval - cleans up VM
+        total_wait = int(exp_interval.value) + int(exp_delay.value)
+        time.sleep(total_wait)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.virtual_machine.id
+                                  )
+        self.assertEqual(
+                         vms,
+                         None,
+                         "list VM should not return anything after destroy"
+                         )
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system, state from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system, state from user_ip_address where public_ip_address='%s';" \
+                        % static_nat.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                0,
+                "user_ip_address.is_system value should be 0"
+                )
+
+        self.assertEqual(
+                         qresult[1],
+                         "Free",
+                         "IP should be marked as Free after destroying VM"
+                )
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                        result.count(static_nat.ipaddress),
+                        0,
+                        "show ip should return nothing after VM destroy"
+                        )
+
+            self.debug("Command:show inat")
+            res = ssh_client.execute("show inat")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                        result.count(static_nat.ipaddress),
+                        0,
+                        "show inat should return nothing after VM destroy"
+                        )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestELB(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestELB, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        # Spawn an instance
+        cls.vm_1 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id
+                                  )
+        cls.vm_2 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id
+                                  )
+        networks = Network.list(
+                                cls.api_client,
+                                zoneid=cls.zone.id,
+                                listall=True
+                                )
+        if isinstance(networks, list):
+            # Basic zone has only one network i.e Basic network
+            cls.guest_network = networks[0]
+        else:
+            raise Exception(
+                "List networks returned empty response for zone: %s" %
+                                                                cls.zone.id)
+        cls.lb_rule = LoadBalancerRule.create(
+                                        cls.api_client,
+                                        cls.services["lbrule"],
+                                        accountid=cls.account.account.name,
+                                        networkid=cls.guest_network.id,
+                                        domainid=cls.account.account.domainid
+                                        )
+        cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2])
+
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.dbclient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+    
+    @attr(tags = ["eip"])
+    def test_01_elb_create(self):
+        """Test ELB by creating a LB rule
+        """
+
+
+        # Validate the following
+        # 1. Deploy 2 instances
+        # 2. Create LB rule to port 22 for the VMs and try to access VMs with
+        #    EIP:port. Make sure that ingress rule is created to allow access
+        #    with universal CIDR (0.0.0.0/0)
+        # 3. For LB rule IP user_ip_address.is_system=1
+        # 4. check configuration changes for EIP reflects on NS
+        #    commands to verify on NS :
+        #    * "show ip"
+        #    * "show lb vserer"-make sure that output says they are all up
+        #    and running and USNIP : ON
+
+        # Verify listSecurity groups response
+        security_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                         isinstance(security_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(security_groups),
+                            1,
+                            "Check List Security groups response"
+                            )
+        self.debug("List Security groups response: %s" %
+                                            str(security_groups))
+
+        security_group = security_groups[0]
+
+        self.debug(
+            "Creating Ingress rule to allow SSH on default security group")
+
+        cmd = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
+        cmd.domainid = self.account.account.domainid
+        cmd.account = self.account.account.name
+        cmd.securitygroupid = security_group.id
+        cmd.protocol = 'TCP'
+        cmd.startport = 22
+        cmd.endport = 22
+        cmd.cidrlist = '0.0.0.0/0'
+        self.apiclient.authorizeSecurityGroupIngress(cmd)
+
+        self.debug(
+            "Fetching LB IP for account: %s" % self.account.account.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    associatednetworkid=self.guest_network.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    forloadbalancing=True,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+
+        lb_ip = ip_addrs[0]
+        self.debug("LB IP generated for account: %s is: %s" % (
+                                            self.account.account.name,
+                                            lb_ip.ipaddress
+                                            ))
+#TODO: uncomment this after ssh issue is resolved
+#        self.debug("SSHing into VMs using ELB IP: %s" % lb_ip.ipaddress)
+#        try:
+#            ssh_1 = self.vm_1.get_ssh_client(ipaddress=lb_ip.ipaddress)
+#            self.debug("Command: hostname")
+#            result = ssh_1.execute("hostname")
+#            self.debug("Result: %s" % result)
+#
+#            if isinstance(result, list):
+#                res = result[0]
+#            else:
+#                self.fail("hostname retrieval failed!")
+#
+#            self.assertIn(
+#                          res,
+#                          [self.vm_1.name, self.vm_2.name],
+#                          "SSH should return hostname of one of the VM"
+#                          )
+#
+#            ssh_2 = self.vm_2.get_ssh_client(ipaddress=lb_ip.ipaddress)
+#            self.debug("Command: hostname")
+#            result = ssh_2.execute("hostname")
+#            self.debug("Result: %s" % result)
+#
+#            if isinstance(result, list):
+#                res = result[0]
+#            else:
+#                self.fail("hostname retrieval failed!")
+#            self.assertIn(
+#                          res,
+#                          [self.vm_1.name, self.vm_2.name],
+#                          "SSH should return hostname of one of the VM"
+#                          )
+#        except Exception as e:
+#            self.fail(
+#                "SSH Access failed for %s: %s" % (self.vm_1.ipaddress, e))
+
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system from user_ip_address where public_ip_address='%s';" \
+                                                        % lb_ip.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system from user_ip_address where public_ip_address='%s';" \
+                        % lb_ip.ipaddress
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                1,
+                "is_system value should be 1 for system generated LB rule"
+                )
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(lb_ip.ipaddress),
+                    1,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show lb vserver")
+            res = ssh_client.execute("show lb vserver")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (lb_ip.ipaddress, lb_ip.ipaddress)),
+                    1,
+                    "User subnet IP should be enabled for LB service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+    
+    @attr(tags = ["eip"])
+    def test_02_elb_acquire_and_create(self):
+        """Test ELB by acquiring IP and then creating a LB rule
+        """
+
+
+        # Validate the following
+        # 1. Deploy 2 instances
+        # 2. Create LB rule to port 22 for the VMs and try to access VMs with
+        #    EIP:port. Make sure that ingress rule is created to allow access
+        #    with universal CIDR (0.0.0.0/0)
+        # 3. For LB rule IP user_ip_address.is_system=0
+        # 4. check configuration changes for EIP reflects on NS
+        #    commands to verify on NS :
+        #    * "show ip"
+        #    * "show lb vserer" - make sure that output says they are all up
+        #    and running and USNIP : ON
+
+        self.debug("Acquiring new IP for network: %s" % self.guest_network.id)
+
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    services=self.services["virtual_machine"]
+                                    )
+        self.debug("IP address: %s is acquired by network: %s" % (
+                                                public_ip.ipaddress.ipaddress,
+                                                self.guest_network.id))
+
+        self.debug("Creating LB rule for public IP: %s" %
+                                            public_ip.ipaddress.ipaddress)
+        lb_rule = LoadBalancerRule.create(
+                                        self.apiclient,
+                                        self.services["lbrule"],
+                                        accountid=self.account.account.name,
+                                        ipaddressid=public_ip.ipaddress.id,
+                                        networkid=self.guest_network.id,
+                                        domainid=self.account.account.domaind
+                                        )
+        self.debug("Assigning VMs (%s, %s) to LB rule: %s" % (self.vm_1.name,
+                                                              self.vm_2.name,
+                                                              lb_rule.name))
+        lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2])
+#TODO: workaround : add route in the guest VM for SNIP
+#
+#        self.debug("SSHing into VMs using ELB IP: %s" %
+#                                                public_ip.ipaddress.ipaddress)
+#        try:
+#            ssh_1 = self.vm_1.get_ssh_client(
+#                                    ipaddress=public_ip.ipaddress.ipaddress)
+#            self.debug("Command: hostname")
+#            result = ssh_1.execute("hostname")
+#            self.debug("Result: %s" % result)
+#
+#            if isinstance(result, list):
+#                res = result[0]
+#            else:
+#                self.fail("hostname retrieval failed!")
+#            self.assertIn(
+#                          res,
+#                          [self.vm_1.name, self.vm_2.name],
+#                          "SSH should return hostname of one of the VM"
+#                          )
+#
+#            ssh_2 = self.vm_2.get_ssh_client(
+#                                    ipaddress=public_ip.ipaddress.ipaddress)
+#            self.debug("Command: hostname")
+#            result = ssh_2.execute("hostname")
+#            self.debug("Result: %s" % result)
+#
+#            if isinstance(result, list):
+#                res = result[0]
+#            else:
+#                self.fail("hostname retrieval failed!")
+#            self.assertIn(
+#                          res,
+#                          [self.vm_1.name, self.vm_2.name],
+#                          "SSH should return hostname of one of the VM"
+#                          )
+#        except Exception as e:
+#            self.fail(
+#                "SSH Access failed for %s: %s" % (self.vm_1.ipaddress, e))
+#
+##         Fetch details from user_ip_address table in database
+        self.debug(
+            "select is_system from user_ip_address where public_ip_address='%s';" \
+                                            % public_ip.ipaddress.ipaddress)
+
+        qresultset = self.dbclient.execute(
+                        "select is_system from user_ip_address where public_ip_address='%s';" \
+                        % public_ip.ipaddress.ipaddress)
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        self.assertEqual(
+                qresult[0],
+                0,
+                "is_system value should be 0 for non-system generated LB rule"
+                )
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(public_ip.ipaddress.ipaddress),
+                    1,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show lb vserver")
+            res = ssh_client.execute("show lb vserver")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (public_ip.ipaddress.ipaddress, public_ip.ipaddress.ipaddress)),
+                    1,
+                    "User subnet IP should be enabled for LB service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    
+    @attr(tags = ["eip"])
+    def test_03_elb_delete_lb_system(self):
+        """Test delete LB rule generated with public IP with is_system = 1
+        """
+
+
+        # Validate the following
+        # 1. Deleting LB rule should release EIP where is_system=1
+        # 2. check configuration changes for EIP reflects on NS
+        #    commands to verify on NS:
+        #    * "show ip"
+        #    * "show lb vserer"-make sure that output says they are all up and
+        #    running and USNIP : ON
+
+        self.debug(
+            "Fetching LB IP for account: %s" % self.account.account.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    associatednetworkid=self.guest_network.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    forloadbalancing=True,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+
+        lb_ip = ip_addrs[0]
+        self.debug("LB IP generated for account: %s is: %s" % (
+                                            self.account.account.name,
+                                            lb_ip.ipaddress
+                                            ))
+
+        self.debug("Deleting LB rule: %s" % self.lb_rule.id)
+        self.lb_rule.delete(self.apiclient)
+
+
+        time.sleep(60)
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(lb_ip.ipaddress),
+                    0,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show lb vserver")
+            res = ssh_client.execute("show lb vserver")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+            
+            self.assertEqual(
+                    result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (lb_ip.ipaddress, lb_ip.ipaddress) ),
+                    0,
+                    "User subnet IP should be enabled for LB service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+    
+    @attr(tags = ["eip"])
+    @unittest.skip("valid bug : http://bugs.cloudstack.org/browse/CS-15077 : ListPublicIPAddress failing")
+    def test_04_delete_lb_on_eip(self):
+        """Test delete LB rule generated on EIP
+        """
+
+
+        # Validate the following
+        # 1. Deleting LB rule won't release EIP where is_system=0
+        # 2. disassociateIP must release the above IP
+        # 3. check configuration changes for EIP reflects on NS
+        #    commands to verify on NS :
+        #    * "show ip"
+        #    * "show lb vserer"-make sure that output says they are all up and
+        #    running and USNIP : ON
+
+         # Fetch details from account_id table in database
+        self.debug(
+            "select id from account where account_name='%s';" \
+                                            % self.account.account.name)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where account_name='%s';" \
+                                            % self.account.account.name)
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "DB query should return a valid public IP address"
+                            )
+        qresult = qresultset[0]
+        account_id = qresult[0]
+        # Fetch details from user_ip_address table in database
+        self.debug(
+            "select public_ip_address from user_ip_address where is_system=0 and account_id=%s;" \
+                                            % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select public_ip_address from user_ip_address where is_system=0 and account_id=%s;" \
+                                            % account_id)
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "DB query should return a valid public IP address"
+                            )
+        qresult = qresultset[0]
+        public_ip = qresult[0]
+
+        self.debug(
+            "Fetching public IP for account: %s" % self.account.account.name)
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    ipaddress=public_ip,
+                                    listall=True
+                                    )
+        self.debug("ip address list: %s" % ip_addrs)
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "List Public IP address should return valid IP address for network"
+                )
+
+        lb_ip = ip_addrs[0]
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         publicipid=lb_ip.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                isinstance(lb_rules, list),
+                True,
+                "Atleast one LB rule must be present for public IP address"
+                )
+        lb_rule = lb_rules[0]
+        self.debug("Deleting LB rule associated with IP: %s" % public_ip)
+
+        try:
+            cmd = deleteLoadBalancerRule.deleteLoadBalancerRuleCmd()
+            cmd.id = lb_rule.id
+            self.apiclient.deleteLoadBalancerRule(cmd)
+        except Exception as e:
+            self.fail("Deleting LB rule failed for IP: %s-%s" % (public_ip, e))
+
+#TODO:check the lb rule list and then confirm that lb rule is deleted
+        self.debug("LB rule deleted!")
+
+        ip_addrs = PublicIPAddress.list(
+                                    self.api_client,
+                                    ipaddress=public_ip,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(ip_addrs, list),
+                True,
+                "Deleting LB rule should not delete public IP"
+                )
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show ip")
+            res = ssh_client.execute("show ip")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertNotEqual(
+                    result.count(public_ip),
+                    1,
+                    "One IP from EIP pool should be taken and configured on NS"
+                    )
+
+            self.debug("Command:show lb vserver")
+            res = ssh_client.execute("show lb vserver")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertNotEqual(
+                    result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (lb_ip.ipaddress, lb_ip.ipaddress)),
+                    1,
+                    "User subnet IP should be enabled for LB service"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_high_availability.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_high_availability.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_high_availability.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_high_availability.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1079 @@
+# 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.
+
+""" P1 tests for high availability
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test network offering Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "HA",
+                                    "lastname": "HA",
+                                    "username": "HA",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                                    },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                                },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                                },
+                         "fw_rule": {
+                                    "startport": 1,
+                                    "endport": 6000,
+                                    "cidr": '55.55.0.0/11',
+                                    # Any network (For creating FW rule)
+                                },
+                         "virtual_machine": {
+                                    "displayname": "VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "templates": {
+                                "displaytext": "Public Template",
+                                "name": "Public template",
+                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                                "hypervisor": 'XenServer',
+                                "format": 'VHD',
+                                "isfeatured": True,
+                                "ispublic": True,
+                                "isextractable": True,
+                                "templatefilter": 'self',
+                         },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 100,
+                         "mode": 'advanced'
+                    }
+
+
+class TestHighAvailability(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestHighAvailability,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+                                cls.api_client,
+                                cls.services
+                            )
+        cls.zone = get_zone(
+                            cls.api_client,
+                            cls.services
+                            )
+        cls.pod = get_pod(
+                          cls.api_client,
+                          zoneid=cls.zone.id,
+                          services=cls.services
+                          )
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            offerha=True
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.testClient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "multihost"])
+    def test_01_host_maintenance_mode(self):
+        """Test host maintenance mode
+        """
+
+
+        # Validate the following
+        # 1. Create Vms. Acquire IP. Create port forwarding & load balancing
+        #    rules for Vms.
+        # 2. Host 1: put to maintenance mode. All Vms should failover to Host
+        #    2 in cluster. Vms should be in running state. All port forwarding
+        #    rules and load balancing Rules should work.
+        # 3. After failover to Host 2 succeeds, deploy Vms. Deploy Vms on host
+        #    2 should succeed.
+        # 4. Host 1: cancel maintenance mode.
+        # 5. Host 2 : put to maintenance mode. All Vms should failover to
+        #    Host 1 in cluster.
+        # 6. After failover to Host 1 succeeds, deploy VMs. Deploy Vms on
+        #    host 1 should succeed.
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         2,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug("Checking HA with hosts: %s, %s" % (
+                                                       hosts[0].name,
+                                                       hosts[1].name
+                                                       ))
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        networks = Network.list(
+                                self.apiclient,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                listall=True
+                                )
+        self.assertEqual(
+                    isinstance(networks, list),
+                    True,
+                    "List networks should return valid list for the account"
+                    )
+        network = networks[0]
+
+        self.debug("Associating public IP for account: %s" %
+                                            self.account.account.name)
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        public_ip.ipaddress.ipaddress)
+        nat_rule = NATRule.create(
+                                 self.apiclient,
+                                 virtual_machine,
+                                 self.services["natrule"],
+                                 ipaddressid=public_ip.ipaddress.id
+                                 )
+
+        self.debug("Creating LB rule on IP with NAT: %s" %
+                                    public_ip.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        self.debug("Created LB rule with ID: %s" % lb_rule.id)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+
+        first_host = vm.hostid
+        self.debug("Enabling maintenance mode for host %s" % vm.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        timeout = self.services["timeout"]
+        # Poll and check state of VM while it migrates from one host to another
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+
+            self.debug("VM 1 state: %s" % vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+        second_host = vm.hostid
+        self.assertEqual(
+                vm.state,
+                "Running",
+                "VM should be in Running state after enabling host maintenance"
+                )
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Spawn an instance on other host
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_2.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 2 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % first_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % first_host)
+
+        self.debug("Enabling maintenance mode for host %s" % second_host)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+        self.debug("Maintenance mode enabled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in [
+                            "Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"
+                            ]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+                # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[1]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in [
+                            "Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"
+                            ]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+        for vm in vms:
+            self.debug(
+                "VM states after enabling maintenance mode on host: %s - %s" %
+                                                    (first_host, vm.state))
+            self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        # Spawn an instance on other host
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_3.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 3 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+
+        self.debug("Canceling host maintenance for ID: %s" % second_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "multihost"])
+    def test_02_host_maintenance_mode_with_activities(self):
+        """Test host maintenance mode with activities
+        """
+
+
+        # Validate the following
+        # 1. Create Vms. Acquire IP. Create port forwarding & load balancing
+        #    rules for Vms.
+        # 2. While activities are ongoing: Create snapshots, recurring
+        #    snapshots, create templates, download volumes, Host 1: put to
+        #    maintenance mode. All Vms should failover to Host 2 in cluster
+        #    Vms should be in running state. All port forwarding rules and
+        #    load balancing Rules should work.
+        # 3. After failover to Host 2 succeeds, deploy Vms. Deploy Vms on host
+        #    2 should succeed. All ongoing activities in step 3 should succeed
+        # 4. Host 1: cancel maintenance mode.
+        # 5. While activities are ongoing: Create snapshots, recurring
+        #    snapshots, create templates, download volumes, Host 2: put to
+        #    maintenance mode. All Vms should failover to Host 1 in cluster.
+        # 6. After failover to Host 1 succeeds, deploy VMs. Deploy Vms on
+        #    host 1 should succeed. All ongoing activities in step 6 should
+        #    succeed.
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         2,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug("Checking HA with hosts: %s, %s" % (
+                                                       hosts[0].name,
+                                                       hosts[1].name
+                                                       ))
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        networks = Network.list(
+                                self.apiclient,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                listall=True
+                                )
+        self.assertEqual(
+                    isinstance(networks, list),
+                    True,
+                    "List networks should return valid list for the account"
+                    )
+        network = networks[0]
+
+        self.debug("Associating public IP for account: %s" %
+                                            self.account.account.name)
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        public_ip.ipaddress.ipaddress)
+        nat_rule = NATRule.create(
+                                 self.apiclient,
+                                 virtual_machine,
+                                 self.services["natrule"],
+                                 ipaddressid=public_ip.ipaddress.id
+                                 )
+
+        self.debug("Creating LB rule on IP with NAT: %s" %
+                                    public_ip.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        self.debug("Created LB rule with ID: %s" % lb_rule.id)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        volume = volumes[0]
+        self.debug(
+            "Root volume of VM(%s): %s" % (
+                                            virtual_machine.name,
+                                            volume.name
+                                            ))
+        # Create a snapshot from the ROOTDISK
+        self.debug("Creating snapshot on ROOT volume: %s" % volume.name)
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+        self.debug("Snapshot created: ID - %s" % snapshot.id)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id,
+                                   listall=True
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Generate template from the snapshot
+        self.debug("Generating template from snapshot: %s" % snapshot.name)
+        template = Template.create_from_snapshot(
+                                                 self.apiclient,
+                                                 snapshot,
+                                                 self.services["templates"]
+                                                 )
+        self.debug("Created template from snapshot: %s" % template.id)
+
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+
+        self.assertEqual(
+                isinstance(templates, list),
+                True,
+                "List template call should return the newly created template"
+                )
+
+        self.assertEqual(
+                    templates[0].isready,
+                    True,
+                    "The newly created template should be in ready state"
+                    )
+
+        first_host = vm.hostid
+        self.debug("Enabling maintenance mode for host %s" % vm.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        timeout = self.services["timeout"]
+        # Poll and check state of VM while it migrates from one host to another
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+
+            self.debug("VM 1 state: %s" % vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+        second_host = vm.hostid
+        self.assertEqual(
+                vm.state,
+                "Running",
+                "VM should be in Running state after enabling host maintenance"
+                )
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Spawn an instance on other host
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_2.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 2 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % first_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % first_host)
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_2.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        volume = volumes[0]
+        self.debug(
+            "Root volume of VM(%s): %s" % (
+                                            virtual_machine_2.name,
+                                            volume.name
+                                            ))
+        # Create a snapshot from the ROOTDISK
+        self.debug("Creating snapshot on ROOT volume: %s" % volume.name)
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+        self.debug("Snapshot created: ID - %s" % snapshot.id)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id,
+                                   listall=True
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Generate template from the snapshot
+        self.debug("Generating template from snapshot: %s" % snapshot.name)
+        template = Template.create_from_snapshot(
+                                                 self.apiclient,
+                                                 snapshot,
+                                                 self.services["templates"]
+                                                 )
+        self.debug("Created template from snapshot: %s" % template.id)
+
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+
+        self.assertEqual(
+                isinstance(templates, list),
+                True,
+                "List template call should return the newly created template"
+                )
+
+        self.assertEqual(
+                    templates[0].isready,
+                    True,
+                    "The newly created template should be in ready state"
+                    )
+
+        self.debug("Enabling maintenance mode for host %s" % second_host)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+        self.debug("Maintenance mode enabled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+        # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[1]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+        for vm in vms:
+            self.debug(
+                "VM states after enabling maintenance mode on host: %s - %s" %
+                                                    (first_host, vm.state))
+            self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        # Spawn an instance on other host
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_3.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 3 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % second_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_host_high_availability.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_host_high_availability.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_host_high_availability.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_host_high_availability.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,811 @@
+# -*- encoding: utf-8 -*-
+# 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
+
+""" P1 tests for dedicated Host high availability 
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin import remoteSSHClient
+import datetime
+
+
+class Services:
+    """ Dedicated host HA test cases """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "HA",
+                                    "lastname": "HA",
+                                    "username": "HA",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                         "service_offering_with_ha": {
+                                    "name": "Tiny Instance With HA Enabled",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                                    },
+                         "service_offering_without_ha": {
+                                    "name": "Tiny Instance Without HA",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                                    },
+                         "virtual_machine": {
+                                    "displayname": "VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         "timeout": 100,
+                    }
+
+class TestHostHighAvailability(cloudstackTestCase):
+    """ Dedicated host HA test cases """
+    
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestHostHighAvailability,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+                                cls.api_client,
+                                cls.services
+                            )
+        cls.zone = get_zone(
+                            cls.api_client,
+                            cls.services
+                            )
+
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering_with_ha = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering_with_ha"],
+                                            offerha=True
+                                            )
+        
+        cls.service_offering_without_ha = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering_without_ha"],
+                                            offerha=False
+                                            )
+        
+        cls._cleanup = [
+                        cls.service_offering_with_ha,
+                        cls.service_offering_without_ha,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.testClient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(configuration = "ha.tag")
+    @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator"])
+    def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self):
+        """ Test VM deployments (Create HA enabled Compute Service Offering and VM) """
+        
+        # Steps,
+        #1. Create a Compute service offering with the “Offer HA” option selected.
+        #2. Create a Guest VM with the compute service offering created above.
+        # Validations,
+        #1. Ensure that the offering is created and that in the UI the “Offer HA” field is enabled (Yes)
+        #The listServiceOffering API should list “offerha” as true.
+        #2. Select the newly created VM and ensure that the Compute offering field value lists the compute service offering that was selected. 
+        #    Also, check that the HA Enabled field is enabled “Yes”.
+        
+        #list and validate above created service offering with Ha enabled
+        list_service_response = list_service_offering(
+                                                      self.apiclient,
+                                                      id=self.service_offering_with_ha.id
+                                                      )
+        self.assertEqual(
+            isinstance(list_service_response, list),
+            True,
+            "listServiceOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_service_response),
+            0,
+            "listServiceOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_service_response[0].offerha,
+            True,
+            "The service offering is not HA enabled"
+            )
+        
+        #create virtual machine with the service offering with Ha enabled
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_with_ha.id
+                                  )
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        self.debug("Deployed VM on host: %s" % vms[0].hostid)
+        self.assertEqual(
+            vms[0].haenable,
+            True,
+            "VM not created with HA enable tag"
+            )
+
+    @attr(configuration = "ha.tag")
+    @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_02_no_vm_creation_on_host_with_haenabled(self):
+        """ Verify you can not create new VMs on hosts with an ha.tag """
+        
+        # Steps,
+        #1. Fresh install CS (Bonita) that supports this feature
+        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
+        #3. When adding host3, assign the HA host tag.
+        #4. You should already have a compute service offering with HA already create from above. If not, create one for HA.
+        #5. Create VMs with the service offering with and without the HA tag
+        # Validations,
+        #Check to make sure the newly created VM is not on any HA enabled hosts
+        #The  VM should be created only on host1 or host2 and never host3 (HA enabled)
+        
+        #create and verify virtual machine with HA enabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_with_ha.id
+                                  )
+         
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine_with_ha.id,
+                            listall=True
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+         
+        vm = vms[0]
+         
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+         
+        #validate the virtual machine created is host Ha enabled 
+        list_hosts_response = list_hosts(
+                            self.apiclient,
+                            id=vm.hostid                    
+                            )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "listHosts returned invalid object in response."
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "listHosts retuned empty list in response."
+            )
+        
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "VM created on HA enabled host."
+            )
+         
+        #create and verify virtual machine with Ha disabled service offering
+        virtual_machine_without_ha = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_without_ha.id
+                                  )
+         
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine_without_ha.id,
+                            listall=True
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+         
+        vm = vms[0]
+         
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        
+        #verify that the virtual machine created on the host is Ha disabled
+        list_hosts_response = list_hosts(
+                                self.apiclient,
+                                id=vm.hostid                    
+                                )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "listHosts returned invalid object in response."
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "listHosts returned empty list."
+            )
+         
+        host = list_hosts_response[0]
+         
+        self.assertEqual(
+            host.hahost,
+            False,
+            "VM migrated to HA enabled host."
+            )
+
+    @attr(configuration = "ha.tag")
+    @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
+        """ Verify you can not migrate VMs to hosts with an ha.tag (positive) """
+        
+        # Steps,
+        #1. Create a Compute service offering with the “Offer HA” option selected.
+        #2. Create a Guest VM with the compute service offering created above.
+        #3. Select the VM and migrate VM to another host. Choose a “Suitable” host (i.e. host2)
+        # Validations
+        #The option from the “Migrate instance to another host” dialog box” should list host3 as “Not Suitable” for migration.
+        #Confirm that the VM is migrated to the “Suitable” host you selected (i.e. host2)
+        
+        #create and verify the virtual machine with HA enabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_with_ha.id
+                                  )
+         
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine_with_ha.id,
+                            listall=True,
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        vm = vms[0]
+         
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        
+        #Find out a Suitable host for VM migration
+        list_hosts_response = list_hosts(
+                                  self.apiclient,
+                                  )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "The listHosts API returned the invalid list"
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "The listHosts returned nothing."
+            )
+        suitableHost = None
+        for host in list_hosts_response:
+            if host.suitableformigration == True and host.hostid != vm.hostid:
+                suitableHost = host
+                break
+        
+        self.assertTrue(suitableHost is not None, "suitablehost should not be None")
+        
+        #Migration of the VM to a suitable host
+        self.debug("Migrating VM-ID: %s to Host: %s" % (self.vm.id, suitableHost.id))
+
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.hostid = suitableHost.id
+        cmd.virtualmachineid = self.vm.id
+        self.apiclient.migrateVirtualMachine(cmd)
+
+        #Verify that the VM migrated to a targeted Suitable host
+        list_vm_response = list_virtual_machines(
+                                    self.apiclient,
+                                    id=vm.id
+                                    )
+        self.assertEqual(
+            isinstance(list_vm_response, list),
+            True,
+            "The listVirtualMachines returned the invalid list."
+            )
+
+        self.assertNotEqual(
+            list_vm_response,
+            None,
+            "The listVirtualMachines API returned nothing."
+            )
+
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.id,
+            vm.id,
+            "The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
+            )
+
+        self.assertEqual(
+            vm_response.hostid,
+            suitableHost.id,
+            "The VM is not migrated to targeted suitable host."
+            )
+			
+    @attr(configuration = "ha.tag")            
+    @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
+        """ Verify you can not migrate VMs to hosts with an ha.tag (negative) """
+        
+        # Steps,
+        #1. Create a Compute service offering with the “Offer HA” option selected.
+        #2. Create a Guest VM with the compute service offering created above.
+        #3. Select the VM and migrate VM to another host. Choose a “Not Suitable” host.
+        # Validations,
+        #The option from the “Migrate instance to another host” dialog box” should list host3 as “Not Suitable” for migration.
+        #By design, The Guest VM can STILL can be migrated to host3 if the admin chooses to do so.
+        
+        #create and verify virtual machine with HA enabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_with_ha.id
+                                  )
+         
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine_with_ha.id,
+                            listall=True
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "The listVirtualMachines returned invalid object in response."
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "The listVirtualMachines returned empty response."
+            )
+         
+        vm = vms[0]
+         
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        
+        #Find out Non-Suitable host for VM migration
+        list_hosts_response = list_hosts(
+                                  self.apiclient,
+                                  )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "listHosts returned invalid object in response."
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "listHosts returned empty response."
+            )
+        
+	notSuitableHost = None
+        for host in list_hosts_response:
+            if not host.suitableformigration and host.hostid != vm.hostid:
+                notSuitableHost = host
+		break
+		
+        self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
+        
+        #Migrate VM to Non-Suitable host
+        self.debug("Migrating VM-ID: %s to Host: %s" % (vm.id, notSuitableHost.id))
+
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.hostid = notSuitableHost.id
+        cmd.virtualmachineid = vm.id
+        self.apiclient.migrateVirtualMachine(cmd)
+
+        #Verify that the virtual machine got migrated to targeted Non-Suitable host
+        list_vm_response = list_virtual_machines(
+                                    self.apiclient,
+                                    id=vm.id
+                                    )
+        self.assertEqual(
+            isinstance(list_vm_response, list),
+            True,
+            "listVirtualMachine returned invalid object in response."
+            )
+
+        self.assertNotEqual(
+            len(list_vm_response),
+            0,
+            "listVirtualMachines returned empty response."
+            )
+
+        self.assertEqual(
+            list_vm_response[0].id,
+            vm.id,
+            "Virtual machine id with the virtual machine from listVirtualMachine is not matching."
+            )
+
+        self.assertEqual(
+            list_vm_response[0].hostid,
+            notSuitableHost.id,
+            "The detination host id of migrated VM is not matching."
+            )
+
+    @attr(configuration = "ha.tag")
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self):
+        """ Verify that none of the VMs with HA enabled migrate to an ha tagged host during live migration """
+        
+        # Steps,
+        #1. Fresh install CS (Bonita) that supports this feature
+        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
+        #3. When adding host3, assign the HA host tag.
+        #4. Create VMs with and without the Compute Service Offering with the HA tag.
+        #5. Note the VMs on host1 and whether any of the VMs have their “HA enabled” flags enabled.
+        #6. Put host1 into maintenance mode.
+        # Validations,
+        #1. Make sure the VMs are created on either host1 or host2 and not on host3
+        #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3.
+        
+        # create and verify virtual machine with HA disabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_with_ha.id
+                                  )
+         
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine_with_ha.id,
+                            listall=True
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+            )
+        
+        vm_with_ha_enabled = vms[0]
+        
+        #Verify the virtual machine got created on non HA host 
+        list_hosts_response = list_hosts(
+                                  self.apiclient,
+                                  id=vm_with_ha_enabled.hostid                    
+                                  )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+            )
+         
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+            )
+        
+        #put the Host in maintainance mode
+        self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = vm_with_ha_enabled.hostid
+        self.apiclient.prepareHostForMaintenance(cmd)
+        
+        timeout = self.services["timeout"]
+        
+        #verify the VM live migration happened to another running host
+        self.debug("Waiting for VM to come up")
+        wait_for_vm(
+            self.apiclient,
+            virtualmachineid=vm_with_ha_enabled.id,
+            interval=timeout
+            )
+        
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=vm_with_ha_enabled.id,
+                            listall=True,
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        vm_with_ha_enabled1 = vms[0]
+        
+        list_hosts_response = list_hosts(
+                                  self.apiclient,
+                                  id=vm_with_ha_enabled1.hostid                    
+                                  )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+            )
+         
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+            )
+        
+        self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_enabled.hostid)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = vm_with_ha_enabled.hostid
+        self.apiclient.cancelHostMaintenance(cmd)
+			
+    @attr(configuration = "ha.tag")
+    @attr(speed = "slow")            
+    @attr(tags = ["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self):
+        """ Verify that none of the VMs without HA enabled migrate to an ha tagged host during live migration """
+        
+        # Steps,
+        #1. Fresh install CS (Bonita) that supports this feature
+        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
+        #3. When adding host3, assign the HA host tag.
+        #4. Create VMs with and without the Compute Service Offering with the HA tag.
+        #5. Note the VMs on host1 and whether any of the VMs have their “HA enabled” flags enabled.
+        #6. Put host1 into maintenance mode.
+        # Validations,
+        #1. Make sure the VMs are created on either host1 or host2 and not on host3
+        #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3.
+        
+        # create and verify virtual machine with HA disabled service offering
+        virtual_machine_without_ha = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering_without_ha.id
+                                  )
+         
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=virtual_machine_without_ha.id,
+                            listall=True
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        vm_with_ha_disabled = vms[0]
+        
+        #Verify the virtual machine got created on non HA host 
+        list_hosts_response = list_hosts(
+                                  self.apiclient,
+                                  id=vm_with_ha_disabled.hostid                    
+                                  )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+            )
+         
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+            )
+        
+        #put the Host in maintainance mode
+        self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = vm_with_ha_disabled.hostid
+        self.apiclient.prepareHostForMaintenance(cmd)
+        
+        timeout = self.services["timeout"]
+        
+        #verify the VM live migration happened to another running host
+        self.debug("Waiting for VM to come up")
+        wait_for_vm(
+            self.apiclient,
+            virtualmachineid=vm_with_ha_disabled.id,
+            interval=timeout
+            )
+        
+        vms = VirtualMachine.list(
+                            self.apiclient,
+                            id=vm_with_ha_disabled.id,
+                            listall=True
+                            )
+         
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+            )
+         
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+            )
+        
+        list_hosts_response = list_hosts(
+                                  self.apiclient,
+                                  id=vms[0].hostid                    
+                                  )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+            )
+         
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+            )
+         
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+            )
+        
+        self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_disabled.hostid)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = vm_with_ha_disabled.hostid
+        self.apiclient.cancelHostMaintenance(cmd)
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_configs.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_configs.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_configs.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_configs.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,3024 @@
+# 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.
+
+""" P1 tests for netscaler configurations
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test netscaler Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 128, # In MBs
+                         },
+                         "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "netscaler": {
+                                "ipaddress": '192.168.100.213',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                                "port": 22,
+                         },
+                         "netscaler_dedicated": {
+                                "ipaddress": '192.168.100.213',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": True,
+                                "port": 22,
+                         },
+                         "network_offering_dedicated": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "specifyVlan": False,
+                                    "specifyIpRanges": False,
+                                    "serviceProviderList" : {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                                    "servicecapabilitylist": {
+                                        "SourceNat": {
+                                            "SupportedSourceNatTypes": "peraccount"
+                                        },
+                                        "lb": {
+                                               "SupportedLbIsolation": "dedicated"
+                                        },
+                                    },
+                         },
+                         "network_offering": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList" : {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                         },
+                         "network": {
+                                  "name": "Netscaler",
+                                  "displaytext": "Netscaler",
+                         },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "openfirewall": False,
+                         },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode":'advanced'
+                    }
+
+
+class TestAddNetScaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestAddNetScaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_add_netscaler_device(self):
+        """Test add netscaler device
+        """
+        # Validate the following
+        # 1. Add Netscaler device into a Zone by providing valid log in
+        #    credentials , public , private interface and enabling Load
+        #    Balancing feature.
+        # 2. Netscaler should be configured successfully.
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=self.zone.id
+                                                 )
+        self.assertEqual(
+            isinstance(physical_networks, list),
+            True,
+            "There should be atleast one physical network for advanced zone"
+            )
+        physical_network = physical_networks[0]
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        netscaler = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        self.cleanup.append(netscaler)
+        self.debug("Checking if Netscaler network service provider is enabled?")
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        self.apiclient,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        self.assertEqual(
+                         isinstance(nw_service_providers, list),
+                         True,
+                         "Network service providers list should not be empty"
+                         )
+        netscaler_provider = nw_service_providers[0]
+        if netscaler_provider.state != 'Enabled':
+            self.debug("Netscaler provider is not enabled. Enabling it..")
+            response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+            self.assertEqual(
+                        response.state,
+                        "Enabled",
+                        "Network service provider should be in enabled state"
+                         )
+        else:
+            self.debug("Netscaler service provider is already enabled.")
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        self.assertEqual(
+            ns.physicalnetworkid,
+            physical_network.id,
+            "Physical network id should match with the network in which device is configured"
+            )
+        return
+
+
+
+class TestInvalidParametersNetscaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestInvalidParametersNetscaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_invalid_cred(self):
+        """Test add netscaler device with invalid credential
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device into a Zone by providing invalid log in
+        #    credentials , but valid public, private interface
+        # 2. Netscaler API should throw error
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=self.zone.id
+                                                 )
+        self.assertEqual(
+            isinstance(physical_networks, list),
+            True,
+            "There should be atleast one physical network for advanced zone"
+            )
+        physical_network = physical_networks[0]
+
+        self.debug("Checking if Netscaler network service provider is enabled?")
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        self.apiclient,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        self.assertEqual(
+                         isinstance(nw_service_providers, list),
+                         True,
+                         "Network service providers list should not be empty"
+                         )
+        netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            self.debug("Netscaler provider is not enabled. Enabling it..")
+            response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+            self.assertEqual(
+                        response.state,
+                        "Enabled",
+                        "Network service provider should be in enabled state"
+                         )
+        else:
+            self.debug("NetScaler service provider is already enabled.")
+
+        self.debug("Passing invalid credential for NetScaler")
+        self.services["netscaler"]["username"] = random_gen()
+        self.services["netscaler"]["password"] = random_gen()
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+
+        self.debug("Username: %s, password: %s" % (
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"]
+                                    ))
+
+        with self.assertRaises(Exception):
+            NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_invalid_public_interface(self):
+        """Test add netscaler device with invalid public interface
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device into a Zone by providing valid log in
+        #    credentials , private interface and invalid public interface
+        # 2. Netscaler API should throw error
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=self.zone.id
+                                                 )
+        self.assertEqual(
+            isinstance(physical_networks, list),
+            True,
+            "There should be atleast one physical network for advanced zone"
+            )
+        physical_network = physical_networks[0]
+
+        self.debug("Checking if Netscaler network service provider is enabled?")
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        self.apiclient,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        self.assertEqual(
+                         isinstance(nw_service_providers, list),
+                         True,
+                         "Network service providers list should not be empty"
+                         )
+        netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            self.debug("Netscaler provider is not enabled. Enabling it..")
+            response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+            self.assertEqual(
+                        response.state,
+                        "Enabled",
+                        "Network service provider should be in enabled state"
+                         )
+        else:
+            self.debug("NetScaler service provider is already enabled.")
+
+        self.debug("Passing invalid public interface for NetScaler")
+        self.services["netscaler"]["publicinterface"] = random_gen()
+
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+
+        self.debug("Public interface: %s" %
+                                self.services["netscaler"]["publicinterface"])
+
+        with self.assertRaises(Exception):
+            NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_invalid_private_interface(self):
+        """Test add netscaler device with invalid private interface
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device into a Zone by providing valid log in
+        #    credentials , public interface and invalid private interface
+        # 2. Netscaler API should throw error
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=self.zone.id
+                                                 )
+        self.assertEqual(
+            isinstance(physical_networks, list),
+            True,
+            "There should be atleast one physical network for advanced zone"
+            )
+        physical_network = physical_networks[0]
+
+        self.debug("Checking if Netscaler network service provider is enabled?")
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        self.apiclient,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        self.assertEqual(
+                         isinstance(nw_service_providers, list),
+                         True,
+                         "Network service providers list should not be empty"
+                         )
+        netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            self.debug("Netscaler provider is not enabled. Enabling it..")
+            response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+            self.assertEqual(
+                        response.state,
+                        "Enabled",
+                        "Network service provider should be in enabled state"
+                         )
+        else:
+            self.debug("NetScaler service provider is already enabled.")
+
+        self.debug("Passing invalid private interface for NetScaler")
+        self.services["netscaler"]["privateinterface"] = random_gen()
+
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+
+        self.debug("Private interface: %s" %
+                                self.services["netscaler"]["privateinterface"])
+
+        with self.assertRaises(Exception):
+            NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        return
+
+
+class TestNetScalerDedicated(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetScalerDedicated,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_dedicated"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering_dedicated"],
+                                            conservemode=False,
+                                            state="Creating",
+                                            status="Creating",
+                                            allocationstate="Creating",
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_netscaler_dedicated_mode(self):
+        """Test netscaler device in dedicated mode
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device in dedicated mode.
+        # 2. Netscaler should be configured successfully.It should be able to
+        #    service only 1 account.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         True,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+
+        Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+	self.debug("Deploying an instance in account: %s" % self.account_2.account.name)
+        with self.assertRaises(Exception):
+        	VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+	self.debug("Deply instacne in dedicated Network offering mode failed")
+        return
+
+
+
+class TestNetScalerShared(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetScalerShared,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_netscaler_shared_mode(self):
+        """Test netscaler device in shared mode
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device in shared mode.
+        # 2. Netscaler should be configured successfully.It should be able to
+        #    service only 1 account.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_2 = Network.create(
+                                self.apiclient,
+                                self.services["network"],
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                networkofferingid=self.network_offering.id,
+                                zoneid=self.zone.id
+                                )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        return
+
+
+
+class TestNetScalerCustomCapacity(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetScalerCustomCapacity,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+        cls.services["netscaler"]["lbdevicecapacity"] = 2
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_3 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2, self.account_3]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_netscaler_custom_capacity(self):
+        """Test netscaler device with custom capacity
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device in shared mode with capacity 3
+        # 2. Netscaler should be configured successfully.It should be able to
+        #    service only 3 accounts.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_2 = Network.create(
+                                self.apiclient,
+                                self.services["network"],
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                networkofferingid=self.network_offering.id,
+                                zoneid=self.zone.id
+                                )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_3 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_3.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+        with self.assertRaises(Exception):
+            # Spawn an instance in that network
+            virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+        return
+
+
+
+class TestNetScalerNoCapacity(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetScalerNoCapacity,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+	cls.services["netscaler"]["lbdevicecapacity"] = 2
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_3 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2, self.account_3]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_netscaler_no_capacity(self):
+        """Test netscaler device with no capacity remaining
+        """
+
+        # Validate the following
+        # 1. Add Netscaler device in shared mode with capacity 2
+        # 2. Netscaler should be configured successfully.It should be able to
+        #    service only 2 accounts.
+        # 3. Deploy instance for account 3 should fail
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_2 = Network.create(
+                                self.apiclient,
+                                self.services["network"],
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                networkofferingid=self.network_offering.id,
+                                zoneid=self.zone.id
+                                )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_3 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_3.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+        with self.assertRaises(Exception):
+            # Spawn an instance in that network
+            virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+        return
+
+
+
+class TestGuestNetworkWithNetScaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestGuestNetworkWithNetScaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_guest_network(self):
+        """Implementing Guest Network when first VM gets deployed using the network having Netscaler as LB
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing. 
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3.Create a new account/user. 
+        # 4. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # In Netscaler:
+        # 1. Private interface of Netscaler device will be configured to make
+        #    it part of the virtual guest network by binding the interface to
+        #    the VLAN and subnet allocated for the virtual guest network
+        # 2. Private interface should be associated with a self-ip (second IP
+        #    in the subnet) from the guest subnet.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Find Network vlan used
+        network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network_1.id,
+                                    listall=True
+                                    )
+        nw = network_list[0]
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource "),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_guest_network_multiple(self):
+        """Implementing Guest Network when multiple VMs gets deployed using the network having Netscaler as LB
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing. 
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3.Create a new account/user. 
+        # 4. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # In Netscaler:
+        # 1. Private interface of Netscaler device will be configured to make
+        #    it part of the virtual guest network by binding the interface to
+        #    the VLAN and subnet allocated for the virtual guest network
+        # 2. Private interface should be associated with a self-ip (second IP
+        #    in the subnet) from the guest subnet.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_2 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_2.account.name,
+                                    domainid=self.account_2.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            # Find Network vlan used
+            network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network_1.id,
+                                    listall=True
+                                    )
+            nw = network_list[0]
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource "),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+
+            # Find Network vlan used
+            network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network_2.id,
+                                    listall=True
+                                    )
+            nw = network_list[0]
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_delete_account(self):
+        """Delete an account that has LB rules
+        """
+
+        # Validate the following
+        # 1. Acquire an ipaddress. Create multiple Lb rules on this ip address
+        # 2. Delete this account that has LB rules
+        # In Netscaler:
+        # 1. Private interface on the netscaler LB device will be unbound to
+        #    vlan and subnet
+        # 2. All the service instance and the servers that are part of this
+        #    vlan, that were created on the Netscaler device as part of
+        #    applying LB rules will be destroyed.
+        # 3. Any lb virtual server that is created using this public IP
+        #    allocated for the account will be destroyed
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Assigning public IP for the account: %s" %
+                                                self.account_1.account.name)
+        public_ip = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account_1.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account_1.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                            public_ip.ipaddress.ipaddress)
+
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account_1.account.name,
+                                    networkid=self.network.id
+                                )
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                                public_ip.ipaddress.ipaddress)
+        self.debug("Assigning VMs to LB rule")
+        lb_rule.assign(self.apiclient, [virtual_machine])
+
+        # Find Network vlan used
+        network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network.id,
+                                    listall=True
+                                    )
+        nw = network_list[0]
+
+        self.debug("Deleting account: %s" % self.account_1.account.name)
+        # This is a hack. Delete first account from cleanup list
+        self.cleanup.pop(0).delete(self.apiclient)
+        self.debug("Account: %s is deleted!" % self.account_1.account.name)
+
+        self.debug("Waiting for network.gc.interval & network.gc.wait..")
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+        wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value) + int(wait[0].value))
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+
+class TestGuestNetworkShutDown(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestGuestNetworkShutDown,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+
+        # Creating network using the network offering created
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+
+        # Spawn few instances in that network
+        cls.vm_1 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.vm_2 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls.lb_rule = LoadBalancerRule.create(
+                                    cls.api_client,
+                                    cls.services["lbrule"],
+                                    ipaddressid=cls.public_ip.ipaddress.id,
+                                    accountid=cls.account.account.name,
+                                    networkid=cls.network.id
+                                )
+        cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2])
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_stop_all_vms(self):
+        """Test Stopping all the Vms for any account that has LB rules.
+        """
+
+        # Validate the following
+        # 1. Acquire IP address and create a load balancer rule
+        # 2. Stop all VMs in the account that has LB rules
+        # 3. This will result in the network being shutdown. As part of this,
+        #    this account and the all the Lb rules for this account should get
+        #    removed from the Netscaler
+
+        # Find Network vlan used
+        network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network.id,
+                                    listall=True
+                                    )
+        nw = network_list[0]
+        self.debug("Network vlan used is: %s" % nw.vlan)
+
+        self.debug(
+            "Stopping all the VM instances for the account: %s" %
+                                                    self.account.account.name)
+
+        self.vm_1.stop(self.apiclient)
+        self.vm_2.stop(self.apiclient)
+
+        self.debug("Sleep for network.gc.interval + network.gc.wait")
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+        wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+        # Sleep to ensure that all resources are deleted
+        time.sleep((int(interval[0].value) + int(wait[0].value)) * 2)
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should not have vlan configured for the network"
+                    )
+
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        self.lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should not have vserver configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_start_one_vm(self):
+        """Test LB rules on Netscaler after starting one Vm in account
+        """
+
+        # Validate the following
+        # 1. Acquire IP address and create a load balancer rule
+        # 2. Stop all VMs in the account that has LB rules
+        # 3. This will result in the network being shutdown. As part of this,
+        #    this account and the all the Lb rules for this account should get
+        #    removed from the Netscaler
+        # 3. Start one of the VMs. LB rules should get reconfigured on
+        #    Netscaler
+
+        self.debug(
+            "starting one VM instances for the account: %s" %
+                                                    self.account.account.name)
+        self.vm_1.start(self.apiclient)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.vm_1.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VMs should return a valid list"
+                        )
+
+        for vm in vms:
+            self.assertEqual(
+                        vm.state,
+                        "Running",
+                        "VM instance should be Up and running after start"
+                        )
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            # Find Network vlan used
+            network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network.id,
+                                    listall=True
+                                    )
+            nw = network_list[0]
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource "),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        self.lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_network_restart_without_cleanup(self):
+        """Test LB rules on Netscaler after network restart without cleanup
+        """
+
+        # Validate the following
+        # 1. Acquire IP address and create a load balancer rule
+        # 2. Restart network->without cleanup option enabled
+        # 3. All existing Lb rules get added again to the netscaler. All the
+        #    existing LB rules should continue to work.
+
+        self.debug("Restarting the network: %s" % self.network.id)
+        self.network.restart(self.apiclient, cleanup=False)
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            # Find Network vlan used
+            network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network.id,
+                                    listall=True
+                                    )
+            nw = network_list[0]
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource "),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        self.lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_04_network_restart_with_cleanup(self):
+        """Test LB rules on Netscaler after network restart with cleanup
+        """
+
+        # Validate the following
+        # 1. Acquire IP address and create a load balancer rule
+        # 2. Restart network->with cleanup option enabled
+        # 3. All existing Lb rules get deleted and reconfigured again to the
+        #    netscaler. All the existing LB rules should continue to work.
+
+        self.debug("Restarting the network: %s" % self.network.id)
+        self.network.restart(self.apiclient, cleanup=True)
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            # Find Network vlan used
+            network_list = Network.list(
+                                    self.apiclient,
+                                    id=self.network.id,
+                                    listall=True
+                                    )
+            nw = network_list[0]
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show vlan %s" % (nw.vlan)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource "),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        self.lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+            # Output: ERROR: No such resource [id, 123]
+
+            self.assertNotEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Netscaler should have vlan configured for the network"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+
+class TestServiceProvider(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestServiceProvider,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            cls.netscaler_provider = nw_service_providers[0]
+
+        if cls.netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=cls.netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Enable the service provider
+            NetworkServiceProvider.update(
+                                      cls.api_client,
+                                      id=cls.netscaler_provider.id,
+                                      state='Enabled'
+                                    )
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_create_nw_off_disabled(self):
+        """Test create network with network offering disabled
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing. 
+        # 2. Create a Network offering. Do not enable the network offering
+        # 3. Try to create a network with this network offering.
+        # 4. Network creation should fail
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        with self.assertRaises(Exception):
+            Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                            )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_create_nw_sp_disabled(self):
+        """Test create network when service provider is disabled
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing. 
+        # 2. Disable the service provider. Create a Network offering.
+        # 3. Try to create a network. Network creation should fail
+
+        # Enable Network offering
+        self.network_offering.update(self.apiclient, state='Enabled')
+
+        # Disable the service provider
+        NetworkServiceProvider.update(
+                                      self.apiclient,
+                                      id=self.netscaler_provider.id,
+                                      state='Disabled'
+                                    )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        with self.assertRaises(Exception):
+            Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                            )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_create_lb_sp_disabled(self):
+        """Test create LB rules when service provider is disabled
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing. 
+        # 2. Create a Network offering. Create instances and acquire public Ip
+        # 3. Disabled service provider and again try to create LB rules
+        # 4.Deploy VM should fail
+
+        # Enable the service provider
+        NetworkServiceProvider.update(
+                                      self.apiclient,
+                                      id=self.netscaler_provider.id,
+                                      state='Enabled'
+                                    )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                            )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Acquiring a public IP for Network: %s" % self.network.name)
+        public_ip = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                            public_ip.ipaddress.ipaddress)
+
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                                public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug("Disabling Netscaler service provider")
+
+        # Disable the service provider
+        NetworkServiceProvider.update(
+                                      self.apiclient,
+                                      id=self.netscaler_provider.id,
+                                      state='Disabled'
+                                    )
+        with self.assertRaises(Exception):
+            self.debug("Deploying VM in the network: %s" % self.network.id)
+            LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+            VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        return
+
+
+
+class TestDeleteNetscaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDeleteNetscaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_delete_netscaler_with_lb(self):
+        """Test delete Netscaler when active LB rules are present
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing. 
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3.Create a new account/user. 
+        # 4. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 5. Attempt to delete Netscaler load balancer from zone.
+        #    Deletion should NOT be allowed.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Attempt to delete netscaler load balancer device")
+        with self.assertRaises(Exception):
+            self.netscaler.delete(self.apiclient)
+        self.debug("Attempt to delete Netscaler device failed!")
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_lb_algo.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_lb_algo.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_lb_algo.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_lb_algo.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2031 @@
+# 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.
+
+""" P1 tests for netscaler load balancing
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test netscaler services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                         },
+                         "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "netscaler": {
+                                "ipaddress": '192.168.100.213',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                "port": 22,
+                         },
+                         "network_offering": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                         },
+                         "network": {
+                                  "name": "Netscaler",
+                                  "displaytext": "Netscaler",
+                         },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "leastconn",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "openfirewall": False,
+                         },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'advanced'
+                    }
+
+
+class TestLbWithRoundRobin(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbWithRoundRobin,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.network_offering,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_with_round_robin(self):
+        """Test Create LB rule with round robin algorithm
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create LB rule with round robin algorithm
+        #    on it. Verify that "Roundrobin" algorithm is applied when using
+        #    this load balancing rule.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        self.virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbWithLeastConn(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbWithLeastConn,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        cls._cleanup = [
+                        cls.network_offering,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_with_least_conn(self):
+        """Test Create LB rule with least connection algorithm
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create LB rule with round robin algorithm
+        #    on it. Verify that "leastconn" algorithm is applied when using
+        #    this load balancing rule.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        self.virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+
+        PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'leastconn'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'LEASTCONNECTION' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbWithSourceIp(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbWithSourceIp,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.network_offering,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_with_source_ip(self):
+        """Test Create LB rule with source Ip algorithm
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create LB rule with round robin algorithm
+        #    on it. Verify that "sourceIp" algorithm is applied when using
+        #    this load balancing rule.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        self.virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'source'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCEIPHASH' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbAlgoRrLc(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbAlgoRrLc,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            # Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_round_robin_to_least_conn(self):
+        """Test edit LB rule from round robin to least connection algo
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create an Lb rule for couple of Vms using
+        #    "RounbRobin" algorithm. Make sure this algorithm is respected.
+        # 4. Edit this existing LB rule with "Round robin" algorithm to
+        #    "LeastConn" After the update, Verify that "least Connection"
+        #    algorithm is applied when using this load balancing rule.
+
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+
+        self.debug(
+                "Updating LB rule: %s with new algorithm: %s" % (
+                                                                lb_rule.name,
+                                                                'leastconn'))
+        lb_rule.update(self.apiclient, algorithm='leastconn')
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'LEASTCONNECTION' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbAlgoLcRr(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbAlgoLcRr,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            # Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_least_conn_to_round_robin(self):
+        """Test edit LB rule from least conn to round robin algo
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create an Lb rule for couple of Vms using
+        #    "Leastconn" algorithm. Make sure this algorithm is respected.
+        # 4. Edit this existing LB rule with "Least conn" algorithm to
+        #    "roundrobin" After the update, Verify that "round robin"
+        #    algorithm is applied when using this load balancing rule.
+
+        self.debug(
+            "Creating LB rule for IP address: %s with least conn algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'leastconn'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'LEASTCONNECTION' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+
+        self.debug(
+                "Updating LB rule: %s with new algorithm: %s" % (
+                                                                lb_rule.name,
+                                                                'roundrobin'))
+        lb_rule.update(self.apiclient, algorithm='roundrobin')
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbAlgoRrSb(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbAlgoRrSb,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            # Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_round_robin_to_source(self):
+        """Test edit LB rule from round robin to source algo
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create an Lb rule for couple of Vms using
+        #    "RounbRobin" algorithm. Make sure this algorithm is respected.
+        # 4. Edit this existing LB rule with "Round robin" algorithm to
+        #    "Source" After the update, Verify that "Source"
+        #    algorithm is applied when using this load balancing rule.
+
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+
+        self.debug(
+                "Updating LB rule: %s with new algorithm: %s" % (
+                                                                lb_rule.name,
+                                                                'source'))
+        lb_rule.update(self.apiclient, algorithm='source')
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCEIPHASH' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbAlgoSbRr(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbAlgoSbRr,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            # Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_source_to_round_robin(self):
+        """Test edit LB rule from source to round robin algo
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create an Lb rule for couple of Vms using
+        #    "source" algorithm. Make sure this algorithm is respected.
+        # 4. Edit this existing LB rule with "source" algorithm to
+        #    "roundrobin" After the update, Verify that "round robin"
+        #    algorithm is applied when using this load balancing rule.
+
+        self.debug(
+            "Creating LB rule for IP address: %s with source algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'source'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCEIPHASH' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+
+        self.debug(
+                "Updating LB rule: %s with new algorithm: %s" % (
+                                                                lb_rule.name,
+                                                                'roundrobin'))
+        lb_rule.update(self.apiclient, algorithm='roundrobin')
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbAlgoSbLc(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbAlgoSbLc,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            # Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_source_to_least_conn(self):
+        """Test edit LB rule from source to least conn algo
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create an Lb rule for couple of Vms using
+        #    "source" algorithm. Make sure this algorithm is respected.
+        # 4. Edit this existing LB rule with "source" algorithm to
+        #    "leastconn" After the update, Verify that "leastconn"
+        #    algorithm is applied when using this load balancing rule.
+
+        self.debug(
+            "Creating LB rule for IP address: %s with source algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'source'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCEIPHASH' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        self.debug(
+                "Updating LB rule: %s with new algorithm: %s" % (
+                                                                lb_rule.name,
+                                                                'leastconn'))
+        lb_rule.update(self.apiclient, algorithm='leastconn')
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'LEASTCONNECTION' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestLbAlgoLcSb(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbAlgoLcSb,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            # Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_leastconn_to_source(self):
+        """Test edit LB rule from round robin to source algo
+        """
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create an Lb rule for couple of Vms using
+        #    "leastconn" algorithm. Make sure this algorithm is respected.
+        # 4. Edit this existing LB rule with "leastconn" algorithm to
+        #    "Source" After the update, Verify that "Source"
+        #    algorithm is applied when using this load balancing rule.
+
+        self.debug(
+            "Creating LB rule for IP address: %s with leastconn algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'leastconn'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s to the LB rule %s" % (
+                                                self.virtual_machine.name,
+                                                lb_rule.name
+                                                ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'LEASTCONNECTION' algorithm should be configured on NS"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+
+        self.debug(
+                "Updating LB rule: %s with new algorithm: %s" % (
+                                                                lb_rule.name,
+                                                                'source'))
+        lb_rule.update(self.apiclient, algorithm='source')
+
+        self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCEIPHASH' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_lb.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_lb.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_lb.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_lb.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2964 @@
+# 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.
+
+""" P1 tests for netscaler load balancing
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test netscaler services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                         },
+                         "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "netscaler": {
+                                "ipaddress": '10.147.40.100',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                                "port": 22,
+                         },
+                         "network_offering_dedicated": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "specifyVlan": False,
+                                    "specifyIpRanges": False,
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                                    "servicecapabilitylist": {
+                                        "SourceNat": {
+                                            "SupportedSourceNatTypes": "peraccount"
+                                        },
+                                        "lb": {
+                                               "SupportedLbIsolation": "dedicated"
+                                        },
+                                    },
+                         },
+                         "network_offering": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                         },
+                         "network": {
+                                  "name": "Netscaler",
+                                  "displaytext": "Netscaler",
+                         },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "openfirewall": False,
+                         },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                         },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'advanced'
+                    }
+
+
+class TestLbSourceNat(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbSourceNat,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_add_lb_on_source_nat(self):
+        """Test Create LB rule for sourceNat IP address
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Create LB rule for the sourceNat IP address. User should NOT be
+        #    allowed to create an LB rule on source NAT
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        with self.assertRaises(Exception):
+            LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=src_nat.id,
+                                    accountid=self.account.account.name
+                                )
+        return
+
+
+class TestLbOnIpWithPf(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbOnIpWithPf,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_on_ip_with_pf(self):
+        """Test Create LB rule for sourceNat IP address
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Create LB rule on Ip with PF rule. User should NOT be
+        #    allowed to create an LB rule on Ip with PF
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_nat_rule = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=self.network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_nat_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        ip_with_nat_rule.ipaddress.ipaddress)
+        NATRule.create(
+                         self.apiclient,
+                         virtual_machine_1,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        self.debug("Trying to create LB rule on IP with NAT: %s" %
+                                    ip_with_nat_rule.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        with self.assertRaises(Exception):
+                LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_nat_rule.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        return
+
+
+class TestPfOnIpWithLb(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestPfOnIpWithLb,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_pf_on_ip_with_lb(self):
+        """Test Create a port forwarding rule  on an Ip address that already has a LB rule.
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Create PF rule on Ip with LB rule. User should NOT be
+        #    allowed to create an LB rule on Ip with LB
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Associating public IP for network: %s" % self.network.id)
+
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating LB rule for IP address: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        with self.assertRaises(Exception):
+            NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_lb_rule.ipaddress.id
+                      )
+        return
+
+
+class TestLbOnNonSourceNat(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbOnNonSourceNat,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=False
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_lb_on_non_source_nat(self):
+        """Test Create LB rule for non-sourceNat IP address
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create LB rule on it. LB rule should be
+        #    created successfully
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Associating public IP for network: %s" % self.network.id)
+
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating LB rule for IP address: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        return
+
+
+class TestAddMultipleVmsLb(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestAddMultipleVmsLb,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_add_multiple_vms_lb(self):
+        """Test Add multiple Vms to an existing LB rule.
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy another VM.
+        # 3. Acquire Ip address and create LB rule on it. Add multiple VMs to
+        #    this rule. LB rule should be
+        # In Netscaler: For every Vm added to the LB rule:
+        # 1. A server and service instance is created using guest VM’s IP and
+        #    port number on the Netscaler LB device,
+        # 2. This service is bound to lb virtual server corresponding to lb
+        #    rule.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Associating public IP for network: %s" % self.network.id)
+
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating LB rule for IP address: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Assigning virtual machines to LB rule")
+        lb_rule.assign(self.apiclient, [virtual_machine_1, virtual_machine_2])
+
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    22,
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            self.debug("command: show server")
+            res = ssh_client.execute("show server")
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(virtual_machine_1.ipaddress),
+                    2,
+                    "Server must be configured for virtual machines"
+                    )
+            self.assertEqual(
+                    result.count(virtual_machine_2.ipaddress),
+                    2,
+                    "Server must be configured for virtual machines"
+                    )
+
+            self.debug("Command:show service")
+            res = ssh_client.execute("show service")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(virtual_machine_1.ipaddress),
+                    3,
+                    "Service must be configured for virtual machines"
+                    )
+            self.assertEqual(
+                    result.count(virtual_machine_2.ipaddress),
+                    3,
+                    "Service must be configured for virtual machines"
+                    )
+            self.debug("Command:show lb vserver")
+            res = ssh_client.execute("show lb vserver")
+
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(ip_with_lb_rule.ipaddress.ipaddress),
+                    2,
+                    "virtual server must be configured for public IP address"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+class TestMultipleLbRules(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestMultipleLbRules,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_multiple_lb_publicip(self):
+        """Test Create multiple LB rules using different public Ips acquired
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy few more VMs.
+        # 3. Acquire an Ipaddress and create an LB rule for multiple Vms.
+        #    Repeat step2 for few times Requests to all these LB rules should
+        #    be serviced correctly.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug(
+                "Associating first public IP for network: %s" %
+                                                            self.network.id)
+
+        public_ip_1 = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        public_ip_1.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        public_ip_1.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip_1.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s, %s to the LB rule %s" % (
+                                                    virtual_machine_1.name,
+                                                    virtual_machine_2.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [virtual_machine_1, virtual_machine_2])
+
+        self.debug(
+                "Associating second public IP for network: %s" %
+                                                            self.network.id)
+
+        public_ip_2 = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        public_ip_2.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        public_ip_2.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip_2.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        public_ip_2.ipaddress.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s, %s to the LB rule %s" % (
+                                                    virtual_machine_1.name,
+                                                    virtual_machine_2.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [virtual_machine_1, virtual_machine_2])
+
+        try:
+            self.debug(
+                    "Verifying VMs are accessible with different public Ips")
+            hostnames = []
+            ssh = virtual_machine_1.get_ssh_client(
+                                ipaddress=public_ip_1.ipaddress.ipaddress)
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            res = str(result[0])
+            self.assertIn(
+                res,
+                [virtual_machine_1.name, virtual_machine_2.name],
+                "The hostname should match with atleast one of instance name"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        public_ip_1.ipaddress.ipaddress,
+                                        e))
+        try:
+            ssh = virtual_machine_1.get_ssh_client(
+                                ipaddress=public_ip_2.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            res = str(result[0])
+            self.assertIn(
+                res,
+                [virtual_machine_1.name, virtual_machine_2.name],
+                "The hostname should match with atleast one of instance name"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        public_ip_2.ipaddress.ipaddress,
+                                        e))
+        return
+
+
+class TestMultipleLbRulesSameIp(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestMultipleLbRulesSameIp,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_multiple_lb_same_publicip(self):
+        """Test Create multiple LB rules using same public Ips on diff ports
+        """
+
+
+        # Validate the following
+        # 1. Deploy the first VM using a network from the above created
+        #    Network offering.
+        # 2. Deploy few more VMs.
+        # 3. Acquire an Ipaddress and create an LB rule for multiple Vms.
+        #    Create another Lb rule on the same Ipaddress pointing to
+        #    different public port. Requests to all these LB rules should be
+        #    serviced correctly.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Deploying another VM in account: %s" %
+                                            self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug(
+                "Associating first public IP for network: %s" %
+                                                            self.network.id)
+
+        public_ip = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        lb_rule_1 = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        public_ip.ipaddress.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule_1.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s, %s to the LB rule %s" % (
+                                                    virtual_machine_1.name,
+                                                    virtual_machine_2.name,
+                                                    lb_rule_1.name
+                                                    ))
+        lb_rule_1.assign(self.apiclient, [
+                                          virtual_machine_1,
+                                          virtual_machine_2
+                                          ])
+        self.debug(
+            "Trying to create LB rule on IP: %s with on same ports" %
+                                                public_ip.ipaddress.ipaddress)
+        with self.assertRaises(Exception):
+            LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.debug("Create LB rule on same port failed!")
+        self.debug("Creating LB rule on IP: %s & public port: %s" % (
+                                                public_ip.ipaddress.ipaddress,
+                                                str(2222)))
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        self.services["lbrule"]["publicport"] = 2222
+        self.services["lbrule"]["name"] = 'SSH2'
+        lb_rule_2 = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule_2.id,
+                                         listall=True
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return a newly created LB rule"
+                         )
+        self.debug("Adding %s, %s to the LB rule %s" % (
+                                                    virtual_machine_1.name,
+                                                    virtual_machine_2.name,
+                                                    lb_rule_2.name
+                                                    ))
+        lb_rule_2.assign(self.apiclient, [
+                                          virtual_machine_1,
+                                          virtual_machine_2
+                                          ])
+
+        try:
+            self.debug("Verifying VMs are accessible on all LB rules")
+            hostnames = []
+            ssh = virtual_machine_1.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress,
+                                    reconnect=True
+                                    )
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            res = str(result[0])
+            self.assertIn(
+                res,
+                [virtual_machine_1.name, virtual_machine_2.name],
+                "The hostname should match with atleast one of instance name"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        e))
+        try:
+            ssh = virtual_machine_1.get_ssh_client(
+                                ipaddress=public_ip.ipaddress.ipaddress,
+                                reconnect=True,
+                                port=self.services["lbrule"]["publicport"]
+                                )
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            res = str(result[0])
+            self.assertIn(
+                res,
+                [virtual_machine_1.name, virtual_machine_2.name],
+                "The hostname should match with atleast one of instance name"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        e))
+        return
+
+
+class TestLoadBalancingRule(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLoadBalancingRule,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+
+        # Creating network using the network offering created
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls.lb_rule = LoadBalancerRule.create(
+                                    cls.api_client,
+                                    cls.services["lbrule"],
+                                    ipaddressid=cls.public_ip.ipaddress.id,
+                                    accountid=cls.account.account.name,
+                                    networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_edit_name_lb_rule(self):
+        """Test edit name of LB rule
+        """
+
+
+        # Validate the following
+        # 1. Create an Lb rule for couple of Vms .
+        # 2. Edit the name of the existing LB rule. When all the existing
+        #    Lbrules are listed , we should see the edited name.
+
+        self.debug("Assigning VMs to LB rule: %s" % self.lb_rule.name)
+        self.lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        self.debug("Editing name of the LB rule: %s" % self.lb_rule.name)
+        new_name = random_gen()
+        self.lb_rule.update(self.apiclient, name=new_name)
+
+        self.debug("Verifing the name change in list Lb rules call")
+        lb_rules = LoadBalancerRule.list(self.apiclient, id=self.lb_rule.id)
+
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB call should return a valid list"
+                         )
+        lb = lb_rules[0]
+        self.assertEqual(
+                         lb.name,
+                         new_name,
+                         "LB name should be updated with the new name"
+                         )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_edit_lb_ports(self):
+        """Test edit public port of LB rule
+        """
+
+
+        # Validate the following
+        # 1. Create an Lb rule for couple of Vms .
+        # 2. Edit the public/private of the existing LB rule. When all the
+        #    existing Lbrules are listed, this should not be allowed.
+
+        self.debug("Editing public port of the LB rule: %s" % self.lb_rule.name)
+        port = 8888
+        with self.assertRaises(Exception):
+            self.lb_rule.update(self.apiclient, publicport=port)
+
+        self.debug("Editing private port of the LB rule: %s" % self.lb_rule.name)
+        with self.assertRaises(Exception):
+            self.lb_rule.update(self.apiclient, privateport=port)
+
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_delete_lb_rule(self):
+        """Test delete LB rule
+        """
+
+
+        # Validate the following
+        # 1. Delete existing load balancing rule
+        # 2. In netscaler service and port corresponding to LB rule should get
+        #    deleted. Any request to IP should error out.
+
+        self.debug("Deleting existing load balancing rule")
+        self.lb_rule.delete(self.apiclient)
+
+        self.debug("SSH into Netscaler to verify other resources are deleted")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        self.lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Virtual server should get deleted after removing LB rule"
+                    )
+
+            cmd = "show ip"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(self.public_ip.ipaddress.ipaddress),
+                    0,
+                    "Virtual server should get deleted after removing LB rule"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+
+@unittest.skip("Questions - How to verify after changing public/private ports?")
+class TestDeleteCreateLBRule(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDeleteCreateLBRule,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+
+        # Creating network using the network offering created
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_create_with_same_public_port(self):
+        """Test create LB rule with same public port after deleting rule"""
+
+
+        # Validate the following
+        # 1. Delete existing rule and create exactly same rule with different
+        #    public port
+        # 2. Requests should be served correctly
+
+        self.debug("Delete the existing LB rule: %s" % self.lb_rule.name)
+        self.lb_rule.delete(self.apiclient)
+        self.debug("LB rule deleted")
+
+        self.debug("Create a new LB rule with different public port")
+        self.services["lbrule"]["publicport"] = 23
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+
+class TestVmWithLb(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVmWithLb,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+
+        # Creating network using the network offering created
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+
+        # Spawn an instance in that network
+        cls.vm_1 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.vm_2 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip_1 = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls.lb_rule_1 = LoadBalancerRule.create(
+                                    cls.api_client,
+                                    cls.services["lbrule"],
+                                    ipaddressid=cls.public_ip_1.ipaddress.id,
+                                    accountid=cls.account.account.name,
+                                    networkid=cls.network.id
+                                )
+        cls.public_ip_2 = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls.lb_rule_2 = LoadBalancerRule.create(
+                                    cls.api_client,
+                                    cls.services["lbrule"],
+                                    ipaddressid=cls.public_ip_2.ipaddress.id,
+                                    accountid=cls.account.account.name,
+                                    networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_delete_public_ip(self):
+        """Test delete one public Ip with LB rules"""
+
+
+        # Validate the following
+        # 1. Associate 2 public Ips and create load balancing rules in it
+        # 2. Delete one of the public Ip
+        # 3. All the LB rules should be removed from that public Ip
+        # 4. In netscaler, make sure that all LB rules associated with that
+        #    public Ip should get removed.
+        # 5. All servers and services service to that public Ip get deleted
+
+        self.debug("Deleting public IP: %s from network: %s" % (
+                                        self.public_ip_2.ipaddress.ipaddress,
+                                        self.network.name
+                                        ))
+        self.public_ip_2.delete(self.apiclient)
+        self.debug(
+                "Public Ip: %s is deleted!" %
+                                        self.public_ip_2.ipaddress.ipaddress)
+        lb_rules = LoadBalancerRule.list(
+                                    self.apiclient,
+                                    publicipid=self.public_ip_2.ipaddress.id,
+                                    listall=True,
+                                )
+        self.assertEqual(
+                lb_rules,
+                None,
+                "LB rules associated with the public Ip should get deleted"
+                )
+        self.debug("SSH into Netscaler to verify other resources are deleted")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip_2.ipaddress.ipaddress,
+                                        self.lb_rule_2.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Virtual server should get deleted after removing LB rule"
+                    )
+
+            cmd = "show ip"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(self.public_ip_2.ipaddress.ipaddress),
+                    0,
+                    "Virtual server should get deleted after removing LB rule"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_stop_user_vm(self):
+        """Test stop user VM with LB"""
+
+
+        # Validate the following
+        # 1. Create 2 instances and add these two for load balancing
+        # 2. Stop one of the user VM
+        # 3. Test whether the request are not sent to stopped user VM
+        # 4. In netscaler, LB rules for this VM  still remain configured.But
+        #    it will be marked as being down
+
+        self.debug("Adding instances: %s, %s to LB rule: %s" % (
+                                                        self.vm_1.name,
+                                                        self.vm_2.name,
+                                                        self.lb_rule_1.name))
+        self.lb_rule_1.assign(self.apiclient, [self.vm_1, self.vm_2])
+        self.debug("Assigned instances: %s, %s to LB rule: %s" % (
+                                                        self.vm_1.name,
+                                                        self.vm_2.name,
+                                                        self.lb_rule_1.name))
+        self.debug("Stopping VM instance: %s" % self.vm_2.name)
+        self.vm_2.stop(self.apiclient)
+        self.debug("Stopped VM: %s" % self.vm_2.name)
+
+        try:
+            self.debug(
+                "Verifying request served by only running instances")
+            hostnames = []
+            ssh = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress)
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            ssh = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            self.assertEqual(
+                    hostnames[0],
+                    hostnames[1],
+                    "Hostnames must be same as another VM is stopped"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        e))
+        self.debug("SSH into Netscaler to rules still persist")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+
+            cmd = "show server"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertNotEqual(
+                    result.count(self.vm_2.ipaddress),
+                    0,
+                    "The server should be present in netscaler after VM stop"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_start_user_vm(self):
+        """Test start user VM with LB"""
+
+
+        # Validate the following
+        # 1. Create 2 instances and add these two for load balancing
+        # 2. Stop one of the user VM
+        # 3. Test whether the request are not sent to stopped user VM
+        # 4. In netscaler, LB rules for this VM  still remain configured.But
+        #    it will be marked as being down
+
+        self.debug("Starting VM instance: %s" % self.vm_2.name)
+        self.vm_2.start(self.apiclient)
+        self.debug("Starting VM: %s" % self.vm_2.name)
+
+        try:
+            self.debug(
+                "Verifying request served by only running instances")
+            hostnames = []
+            ssh_1 = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress)
+            self.debug("Command: hostname")
+            result = ssh_1.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            ssh_2 = self.vm_2.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh_2.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            self.assertNotEqual(
+                    hostnames[0],
+                    hostnames[1],
+                    "Both request should be served by different instances"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        e))
+        self.debug("SSH into Netscaler to rules still persist")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+
+            cmd = "show server"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertNotEqual(
+                    result.count(self.vm_2.ipaddress),
+                    0,
+                    "The server should be present in netscaler after VM stop"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns", "multihost"])
+    def test_04_migrate_user_vm(self):
+        """Test migrate user VM with LB"""
+
+
+        # Validate the following
+        # 1. Create 2 instances and add these two for load balancing
+        # 2. migrate one Vm to another host.
+        # 3. Test whether the request are sent to stopped user VM after migrate
+        # 4. In netscaler, the LB rules are still configured.
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.vm_2.zoneid,
+                          type='Routing'
+                          )
+
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "Check the number of hosts in the zone"
+                         )
+        self.assertGreaterEqual(
+                len(hosts),
+                2,
+                "Atleast 2 hosts should be present in a zone for VM migration"
+                )
+
+        # Remove the host of current VM from the hosts list
+        hosts[:] = [host for host in hosts if host.id != self.vm_2.hostid]
+
+        host = hosts[0]
+        self.debug("Migrating VM-ID: %s to Host: %s" % (self.vm_2.id, host.id))
+
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.hostid = host.id
+        cmd.virtualmachineid = self.vm_2.id
+        self.apiclient.migrateVirtualMachine(cmd)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.vm_2.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.hostid,
+                            host.id,
+                            "Check destination hostID of migrated VM"
+                        )
+        self.debug("Migrated VM-ID: %s to Host: %s" % (self.vm_2.id, host.id))
+        try:
+            self.debug(
+                "Verifying request served by only running instances")
+            hostnames = []
+            ssh_1 = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh_1.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            ssh_2 = self.vm_2.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh_2.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            self.assertNotEqual(
+                    hostnames[0],
+                    hostnames[1],
+                    "Both request should be served by different instances"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        e))
+        self.debug("SSH into Netscaler to rules still persist")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+
+            cmd = "show server"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertNotEqual(
+                    result.count(self.vm_2.ipaddress),
+                    0,
+                    "The server should be present in netscaler after migrate"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_05_reboot_user_vm(self):
+        """Test reboot user VM with LB"""
+
+
+        # Validate the following
+        # 1. Create 2 instances and add these two for load balancing
+        # 2. Reboot one of the user VM
+        # 3. Test whether the request are sent to both VMs after reboot
+        # 4. In netscaler, LB rules for this VM  still remain configured.
+
+        self.debug("Rebooting VM instance: %s" % self.vm_2.name)
+        self.vm_2.reboot(self.apiclient)
+        self.debug("Rebooting VM: %s" % self.vm_2.name)
+
+        try:
+            self.debug(
+                "Verifying request served by only running instances")
+            hostnames = []
+            ssh_1 = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress)
+            self.debug("Command: hostname")
+            result = ssh_1.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            ssh_2 = self.vm_2.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh_2.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            self.assertNotEqual(
+                    hostnames[0],
+                    hostnames[1],
+                    "Both request should be served by different instances"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        e))
+        self.debug("SSH into Netscaler to rules still persist")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+
+            cmd = "show server"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertNotEqual(
+                    result.count(self.vm_2.ipaddress),
+                    0,
+                    "The server should be present in netscaler after reboot"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_06_destroy_user_vm(self):
+        """Test destroy user VM with LB"""
+
+
+        # Validate the following
+        # 1. Create 2 instances and add these two for load balancing
+        # 2. Destroy one of the user VM
+        # 3. Until the time the Vm is in "Destroyed" state, the servies
+        #    relating to this Vm will be marked as "Down".
+        # 4. Once the Vm gets expunged, then the servers and services
+        #    associated with this VM should get deleted and the LB rules
+        #    should not be pointing to this Vm anymore.
+
+        self.debug("Destroying VM instance: %s" % self.vm_2.name)
+        self.vm_2.delete(self.apiclient)
+        self.debug("Destroying VM: %s" % self.vm_2.name)
+
+        try:
+            self.debug(
+                "Verifying request served by only running instances")
+            hostnames = []
+            ssh = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress)
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+
+            ssh = self.vm_1.get_ssh_client(
+                                ipaddress=self.public_ip_1.ipaddress.ipaddress,
+                                reconnect=True
+                                )
+            self.debug("Command: hostname")
+            result = ssh.execute("hostname")
+            self.debug("Output: %s" % result)
+            hostnames.append(result)
+            self.debug("Hostnames: %s" % str(hostnames))
+
+            self.assertEqual(
+                    hostnames[0],
+                    hostnames[1],
+                    "Both request should be served by same instance"
+                )
+        except Exception as e:
+            self.fail("Exception occured during SSH: %s - %s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        e))
+        delay = list_configurations(
+                                    self.apiclient,
+                                    name='expunge.delay'
+                                    )
+        wait = list_configurations(
+                                    self.apiclient,
+                                    name='expunge.interval'
+                                    )
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(delay[0].value) + int(wait[0].value))
+        self.debug("SSH into Netscaler to rules still persist")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+
+            cmd = "show server"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(self.vm_2.ipaddress),
+                    0,
+                    "The server should not be present in netscaler after destroy"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_07_delete_all_public_ip(self):
+        """Test delete all public Ip with LB rules"""
+
+
+        # Validate the following
+        # 1. Associate 2 public Ips and create load balancing rules in it
+        # 2. Delete all of the public Ip
+        # 3. All the LB rules should be removed from that public Ip
+        # 4. In netscaler, make sure that all LB rules associated with that
+        #    public Ip should get removed.
+        # 5. All servers and services service to that public Ip get deleted
+
+        self.debug("Deleting public IP: %s from network: %s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        self.network.name
+                                        ))
+        self.public_ip_1.delete(self.apiclient)
+        self.debug(
+                "Public Ip: %s is deleted!" %
+                                        self.public_ip_1.ipaddress.ipaddress)
+        lb_rules = LoadBalancerRule.list(
+                                    self.apiclient,
+                                    publicipid=self.public_ip_1.ipaddress.id,
+                                    listall=True,
+                                )
+        self.assertEqual(
+                lb_rules,
+                None,
+                "LB rules associated with the public Ip should get deleted"
+                )
+        self.debug("SSH into Netscaler to verify other resources are deleted")
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip_1.ipaddress.ipaddress,
+                                        self.lb_rule_1.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("ERROR: No such resource"),
+                    1,
+                    "Virtual server should get deleted after removing LB rule"
+                    )
+
+            cmd = "show ip"
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count(self.public_ip_1.ipaddress.ipaddress),
+                    0,
+                    "Virtual server should get deleted after removing LB rule"
+                    )
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_lb_sticky.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_lb_sticky.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_lb_sticky.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_lb_sticky.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1033 @@
+# 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.
+
+
+""" P1 tests for netscaler load balancing sticky policy
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test netscaler services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                         },
+                         "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "netscaler": {
+                                "ipaddress": '192.168.100.213',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                                "port": 22,
+                         },
+                         "network_offering": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList" : {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                         },
+                         "network": {
+                                  "name": "Netscaler",
+                                  "displaytext": "Netscaler",
+                         },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "openfirewall": False,
+                         },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode":'advanced'
+                    }
+
+
+class TestLbStickyPolicy(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLbStickyPolicy,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+
+        # Creating network using the network offering created
+        cls.network = Network.create(
+                                    cls.api_client,
+                                    cls.services["network"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    networkofferingid=cls.network_offering.id,
+                                    zoneid=cls.zone.id
+                                    )
+
+        # Spawn an instance in that network
+        cls.virtual_machine = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.account.name,
+                                  domainid=cls.account.account.domainid,
+                                  serviceofferingid=cls.service_offering.id,
+                                  networkids=[str(cls.network.id)]
+                                  )
+        cls.public_ip = PublicIPAddress.create(
+                                cls.api_client,
+                                accountid=cls.account.account.name,
+                                zoneid=cls.zone.id,
+                                domainid=cls.account.account.domainid,
+                                networkid=cls.network.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cls.network_offering.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_source_based_roundrobin(self):
+        """Test Create a "SourceBased" stick policy for a Lb rule with "RoundRobin" algorithm
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "SourceBased" stick policy for a Lb rule with
+        #    "RoundRobin" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                                          self.apiclient,
+                                          methodname='SourceBased',
+                                          name='SourceBasedRR',
+                                          param={"holdtime": 20}
+                                          )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: SOURCEIP"),
+                    1,
+                    "'SourceBased' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_source_based_source_algo(self):
+        """Test Create a "SourceBased" stick policy for a Lb rule with "Source" algorithm
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "SourceBased" stick policy for a Lb rule with
+        #    "Source" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with source algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'source'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='SourceBased',
+                             name='SourceBasedSource',
+                             param={"holdtime": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: SOURCEIP"),
+                    1,
+                    "'SourceBased' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCE' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_source_based_leastconn(self):
+        """Test Create a "SourceBased" stick policy for a Lb rule with leastconn algo
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "SourceBased" stick policy for a Lb rule with
+        #    "leastconn" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with leastconn algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'leastconn'
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='SourceBased',
+                             name='SourceBasedLeast',
+                             param={"holdtime": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: SOURCEIP"),
+                    1,
+                    "'SourceBased' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'leastconn' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_04_lbcookie_based_roundrobin(self):
+        """Test Create a "LBCookie" stick policy for a Lb rule with roundrobin algo
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "LBCookie" stick policy for a Lb rule with
+        #    "roundrobin" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with roundrobin algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        self.services["lbrule"]["publicport"] = 80
+        self.services["lbrule"]["privateport"] = 80
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='LbCookie',
+                             name='LbCookieRR',
+                             param={"holdtime": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: COOKIEINSERT"),
+                    1,
+                    "'LBCookie' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_05_lbcookie_source_algo(self):
+        """Test Create a "LBCookie" stick policy for a Lb rule with "Source" algorithm
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "LBCookie" stick policy for a Lb rule with
+        #    "Source" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with source algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'source'
+        self.services["lbrule"]["publicport"] = 80
+        self.services["lbrule"]["privateport"] = 80
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='LbCookie',
+                             name='LbCookieSource',
+                             param={"holdtime": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: COOKIEINSERT"),
+                    1,
+                    "'LbCookie' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCE' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_06_lbcookie_leastconn(self):
+        """Test Create a "LBCookie" stick policy for a Lb rule with leastconn algo
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "LBCookie" stick policy for a Lb rule with
+        #    "leastconn" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with leastconn algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'leastconn'
+        self.services["lbrule"]["publicport"] = 80
+        self.services["lbrule"]["privateport"] = 80
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='LBCookie',
+                             name='LbcookieLeastConn',
+                             param={"holdtime": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: COOKIEINSERT"),
+                    1,
+                    "'LbCookie' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'leastconn' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_07_appcookie_based_roundrobin(self):
+        """Test Create a "AppCookie" stick policy for a Lb rule with roundrobin algo
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "AppCookie" stick policy for a Lb rule with
+        #    "roundrobin" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with roundrobin algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'roundrobin'
+        self.services["lbrule"]["publicport"] = 80
+        self.services["lbrule"]["privateport"] = 80
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='AppCookie',
+                             name='AppCookieRR',
+                             param={"name": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: RULE"),
+                    1,
+                    "'AppCookie' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: ROUNDROBIN"),
+                    1,
+                    "'ROUNDROBIN' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_08_appcookie_source_algo(self):
+        """Test Create a "AppCookie" stick policy for a Lb rule with "Source"
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "AppCookie" stick policy for a Lb rule with
+        #    "Source" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with source algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'source'
+        self.services["lbrule"]["publicport"] = 80
+        self.services["lbrule"]["privateport"] = 80
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='AppCookie',
+                             name='AppCookieSource',
+                             param={"name": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: RULE"),
+                    1,
+                    "'AppCookie' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: SOURCEIPHASH"),
+                    1,
+                    "'SOURCE' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_09_appcookie_leastconn(self):
+        """Test Create a "AppCookie" stick policy for a Lb rule with leastconn
+        """
+
+        # Validate the following
+        # 1. Configure Netscaler for load balancing.
+        # 2. Create a Network offering with LB services provided by Netscaler
+        #    and all other services by VR.
+        # 3. Create a new account/user.
+        # 4. Deploy few VMs using a network from the above created Network
+        #    offering.
+        # 5. Create a "AppCookie" stick policy for a Lb rule with
+        #    "leastconn" algorithm
+
+        self.debug(
+            "Creating LB rule for IP address: %s with leastconn algo" %
+                                        self.public_ip.ipaddress.ipaddress)
+
+        self.services["lbrule"]["alg"] = 'leastconn'
+        self.services["lbrule"]["publicport"] = 80
+        self.services["lbrule"]["privateport"] = 80
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+        self.cleanup.append(lb_rule)
+        self.debug("Created the load balancing rule for public IP: %s" %
+                                            self.public_ip.ipaddress.ipaddress)
+
+        self.debug("Assigning VM instance: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+        self.debug("Assigned VM instance: %s to lb rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.name
+                                                    ))
+        self.debug(
+            "Configuring 'SourceBased' Sticky policy on lb rule: %s" %
+                                                                lb_rule.name)
+        try:
+            result = lb_rule.createSticky(
+                             self.apiclient,
+                             methodname='AppCookie',
+                             name='AppCookieLeastConn',
+                             param={"name": 20}
+                             )
+            self.debug("Response: %s" % result)
+        except Exception as e:
+            self.fail("Configure sticky policy failed with exception: %s" % e)
+
+        self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+        self.debug("SSH into netscaler: %s" %
+                                    self.services["netscaler"]["ipaddress"])
+        try:
+            ssh_client = remoteSSHClient(
+                                    self.services["netscaler"]["ipaddress"],
+                                    self.services["netscaler"]["port"],
+                                    self.services["netscaler"]["username"],
+                                    self.services["netscaler"]["password"],
+                                    )
+            cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
+                                        self.public_ip.ipaddress.ipaddress,
+                                        lb_rule.publicport)
+            self.debug("command: %s" % cmd)
+            res = ssh_client.execute(cmd)
+            result = str(res)
+            self.debug("Output: %s" % result)
+
+            self.assertEqual(
+                    result.count("Persistence: RULE"),
+                    1,
+                    "'AppCookie' sticky policy should be configured on NS"
+                    )
+
+            self.assertEqual(
+                    result.count("Configured Method: LEASTCONNECTION"),
+                    1,
+                    "'leastconn' algorithm should be configured on NS"
+                    )
+
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.services["netscaler"]["ipaddress"], e))
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_nw_off.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_nw_off.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_netscaler_nw_off.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_netscaler_nw_off.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2369 @@
+# 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.
+""" P1 tests for multiple netscaler instances
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test netscaler Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 128,      # In MBs
+                         },
+                         "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "netscaler_1": {
+                                "ipaddress": '192.168.100.213',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                                "port": 22,
+                         },
+                         "netscaler_2": {
+                                "ipaddress": '192.168.100.100',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                                "port": 22,
+                         },
+                         "netscaler_3": {
+                                "ipaddress": '192.168.100.101',
+                                "username": 'nsroot',
+                                "password": 'nsroot',
+                                "networkdevicetype": 'NetscalerVPXLoadBalancer',
+                                "publicinterface": '1/1',
+                                "privateinterface": '1/1',
+                                "numretries": 2,
+                                "lbdevicededicated": False,
+                                "lbdevicecapacity": 50,
+                                "port": 22,
+                         },
+                         "network_offering_dedicated": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "specifyVlan": False,
+                                    "specifyIpRanges": False,
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                                    "servicecapabilitylist": {
+                                        "SourceNat": {
+                                            "SupportedSourceNatTypes": "peraccount"
+                                        },
+                                        "lb": {
+                                               "SupportedLbIsolation": "dedicated"
+                                        },
+                                    },
+                         },
+                         "network_offering": {
+                                    "name": 'Netscaler',
+                                    "displaytext": 'Netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                    },
+                         },
+                         "network": {
+                                  "name": "Netscaler",
+                                  "displaytext": "Netscaler",
+                         },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "openfirewall": False,
+                         },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'advanced'
+                    }
+
+
+class TestAddMultipleNetScaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestAddMultipleNetScaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_add_netscaler_device(self):
+        """Test add netscaler device
+        """
+
+
+        # Validate the following
+        # 1. Add multiple instances of netscaler
+        # 2. Netscaler should be configured successfully.
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=self.zone.id
+                                                 )
+        self.assertEqual(
+            isinstance(physical_networks, list),
+            True,
+            "There should be atleast one physical network for advanced zone"
+            )
+        physical_network = physical_networks[0]
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler_1"]["ipaddress"])
+        netscaler_1 = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler_1"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        self.cleanup.append(netscaler_1)
+        self.debug("Checking if Netscaler network service provider is enabled?")
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        self.apiclient,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        self.assertEqual(
+                         isinstance(nw_service_providers, list),
+                         True,
+                         "Network service providers list should not be empty"
+                         )
+        netscaler_provider = nw_service_providers[0]
+        if netscaler_provider.state != 'Enabled':
+            self.debug("Netscaler provider is not enabled. Enabling it..")
+            response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+            self.assertEqual(
+                        response.state,
+                        "Enabled",
+                        "Network service provider should be in enabled state"
+                         )
+        else:
+            self.debug("Netscaler service provider is already enabled.")
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=netscaler_1.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        self.assertEqual(
+            ns.physicalnetworkid,
+            physical_network.id,
+            "Physical network id should match with the network in which device is configured"
+            )
+
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler_2"]["ipaddress"])
+        netscaler_2 = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler_2"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        self.cleanup.append(netscaler_2)
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=netscaler_1.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        self.assertEqual(
+            ns.physicalnetworkid,
+            physical_network.id,
+            "Physical network id should match with the network in which device is configured"
+            )
+        self.debug("Another Netscaler device is added!")
+        return
+
+
+class TestAddMultipleNSDiffZone(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestAddMultipleNSDiffZone,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns", "multizone"])
+    def test_add_mul_netscaler_diff_zone(self):
+        """Test add netscaler devices in different zones
+        """
+
+
+        # Validate the following
+        # 1. Add multiple instances of Netscaler in different zones
+        # 2. Netscaler should be configured successfully.
+
+        # Check if there are multiple zones present in the given setup
+        zones = Zone.list(self.apiclient, listall=True)
+        self.assertEqual(
+                         isinstance(zones, list),
+                         True,
+                         "List Zones API should return a valid list"
+                         )
+
+        # Find the number of zones configured in advanced mode
+        zone_list = []
+        for zone in zones:
+            if zone.networktype == 'Advanced':
+                zone_list.append(zone)
+
+        self.assertGreater(
+                           len(zone_list),
+                           1,
+                           "Atleast 2 advanced mode zones should be present for this test"
+                           )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=zone_list[0].id
+                                                 )
+        self.assertEqual(
+                isinstance(physical_networks, list),
+                True,
+                "There should be atleast one physical network for advanced zone"
+                )
+        physical_network = physical_networks[0]
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler_1"]["ipaddress"])
+        netscaler = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler_1"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        self.cleanup.append(netscaler_1)
+        self.debug("Checking if Netscaler network service provider is enabled?")
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        self.apiclient,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        self.assertEqual(
+                         isinstance(nw_service_providers, list),
+                         True,
+                         "Network service providers list should not be empty"
+                         )
+        netscaler_provider = nw_service_providers[0]
+        if netscaler_provider.state != 'Enabled':
+            self.debug("Netscaler provider is not enabled. Enabling it..")
+            response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+            self.assertEqual(
+                        response.state,
+                        "Enabled",
+                        "Network service provider should be in enabled state"
+                         )
+        else:
+            self.debug("Netscaler service provider is already enabled.")
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=netscaler_1.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        self.assertEqual(
+            ns.physicalnetworkid,
+            physical_network.id,
+            "Physical network id should match with the network in which device is configured"
+            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 self.apiclient,
+                                                 zoneid=zone_list[1].id
+                                                 )
+        self.assertEqual(
+                isinstance(physical_networks, list),
+                True,
+                "There should be atleast one physical network for advanced zone"
+                )
+        physical_network = physical_networks[0]
+
+        self.debug("Adding netscaler device: %s" %
+                                    self.services["netscaler_2"]["ipaddress"])
+        netscaler_2 = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler_2"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        self.cleanup.append(netscaler_2)
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=netscaler_2.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        self.assertEqual(
+            ns.physicalnetworkid,
+            physical_network.id,
+            "Physical network id should match with the network in which device is configured"
+            )
+        self.debug("Another Netscaler device is added!")
+        return
+
+
+class TestNetScalerSharedMode(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetScalerSharedMode,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            cls.physical_network = physical_networks[0]
+        cls.services["netscaler_1"]["lbdevicecapacity"] = 2
+        cls.netscaler_1 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_1"],
+                                  physicalnetworkid=cls.physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=cls.physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account_1 = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.account_2 = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.account_3 = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.account_4 = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.account_5 = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.account_1,
+                        cls.account_2,
+                        cls.account_3,
+                        cls.account_5
+                        ]
+        cls.cleanup_devices = [cls.netscaler_1]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            interval = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    cls.api_client,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            cleanup_resources(cls.api_client, cls.cleanup_devices)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_netscaler_shared_mode(self):
+        """Test netscaler device in shared mode
+        """
+
+
+        # Validate the following
+        # 1. Add Netscaler device in shared mode with capacity 3
+        # 2. Netscaler should be configured successfully.It should be able to
+        #    service only 3 account.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler_1.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_2 = Network.create(
+                                self.apiclient,
+                                self.services["network"],
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                networkofferingid=self.network_offering.id,
+                                zoneid=self.zone.id
+                                )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_3 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_3.id)
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+
+        with self.assertRaises(Exception):
+            # Spawn an instance in that network
+            virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+
+        self.debug("Deploy VM failed as Netscaler device capacity is full!")
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_multiple_netscaler_capacilty(self):
+        """Test multiple netscaler devices with limited capacity
+        """
+
+
+        # Validate the following
+        # 1. Add another netscaler device and spawn a new VM again
+        # 2. VM deployement should be successful
+
+        self.debug("Adding another netscaler device: %s" %
+                                    self.services["netscaler_2"]["ipaddress"])
+        self.services["netscaler_2"]["lbdevicecapacity"] = 2
+        netscaler_2 = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler_2"],
+                                  physicalnetworkid=self.physical_network.id
+                                  )
+        self.cleanup_devices.append(netscaler_2)
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=netscaler_2.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        self.assertEqual(
+            ns.physicalnetworkid,
+            self.physical_network.id,
+            "Physical network id should match with the network in which device is configured"
+            )
+        self.debug("Another Netscaler device is added!")
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        networks = Network.list(
+                            self.apiclient,
+                            account=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            zoneid=self.zone.id,
+                            listall=True
+                        )
+        self.assertEqual(
+                         isinstance(networks, list),
+                         True,
+                         "Network should be present for the account: %s" %
+                                                self.account_3.account.name
+                         )
+        self.network_3 = networks[0]
+        self.debug("Created network with ID: %s" % self.network_3.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_3.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_3.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_3.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_03_multiple_netscaler_full_capacilty(self):
+        """Test netscaler device with full capacity
+        """
+
+
+        # Validate the following
+        # 1. Spawn multiple instances for utilizing full capacity of Netscaler
+        # 2. Deploy VM should fail after capacity full in netscaler device
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_4 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_4.account.name,
+                            domainid=self.account_4.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_4.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_4.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_4 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_4.account.name,
+                                  domainid=self.account_4.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_4.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_4.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_4.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_4.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_5 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_5.account.name,
+                            domainid=self.account_5.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_5.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_5.account.name)
+
+        with self.assertRaises(Exception):
+            # Spawn an instance in that network
+            virtual_machine_5 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_5.account.name,
+                                  domainid=self.account_5.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_5.id)]
+                                  )
+        self.debug("Deploy VM failed as Netscaler device capacity is full!")
+        return
+
+    @attr(configuration = "network.gc")
+    @attr(tags = ["advancedns"])
+    def test_04_delete_account_after_capacity_full(self):
+        """Test delete and add resouces after netscaler device capacity is full
+        """
+
+
+        # Validate the following
+        # 1. Delete one of the account. Wait till Network.gc.wait &
+        #    network.gc.interval time
+        # 2. Create an instance from another account
+        # 3. Deploy instance should succeed
+
+        self.debug("Delete account: %s" % self.account_4.account.name)
+        self.account_4.delete(self.apiclient)
+        self.debug("Account: %s is deleted" % self.account_4.account.name)
+
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+        wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+        self.debug("Sleeping for: network.gc.interval + network.gc.wait")
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value) + int(wait[0].value))
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network_5 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_5.account.name,
+                            domainid=self.account_5.account.domainid,
+                            networkofferingid=self.network_offering.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_5.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_5.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_5 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_5.account.name,
+                                  domainid=self.account_5.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_5.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_5.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_5.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_5.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        return
+
+
+class TestNwOffDedicatedNetscaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNwOffDedicatedNetscaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+        cls.services["netscaler_1"]["lbdevicecapacity"] = 3
+        cls.netscaler = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_1"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering_dedicated"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.netscaler,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_nw_off_dedicated_mode(self):
+        """Test network offering in dedicated mode device
+        """
+
+
+        # Validate the following
+        # 1. Add Netscaler device in shared mode
+        # 2. Create a network offering in dedicated mode.
+        # 3. Try to implemenent network with that network offering. Network
+        #    craetion should fail.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+
+        self.network_1 = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Deploy Instance with network: %s" % self.network_1.name)
+        with self.assertRaises(Exception):
+            # Spawn an instance in that network
+            VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Created instance failed!")
+        return
+
+
+class TestNwOffNetscaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNwOffNetscaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            physical_network = physical_networks[0]
+        cls.services["netscaler_1"]["lbdevicecapacity"] = 3
+        cls.netscaler_1 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_1"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+
+        cls.services["netscaler_2"].pop("lbdevicecapacity")
+        cls.services["netscaler_2"]["lbdevicededicated"] = True
+        cls.netscaler_2 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_2"],
+                                  physicalnetworkid=physical_network.id
+                                  )
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering_dedicated"],
+                                            conservemode=True
+                                            )
+        cls.network_offering_shared = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.network_offering_shared.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering,
+                        cls.network_offering_shared,
+                        cls.netscaler_1,
+                        cls.netscaler_2,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_3 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_2, self.account_3]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_ns_shared_nw_dedicated(self):
+        """Test netscaler device in shared mode with network offering in dedicated mode
+        """
+
+
+        # Validate the following
+        # 1. Add Netscaler device in shared mode
+        # 2. Create a network offering in dedicated mode.
+        # 3. Try to implemenent network with that network offering. Network
+        #    craetion should fail.
+
+        ns_list = NetScaler.list(
+                                 self.apiclient,
+                                 lbdeviceid=self.netscaler_1.lbdeviceid
+                                 )
+        self.assertEqual(
+                         isinstance(ns_list, list),
+                         True,
+                         "NetScaler list should not be empty"
+                         )
+        ns = ns_list[0]
+
+        self.assertEqual(
+                         ns.lbdevicededicated,
+                         False,
+                         "NetScaler device is configured in shared mode"
+                         )
+        self.assertEqual(
+                         ns.lbdevicestate,
+                         "Enabled",
+                         "NetScaler device state should be enabled"
+                         )
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account_1.account.name,
+                                    domainid=self.account_1.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        # Creating network using the network offering created
+        self.debug("Creating different network with network offering: %s" %
+                                                    self.network_offering.id)
+
+        self.network_2 = Network.create(
+                                self.apiclient,
+                                self.services["network"],
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                networkofferingid=self.network_offering.id,
+                                zoneid=self.zone.id
+                               )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug(
+            "Attempt to create second network with dedicated network offering failed!")
+        self.debug("Deleting account: %s" % self.account_1.account.name)
+        self.account_1.delete(self.apiclient)
+        self.debug("Account: %s deleted!" % self.account_1.account.name)
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+        wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+        self.debug("Sleeping for: network.gc.interval + network.gc.wait")
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value) + int(wait[0].value))
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering_shared.id)
+        self.network_3 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            networkofferingid=self.network_offering_shared.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_3.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_3.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_3.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_3.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        return
+
+
+class TestNwOffSToDUpgrade(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNwOffSToDUpgrade,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            cls.physical_network = physical_networks[0]
+        cls.services["netscaler_1"]["lbdevicecapacity"] = 3
+        cls.netscaler_1 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_1"],
+                                  physicalnetworkid=cls.physical_network.id
+                                  )
+
+        cls.services["netscaler_2"].pop("lbdevicecapacity")
+        cls.services["netscaler_2"]["lbdevicededicated"] = True
+        cls.netscaler_2 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_2"],
+                                  physicalnetworkid=cls.physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=cls.physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering_dedicated = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering_dedicated"],
+                                            conservemode=True
+                                            )
+        cls.network_offering_shared = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering_dedicated.update(cls.api_client, state='Enabled')
+        cls.network_offering_shared.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering_dedicated,
+                        cls.network_offering_shared,
+                        cls.netscaler_1,
+                        cls.netscaler_2,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_3 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2, self.account_3]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_shared_to_dedicated_upgrade(self):
+        """Test upgrade from shared LB isolation to dedicated LB isolation"""
+
+
+        # Validate the following
+        # 1. Create a dedicated and shared network offering
+        # 2. Configure 2 instances of Netscaler one with dedicated and other
+        #    shared mode
+        # 3. Deploy instance with shared network offering in account 1. create
+        #    LB rules
+        # 4. Deploy instance with shared network offering in account 2. create
+        #   LB rules
+        # 5. Deploy instance with dedicated network offering in account 3.
+        #   Create Lb rules.
+        # 6. Configure another instace of netscaler in dedicated mode
+        # 7. upgrade networkj for user 1 to dedicated network offering.
+        #    Create LB rules. LB rule creation should be successful
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering_shared.id)
+        self.network_1 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_1.account.name,
+                            domainid=self.account_1.account.domainid,
+                            networkofferingid=self.network_offering_shared.id,
+                            zoneid=self.zone.id
+                            )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering_shared.id)
+        self.network_2 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            networkofferingid=self.network_offering_shared.id,
+                            zoneid=self.zone.id
+                            )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering_dedicated.id)
+        self.network_3 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            networkofferingid=self.network_offering_dedicated.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_3.id)
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_3.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_3.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_3.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("Configuring another Netscaler device in dedicated mode")
+
+        self.services["netscaler_3"].pop("lbdevicecapacity")
+        self.services["netscaler_3"]["lbdevicededicated"] = True
+        self.netscaler_3 = NetScaler.add(
+                                  self.apiclient,
+                                  self.services["netscaler_3"],
+                                  physicalnetworkid=self.physical_network.id
+                                  )
+
+        self.debug("Stopping All VMs before upgrading network for account: %s" %
+                            self.account_1.account.name)
+        virtual_machine_1.stop(self.apiclient)
+
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Stopped",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("All Vms are in stopped state")
+        self.debug("Upgrading the network: %s" % self.network_1.id)
+        self.network_1.update(
+                            self.apiclient,
+                            networkofferingid=self.network_offering_dedicated.id,
+                            changecidr=True
+                            )
+        networks = Network.list(
+                                self.apiclient,
+                                id=self.network_1.id,
+                                listall=True
+                                )
+        self.assertEqual(
+                isinstance(networks, list),
+                True,
+                "List Networks should return a valid list for given network ID"
+                )
+        self.assertNotEqual(
+                            len(networks),
+                            0,
+                            "Length of list networks should not be 0"
+                            )
+        network = networks[0]
+        self.assertEqual(
+                        network.networkofferingid,
+                        self.network_offering_dedicated.id,
+                        "Network offering ID should match with new offering ID"
+                        )
+
+        self.debug("Starting All VMs after upgrading network for account: %s" %
+                            self.account_1.account.name)
+        virtual_machine_1.start(self.apiclient)
+
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        self.debug("All Vms are in running state")
+        try:
+            self.debug(
+                "Associating public Ip to the network: %s" %
+                                                        self.network_1.name)
+
+            public_ip = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account_1.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account_1.account.domainid,
+                                networkid=self.network_1.id
+                                )
+            self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                                public_ip.ipaddress.ipaddress)
+
+            lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account_1.account.name,
+                                    networkid=self.network_1.id
+                                )
+            self.debug("Created the load balancing rule for public IP: %s" %
+                                                public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("Failed to create load balancing rule - %s" % e)
+        return
+
+
+class TestNwOffDToSUpgrade(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNwOffDToSUpgrade,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        physical_networks = PhysicalNetwork.list(
+                                                 cls.api_client,
+                                                 zoneid=cls.zone.id
+                                                 )
+        if isinstance(physical_networks, list):
+            cls.physical_network = physical_networks[0]
+        cls.services["netscaler_1"]["lbdevicecapacity"] = 3
+        cls.netscaler_1 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_1"],
+                                  physicalnetworkid=cls.physical_network.id
+                                  )
+
+        cls.services["netscaler_2"].pop("lbdevicecapacity")
+        cls.services["netscaler_2"]["lbdevicededicated"] = True
+        cls.netscaler_2 = NetScaler.add(
+                                  cls.api_client,
+                                  cls.services["netscaler_2"],
+                                  physicalnetworkid=cls.physical_network.id
+                                  )
+
+        nw_service_providers = NetworkServiceProvider.list(
+                                        cls.api_client,
+                                        name='Netscaler',
+                                        physicalnetworkid=cls.physical_network.id
+                                        )
+        if isinstance(nw_service_providers, list):
+            netscaler_provider = nw_service_providers[0]
+
+        if netscaler_provider.state != 'Enabled':
+            response = NetworkServiceProvider.update(
+                                          cls.api_client,
+                                          id=netscaler_provider.id,
+                                          state='Enabled'
+                                          )
+        cls.network_offering_dedicated = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering_dedicated"],
+                                            conservemode=True
+                                            )
+        cls.network_offering_shared = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering_dedicated.update(cls.api_client, state='Enabled')
+        cls.network_offering_shared.update(cls.api_client, state='Enabled')
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering_dedicated,
+                        cls.network_offering_shared,
+                        cls.netscaler_1,
+                        cls.netscaler_2,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account_1 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_2 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.account_3 = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account_1, self.account_2, self.account_3]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+            wait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_shared_to_dedicated_upgrade(self):
+        """Test upgrade from shared LB isolation to dedicated LB isolation"""
+
+
+        # Validate the following
+        # 1. Create a dedicated and shared network offering
+        # 2. Configure 2 instances of Netscaler one with dedicated and other
+        #    shared mode
+        # 3. Deploy instance with shared network offering in account 1. create
+        #    LB rules
+        # 4. Deploy instance with shared network offering in account 2. create
+        #   LB rules
+        # 5. Deploy instance with dedicated network offering in account 3.
+        #   Create Lb rules.
+        # 6. Configure another instace of netscaler in dedicated mode
+        # 7. upgrade networkj for user 1 to dedicated network offering.
+        #    Create LB rules. LB rule creation should be successful
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering_shared.id)
+        self.network_1 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_1.account.name,
+                            domainid=self.account_1.account.domainid,
+                            networkofferingid=self.network_offering_shared.id,
+                            zoneid=self.zone.id
+                            )
+        self.debug("Created network with ID: %s" % self.network_1.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_1.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_1.account.name,
+                                  domainid=self.account_1.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_1.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_1.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_1.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering_shared.id)
+        self.network_2 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            networkofferingid=self.network_offering_shared.id,
+                            zoneid=self.zone.id
+                            )
+        self.debug("Created network with ID: %s" % self.network_2.id)
+
+        self.debug("Deploying VM in account: %s" % self.account_2.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_2.account.name,
+                                  domainid=self.account_2.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_2.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_2.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_2.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        # Creating network using the network offering created
+        self.debug("Trying to create network with network offering: %s" %
+                                                    self.network_offering_dedicated.id)
+        self.network_3 = Network.create(
+                            self.apiclient,
+                            self.services["network"],
+                            accountid=self.account_3.account.name,
+                            domainid=self.account_3.account.domainid,
+                            networkofferingid=self.network_offering_dedicated.id,
+                            zoneid=self.zone.id
+                        )
+        self.debug("Created network with ID: %s" % self.network_3.id)
+        self.debug("Deploying VM in account: %s" % self.account_3.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account_3.account.name,
+                                  domainid=self.account_3.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network_3.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network_3.id)
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_3.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_3.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+
+        self.debug("Stopping all VMs in account: %s" % self.account_3.account.name)
+        virtual_machine_3.stop(self.apiclient)
+
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_3.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_3.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Stopped",
+                            "VM state should be stopped"
+                        )
+        self.debug("All user VMs stopped")
+        self.debug("Upgrading the network: %s" % self.network_3.id)
+        self.network_3.update(
+                            self.apiclient,
+                            networkofferingid=self.network_offering_shared.id,
+                            changecidr=True
+                            )
+        networks = Network.list(
+                                self.apiclient,
+                                id=self.network_3.id,
+                                listall=True
+                                )
+        self.assertEqual(
+                isinstance(networks, list),
+                True,
+                "List Networks should return a valid list for given network ID"
+                )
+        self.assertNotEqual(
+                            len(networks),
+                            0,
+                            "Length of list networks should not be 0"
+                            )
+        network = networks[0]
+        self.assertEqual(
+                        network.networkofferingid,
+                        self.network_offering_shared.id,
+                        "Network offering ID should match with new offering ID"
+                        )
+        self.debug("Starting instances in account: %s" % self.account_3.account.name)
+        virtual_machine_3.start(self.apiclient)
+
+        list_vm_response = VirtualMachine.list(
+                                        self.apiclient,
+                                        id=virtual_machine_3.id
+                                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % virtual_machine_3.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM state should be running after deployment"
+                        )
+        try:
+            self.debug(
+                "Associating public Ip to the network: %s" %
+                                                        self.network_3.name)
+
+            public_ip = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account_3.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account_3.account.domainid,
+                                networkid=self.network_3.id
+                                )
+            self.debug(
+            "Creating LB rule for IP address: %s with round robin algo" %
+                                                public_ip.ipaddress.ipaddress)
+
+            lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account_3.account.name,
+                                    networkid=self.network_3.id
+                                )
+            self.debug("Created the load balancing rule for public IP: %s" %
+                                                public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("Failed to create load balancing rule - %s" % e)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_network_offering.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_network_offering.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_network_offering.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_network_offering.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1942 @@
+# 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.
+
+""" P1 tests for network offering
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test network offering Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                                    },
+                         "network_offering": {
+                                    "name": 'Network offering-VR services',
+                                    "displaytext": 'Network offering-VR services',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'VirtualRouter',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                        },
+                                    },
+                         "network_offering_netscaler": {
+                                    "name": 'Network offering-netscaler',
+                                    "displaytext": 'Network offering-netscaler',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'Netscaler',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                        },
+                                    },
+                         "network": {
+                                  "name": "Test Network",
+                                  "displaytext": "Test Network",
+                                  "vlan": 2370,
+                                },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "leastconn",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                                    "openfirewall": False,
+                                },
+                         "lbrule_port_2221": {
+                                    "name": "SSH",
+                                    "alg": "leastconn",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2221,
+                                    "openfirewall": False,
+                                },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                                },
+                         "natrule_port_66": {
+                                    "privateport": 22,
+                                    "publicport": 66,
+                                    "protocol": "TCP"
+                                },
+                         "fw_rule": {
+                                    "startport": 1,
+                                    "endport": 6000,
+                                    "cidr": '55.55.0.0/11',
+                                    # Any network (For creating FW rule)
+                                },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'advanced'
+                    }
+
+
+class TestNOVirtualRouter(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNOVirtualRouter,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced"])
+    def test_01_network_off_without_conserve_mode(self):
+        """Test Network offering with Conserve mode off and VR - All services
+        """
+
+
+        # Validate the following
+        # 1. Create a Network from the above network offering and deploy a VM.
+        # 2. On source NAT ipaddress, we should NOT be allowed to add a
+        #    LB rules
+        # 3. On source NAT ipaddress, we should be NOT be allowed to add
+        #    PF rule
+        # 4. On an ipaddress that has PF rules, we should NOT be allowed to
+        #    add a LB rules.
+        # 5. On an ipaddress that has Lb rules, we should NOT allow PF rules
+        #    to be programmed.
+        # 6. We should be allowed to program multiple PF rules on the same Ip
+        #    address on different public ports.
+        # 7. We should be allowed to program multiple LB rules on the same Ip
+        #    address for different public port ranges.
+        # 8. On source NAT ipaddress, we should be allowed to Enable VPN.
+        # 9. On SOurce NAT ipaddress, we will be allowed to add firewall rule
+
+        # Create a network offering with all virtual router services enabled
+        self.debug(
+            "Creating n/w offering with all services in VR & conserve mode:off"
+            )
+        self.network_offering = NetworkOffering.create(
+                                            self.api_client,
+                                            self.services["network_offering"],
+                                            conservemode=False
+                                            )
+        self.cleanup.append(self.network_offering)
+
+        self.debug("Created n/w offering with ID: %s" %
+                                                    self.network_offering.id)
+        # Enable Network offering
+        self.network_offering.update(self.apiclient, state='Enabled')
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        with self.assertRaises(Exception):
+                LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          ipaddressid=src_nat.id,
+                                          accountid=self.account.account.name
+                                       )
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        with self.assertRaises(Exception):
+            NATRule.create(
+                           self.apiclient,
+                           virtual_machine,
+                           self.services["natrule"],
+                           ipaddressid=src_nat.id
+                           )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_nat_rule = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=self.network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_nat_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        ip_with_nat_rule.ipaddress.ipaddress)
+        NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        self.debug("Trying to create LB rule on IP with NAT: %s" %
+                                    ip_with_nat_rule.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        with self.assertRaises(Exception):
+                LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_nat_rule.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        self.debug("Creating PF rule with public port: 66")
+
+        nat_rule = NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule_port_66"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        # Check if NAT rule created successfully
+        nat_rules = NATRule.list(
+                                 self.apiclient,
+                                 id=nat_rule.id
+                                 )
+
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT rules should return valid list"
+                         )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating LB rule for IP address: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                ip_with_nat_rule.ipaddress.ipaddress)
+
+        with self.assertRaises(Exception):
+            NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_lb_rule.ipaddress.id
+                      )
+
+        self.debug("Creating LB rule with public port: 2221")
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule_port_2221"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name
+                                )
+
+        # Check if NAT rule created successfully
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return valid list"
+                         )
+
+        self.debug("Creating firewall rule on source NAT: %s" %
+                                                        src_nat.ipaddress)
+        #Create Firewall rule on source NAT
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        fw_rules = FireWallRule.list(
+                                     self.apiclient,
+                                     id=fw_rule.id
+                                    )
+        self.assertEqual(
+                         isinstance(fw_rules, list),
+                         True,
+                         "List fw rules should return a valid firewall rules"
+                         )
+
+        self.assertNotEqual(
+                            len(fw_rules),
+                            0,
+                            "Length of fw rules response should not be zero"
+                            )
+        return
+
+    @attr(tags = ["advanced"])
+    def test_02_network_off_with_conserve_mode(self):
+        """Test Network offering with Conserve mode ON and VR - All services
+        """
+
+
+        # Validate the following
+        # 1. Create a Network from the above network offering and deploy a VM.
+        # 2. On source NAT ipaddress, we should be allowed to add a LB rules
+        # 3. On source NAT ipaddress, we should be allowed to add a PF rules
+        # 4. On source NAT ipaddress, we should be allowed to add a Firewall
+        #    rules
+        # 5. On an ipaddress that has Lb rules, we should be allowed to
+        #    program PF rules.
+        # 6. We should be allowed to program multiple PF rules on the same Ip
+        #    address on different public ports.
+        # 7. We should be allowed to program multiple LB rules on the same Ip
+        #    address for different public port ranges.
+        # 8. On source NAT ipaddress, we should be allowed to Enable VPN
+        #    access.
+
+        # Create a network offering with all virtual router services enabled
+        self.debug(
+            "Creating n/w offering with all services in VR & conserve mode:off"
+            )
+        self.network_offering = NetworkOffering.create(
+                                            self.api_client,
+                                            self.services["network_offering"],
+                                            conservemode=True
+                                            )
+        self.cleanup.append(self.network_offering)
+
+        self.debug("Created n/w offering with ID: %s" %
+                                                    self.network_offering.id)
+    # Enable Network offering
+        self.network_offering.update(self.apiclient, state='Enabled')
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=src_nat.id,
+                                    accountid=self.account.account.name
+                                )
+        self.debug("Created LB rule on source NAT: %s" % src_nat.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List lb rules should return a valid lb rules"
+                         )
+        self.assertNotEqual(
+                    len(lb_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                           self.apiclient,
+                           virtual_machine,
+                           self.services["natrule"],
+                           ipaddressid=src_nat.id
+                           )
+        self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
+
+        nat_rules = NATRule.list(
+                                         self.apiclient,
+                                         id=nat_rule.id
+                                         )
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT should return a valid port forwarding rules"
+                         )
+        self.assertNotEqual(
+                    len(nat_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+        self.debug("Creating firewall rule on source NAT: %s" %
+                                                        src_nat.ipaddress)
+        #Create Firewall rule on source NAT
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        fw_rules = FireWallRule.list(
+                                     self.apiclient,
+                                     id=fw_rule.id
+                                    )
+        self.assertEqual(
+                         isinstance(fw_rules, list),
+                         True,
+                         "List fw rules should return a valid firewall rules"
+                         )
+
+        self.assertNotEqual(
+                            len(fw_rules),
+                            0,
+                            "Length of fw rules response should not be zero"
+                            )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=self.network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        public_ip.ipaddress.ipaddress)
+        NATRule.create(
+                       self.apiclient,
+                       virtual_machine,
+                       self.services["natrule"],
+                       ipaddressid=public_ip.ipaddress.id
+                      )
+
+        self.debug("Trying to create LB rule on IP with NAT: %s" %
+                                    public_ip.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        self.debug("Creating PF rule with public port: 66")
+
+        nat_rule = NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule_port_66"],
+                         ipaddressid=public_ip.ipaddress.id
+                      )
+
+        # Check if NAT rule created successfully
+        nat_rules = NATRule.list(
+                                 self.apiclient,
+                                 id=nat_rule.id
+                                 )
+
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT rules should return valid list"
+                         )
+
+        self.debug("Creating LB rule with public port: 2221")
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule_port_2221"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.account.name
+                                )
+
+        # Check if NAT rule created successfully
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return valid list"
+                         )
+
+        # User should be able to enable VPN on source NAT
+        self.debug("Created VPN with source NAT IP: %s" % src_nat.ipaddress)
+        # Assign VPN to source NAT
+        vpn = Vpn.create(
+                        self.apiclient,
+                        src_nat.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+
+        vpns = Vpn.list(
+                        self.apiclient,
+                        publicipid=src_nat.id,
+            listall=True,
+                        )
+
+        self.assertEqual(
+                         isinstance(vpns, list),
+                         True,
+                         "List VPNs should return a valid VPN list"
+                         )
+
+        self.assertNotEqual(
+                            len(vpns),
+                            0,
+                            "Length of list VPN response should not be zero"
+                            )
+        return
+
+
+class TestNOWithNetscaler(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNOWithNetscaler,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_01_network_off_without_conserve_mode(self):
+        """Test Nw off with Conserve mode off, VR-All services, LB-netscaler
+        """
+
+
+        # Validate the following
+        # 1. Create a Network from the above network offering and deploy a VM.
+        # 2. On source NAT ipaddress, we should NOT be allowed to add LB rule
+        # 3. On source NAT ipaddress, we should NOT be allowed to add PF rule
+        # 4. On an ipaddress that has PF rules, we should NOT be allowed to
+        #    add a LB rules.
+        # 5. On an ipaddress that has Lb rules , we should NOT allow firewall
+        #    rules to be programmed.
+        # 6. On an ipaddress that has Lb rules , we should NOT allow PF rules
+        #    to be programmed.
+        # 7. We should be allowed to program multiple PF rules on the same Ip
+        #    address on different public ports.
+        # 8. We should be allowed to program multiple LB rules on the same Ip
+        #    address for different public port ranges.
+        # 9. On source NAT ipaddress, we should NOT be allowed to Enable VPN.
+
+        # Create a network offering with all virtual router services enabled
+        self.debug(
+            "Creating n/w offering with all services in VR & conserve mode:ON"
+            )
+        self.network_offering = NetworkOffering.create(
+                                            self.api_client,
+                                            self.services["network_offering_netscaler"],
+                                            conservemode=False
+                                            )
+        self.cleanup.append(self.network_offering)
+
+        self.debug("Created n/w offering with ID: %s" %
+                                                    self.network_offering.id)
+        # Enable Network offering
+        self.network_offering.update(self.apiclient, state='Enabled')
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        with self.assertRaises(Exception):
+            LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=src_nat.id,
+                                    accountid=self.account.account.name
+                                )
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        with self.assertRaises(Exception):
+            NATRule.create(
+                           self.apiclient,
+                           virtual_machine,
+                           self.services["natrule"],
+                           ipaddressid=src_nat.id
+                           )
+        self.debug("Creating firewall rule on source NAT: %s" %
+                                                        src_nat.ipaddress)
+        #Create Firewall rule on source NAT
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        fw_rules = FireWallRule.list(
+                                     self.apiclient,
+                                     id=fw_rule.id
+                                    )
+        self.assertEqual(
+                         isinstance(fw_rules, list),
+                         True,
+                         "List fw rules should return a valid firewall rules"
+                         )
+
+        self.assertNotEqual(
+                            len(fw_rules),
+                            0,
+                            "Length of fw rules response should not be zero"
+                            )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_nat_rule = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=self.network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_nat_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        ip_with_nat_rule.ipaddress.ipaddress)
+        NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        self.debug("Trying to create LB rule on IP with NAT: %s" %
+                                    ip_with_nat_rule.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        with self.assertRaises(Exception):
+                LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_nat_rule.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        self.debug("Creating PF rule with public port: 66")
+
+        nat_rule = NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule_port_66"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        # Check if NAT rule created successfully
+        nat_rules = NATRule.list(
+                                 self.apiclient,
+                                 id=nat_rule.id
+                                 )
+
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT rules should return valid list"
+                         )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating LB rule for IP address: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        ip_with_nat_rule.ipaddress.ipaddress)
+
+        with self.assertRaises(Exception):
+            NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_lb_rule.ipaddress.id
+                      )
+
+        self.debug("Trying to create FW rule on IP with LB rule")
+        with self.assertRaises(Exception):
+            FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+
+        self.debug("Creating LB rule with public port: 2221")
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule_port_2221"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        # Check if NAT rule created successfully
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return valid list"
+                         )
+
+        # User should be able to enable VPN on source NAT
+        self.debug("Enabling VPN on source NAT IP: %s" % src_nat.ipaddress)
+        # Assign VPN to source NAT
+        with self.assertRaises(Exception):
+            Vpn.create(
+                        self.apiclient,
+                        src_nat.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+        return
+
+    @attr(tags = ["advancedns"])
+    def test_02_network_off_with_conserve_mode_netscaler(self):
+        """Test NW off with Conserve mode ON, LB-Netscaler and VR-All services
+        """
+
+
+        # Validate the following
+        # 1. Create a Network from the above network offering and deploy a VM.
+        # 2. On source NAT ipaddress, we should NOT be allowed to add LB rule
+        # 3. On source NAT ipaddress, we should be allowed to add PF rule and
+        #    Fierwall rules.
+        # 4. On an ipaddress that has PF rules, we should NOT be allowed to
+        #    add a LB rules.
+        # 5. On an ipaddress that has Lb rules , we should NOT allow firewall
+        #    rules to be programmed.
+        # 6. On an ipaddress that has Lb rules , we should NOT allow PF rules
+        #    to be programmed.
+        # 7. We should be allowed to program multiple PF rules on the same Ip
+        #    address on different public ports.
+        # 8. We should be allowed to program multiple LB rules on the same Ip
+        #    address for different public port ranges.
+        # 9. On source NAT ipaddress, we should be allowed to Enable VPN.
+
+        # Create a network offering with all virtual router services enabled
+        self.debug(
+            "Creating n/w offering with all services in VR & conserve mode:ON"
+            )
+        self.network_offering = NetworkOffering.create(
+                                            self.api_client,
+                                            self.services["network_offering_netscaler"],
+                                            conservemode=True
+                                            )
+        self.cleanup.append(self.network_offering)
+
+        self.debug("Created n/w offering with ID: %s" %
+                                                    self.network_offering.id)
+        # Enable Network offering
+        self.network_offering.update(self.apiclient, state='Enabled')
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        with self.assertRaises(Exception):
+            LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=src_nat.id,
+                                    accountid=self.account.account.name
+                                )
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                           self.apiclient,
+                           virtual_machine,
+                           self.services["natrule"],
+                           ipaddressid=src_nat.id
+                           )
+        self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
+
+        nat_rules = NATRule.list(
+                                    self.apiclient,
+                                    id=nat_rule.id
+                                )
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT should return a valid port forwarding rules"
+                         )
+        self.assertNotEqual(
+                    len(nat_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+        self.debug("Creating firewall rule on source NAT: %s" %
+                                                        src_nat.ipaddress)
+        #Create Firewall rule on source NAT
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        fw_rules = FireWallRule.list(
+                                     self.apiclient,
+                                     id=fw_rule.id
+                                    )
+        self.assertEqual(
+                         isinstance(fw_rules, list),
+                         True,
+                         "List fw rules should return a valid firewall rules"
+                         )
+
+        self.assertNotEqual(
+                            len(fw_rules),
+                            0,
+                            "Length of fw rules response should not be zero"
+                            )
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_nat_rule = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.account.domainid,
+                                    networkid=self.network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_nat_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        ip_with_nat_rule.ipaddress.ipaddress)
+        NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        self.debug("Trying to create LB rule on IP with NAT: %s" %
+                                    ip_with_nat_rule.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        with self.assertRaises(Exception):
+                LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_nat_rule.ipaddress.id,
+                                    accountid=self.account.account.name
+                                    )
+        self.debug("Creating PF rule with public port: 66")
+
+        nat_rule = NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule_port_66"],
+                         ipaddressid=ip_with_nat_rule.ipaddress.id
+                      )
+
+        # Check if NAT rule created successfully
+        nat_rules = NATRule.list(
+                                 self.apiclient,
+                                 id=nat_rule.id
+                                 )
+
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT rules should return valid list"
+                         )
+
+        self.debug("Associating public IP for network: %s" % self.network.id)
+        ip_with_lb_rule = PublicIPAddress.create(
+                                self.apiclient,
+                                accountid=self.account.account.name,
+                                zoneid=self.zone.id,
+                                domainid=self.account.account.domainid,
+                                networkid=self.network.id
+                                )
+        self.debug("Associated %s with network %s" % (
+                                        ip_with_lb_rule.ipaddress.ipaddress,
+                                        self.network.id
+                                        ))
+        self.debug("Creating LB rule for IP address: %s" %
+                                        ip_with_lb_rule.ipaddress.ipaddress)
+
+        LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        self.debug("Trying to create PF rule on IP with LB rule: %s" %
+                                        ip_with_nat_rule.ipaddress.ipaddress)
+
+        with self.assertRaises(Exception):
+            NATRule.create(
+                         self.apiclient,
+                         virtual_machine,
+                         self.services["natrule"],
+                         ipaddressid=ip_with_lb_rule.ipaddress.id
+                      )
+
+        self.debug("Trying to create FW rule on IP with LB rule")
+        with self.assertRaises(Exception):
+            FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+
+        self.debug("Creating LB rule with public port: 2221")
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule_port_2221"],
+                                    ipaddressid=ip_with_lb_rule.ipaddress.id,
+                                    accountid=self.account.account.name,
+                                    networkid=self.network.id
+                                )
+
+        # Check if NAT rule created successfully
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List LB rules should return valid list"
+                         )
+
+        # User should be able to enable VPN on source NAT
+        self.debug("Created VPN with source NAT IP: %s" % src_nat.ipaddress)
+        # Assign VPN to source NAT
+        vpn = Vpn.create(
+                        self.apiclient,
+                        src_nat.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+
+        vpns = Vpn.list(
+                        self.apiclient,
+                        publicipid=src_nat.id,
+                        listall=True,
+                        )
+
+        self.assertEqual(
+                         isinstance(vpns, list),
+                         True,
+                         "List VPNs should return a valid VPN list"
+                         )
+
+        self.assertNotEqual(
+                            len(vpns),
+                            0,
+                            "Length of list VNP response should not be zero"
+                            )
+        return
+
+
+class TestNetworkUpgrade(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetworkUpgrade,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advancedns"])
+    def test_01_nwupgrade_netscaler_conserve_on(self):
+        """Test Nw upgrade to netscaler lb service and conserve mode ON
+        """
+
+
+        # Validate the following
+        # 1. Upgrade a network with VR and conserve mode ON TO
+        #    A network that has Lb provided by "Netscaler" and all other
+        #    services provided by "VR" and Conserve mode ON
+        # 2. Have PF and LB rules on the same ip address. Upgrade network
+        #    should fail.
+        # 3. Have SourceNat,PF and VPN on the same IP address. Upgrade of
+        #    network should succeed.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=src_nat.id,
+                                    accountid=self.account.account.name
+                                )
+        self.debug("Created LB rule on source NAT: %s" % src_nat.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List lb rules should return a valid lb rules"
+                         )
+        self.assertNotEqual(
+                    len(lb_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                           self.apiclient,
+                           virtual_machine,
+                           self.services["natrule"],
+                           ipaddressid=src_nat.id
+                           )
+        self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
+
+        nat_rules = NATRule.list(
+                                         self.apiclient,
+                                         id=nat_rule.id
+                                         )
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT should return a valid port forwarding rules"
+                         )
+        self.assertNotEqual(
+                    len(nat_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+        # Create a network offering with all virtual router services enabled
+        self.debug(
+            "Creating n/w offering with all services in VR & conserve mode:ON LB- Netscaler"
+            )
+        ns_lb_offering = NetworkOffering.create(
+                                            self.api_client,
+                                            self.services["network_offering_netscaler"],
+                                            conservemode=True
+                                            )
+        self.cleanup.append(ns_lb_offering)
+        ns_lb_offering.update(self.apiclient, state='Enabled')
+
+        #Stop all the VMs associated with network to update cidr
+        self.debug("Stopping the VM: %s" % virtual_machine.name)
+        virtual_machine.stop(self.apiclient)
+
+        self.debug("Updating network offering for network: %s" %
+                                                            self.network.id)
+        with self.assertRaises(Exception):
+            self.network.update(
+                            self.apiclient,
+                            networkofferingid=ns_lb_offering.id,
+                            changecidr=True
+                            )
+
+        self.debug("Network upgrade failed!")
+
+        self.debug("Deleting LB Rule: %s" % lb_rule.id)
+        lb_rule.delete(self.apiclient)
+        self.debug("LB rule deleted")
+
+        # Assign VPN to source NAT
+        self.debug("Enabling VPN on source NAT")
+        vpn = Vpn.create(
+                        self.apiclient,
+                        src_nat.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+
+        vpns = Vpn.list(
+                        self.apiclient,
+                        publicipid=src_nat.id,
+                        listall=True,
+                        )
+
+        self.assertEqual(
+                         isinstance(vpns, list),
+                         True,
+                         "List VPNs should return a valid VPN list"
+                         )
+
+        self.assertNotEqual(
+                            len(vpns),
+                            0,
+                            "Length of list VPN response should not be zero"
+                            )
+        self.debug("Upgrading the network: %s" % self.network.id)
+        self.network.update(
+                            self.apiclient,
+                            networkofferingid=ns_lb_offering.id,
+                            changecidr=True
+                            )
+        networks = Network.list(
+                                self.apiclient,
+                                id=self.network.id,
+                                listall=True
+                                )
+        self.assertEqual(
+                isinstance(networks, list),
+                True,
+                "List Networks should return a valid list for given network ID"
+                )
+        self.assertNotEqual(
+                            len(networks),
+                            0,
+                            "Length of list networks should not be 0"
+                            )
+        network = networks[0]
+        self.assertEqual(
+                        network.networkofferingid,
+                        ns_lb_offering.id,
+                        "Network offering ID should match with new offering ID"
+                        )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advancedns"])
+    def test_02_nwupgrade_netscaler_conserve_off(self):
+        """Test Nw upgrade to netscaler lb service and conserve mode OFF
+        """
+
+
+        # Validate the following
+        # 1. Upgrade a network with VR and conserve mode ON TO
+        #    A network that has Lb provided by "Netscaler" and all other
+        #    services provided by "VR" and Conserve mode OFF
+        # 2. Have PF and LB rules on the same ip address. Upgrade network
+        #    should fail.
+        # 3. Have SourceNat,PF and VPN on the same IP address. Upgrade of
+        #    network should fail.
+
+        # Creating network using the network offering created
+        self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+        self.debug("Deployed VM in network: %s" % self.network.id)
+
+        src_nat_list = PublicIPAddress.list(
+                                        self.apiclient,
+                                        associatednetworkid=self.network.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid,
+                                        listall=True,
+                                        issourcenat=True,
+                                        )
+        self.assertEqual(
+                         isinstance(src_nat_list, list),
+                         True,
+                         "List Public IP should return a valid source NAT"
+                         )
+        self.assertNotEqual(
+                    len(src_nat_list),
+                    0,
+                    "Length of response from listPublicIp should not be 0"
+                    )
+
+        src_nat = src_nat_list[0]
+        self.debug("Trying to create LB rule on source NAT IP: %s" %
+                                                        src_nat.ipaddress)
+        # Create Load Balancer rule with source NAT
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=src_nat.id,
+                                    accountid=self.account.account.name
+                                )
+        self.debug("Created LB rule on source NAT: %s" % src_nat.ipaddress)
+
+        lb_rules = LoadBalancerRule.list(
+                                         self.apiclient,
+                                         id=lb_rule.id
+                                         )
+        self.assertEqual(
+                         isinstance(lb_rules, list),
+                         True,
+                         "List lb rules should return a valid lb rules"
+                         )
+        self.assertNotEqual(
+                    len(lb_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+
+        self.debug(
+            "Trying to create a port forwarding rule in source NAT: %s" %
+                                                            src_nat.ipaddress)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                           self.apiclient,
+                           virtual_machine,
+                           self.services["natrule"],
+                           ipaddressid=src_nat.id
+                           )
+        self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
+
+        nat_rules = NATRule.list(
+                                         self.apiclient,
+                                         id=nat_rule.id
+                                         )
+        self.assertEqual(
+                         isinstance(nat_rules, list),
+                         True,
+                         "List NAT should return a valid port forwarding rules"
+                         )
+        self.assertNotEqual(
+                    len(nat_rules),
+                    0,
+                    "Length of response from listLbRules should not be 0"
+                    )
+        # Create a network offering with all virtual router services enabled
+        self.debug(
+            "Creating n/w offering with all services in VR & conserve mode:ON LB- Netscaler"
+            )
+        ns_lb_offering = NetworkOffering.create(
+                                            self.api_client,
+                                            self.services["network_offering_netscaler"],
+                                            conservemode=False
+                                            )
+        self.cleanup.append(ns_lb_offering)
+        ns_lb_offering.update(self.apiclient, state='Enabled')
+
+        #Stop all the VMs associated with network to update cidr
+        self.debug("Stopping the VM: %s" % virtual_machine.name)
+        virtual_machine.stop(self.apiclient)
+
+        self.debug("Updating network offering for network: %s" %
+                                                            self.network.id)
+        with self.assertRaises(Exception):
+            self.network.update(
+                            self.apiclient,
+                            networkofferingid=ns_lb_offering.id,
+                            changecidr=True
+                            )
+
+        self.debug("Network upgrade failed!")
+
+        self.debug("Deleting LB Rule: %s" % lb_rule.id)
+        lb_rule.delete(self.apiclient)
+        self.debug("LB rule deleted")
+
+        # Assign VPN to source NAT
+        self.debug("Enabling VPN on source NAT")
+        vpn = Vpn.create(
+                        self.apiclient,
+                        src_nat.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+
+        vpns = Vpn.list(
+                        self.apiclient,
+                        publicipid=src_nat.id,
+                        listall=True,
+                        )
+
+        self.assertEqual(
+                         isinstance(vpns, list),
+                         True,
+                         "List VPNs should return a valid VPN list"
+                         )
+
+        self.assertNotEqual(
+                            len(vpns),
+                            0,
+                            "Length of list VPN response should not be zero"
+                            )
+        self.debug("Upgrading the network: %s" % self.network.id)
+        with self.assertRaises(Exception):
+            self.network.update(
+                            self.apiclient,
+                            networkofferingid=ns_lb_offering.id,
+                            changecidr=True
+                            )
+        return
+
+
+@unittest.skip("Skipped since shared network requires StartIp/endIp/gateway/netmask")
+class TestSharedNetworkWithoutIp(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestSharedNetworkWithoutIp,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator", "network", "api"])
+    def test_deployVmSharedNetworkWithoutIpRange(self):
+        """Test deployVM in shared network without startIp/endIp
+        """
+
+        # Steps for validation
+        # 1. create a shared network using shared network offering but do not
+        #    specify startIp/endIp arguments
+        # 2. create an account
+        # 3. deploy a VM in this account using the above network
+        # Validate the following
+        # 1. listNetworks should return the created network
+        # 2. listAccounts to return the created account
+        # 3. VM deployment should succeed and NIC is in networks address space
+        # 4. delete the account
+
+        self.debug(
+                "Fetching default shared network offering from nw offerings")
+        network_offerings = NetworkOffering.list(
+                                    self.apiclient,
+                                    listall=True,
+                                    guestiptype="Shared",
+                                    name="DefaultSharedNetworkOffering",
+                                    displaytext="Offering for Shared networks"
+                                    )
+        self.assertEqual(
+                    isinstance(network_offerings, list),
+                    True,
+                    "Nw offerings should have atleast a shared nw offering"
+                    )
+        shared_nw_off = network_offerings[0]
+        self.debug("Shared netwrk offering: %s" % shared_nw_off.name)
+
+        self.debug("Creating a network from shared network offering")
+        self.network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=shared_nw_off.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug("Created network with ID: %s" % self.network.id)
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        try:
+            # Spawn an instance in that network
+            VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id,
+                                  networkids=[str(self.network.id)]
+                                  )
+            self.debug("Deployed VM in network: %s" % self.network.id)
+        except Exception as e:
+            self.fail("Deply Vm in shared network failed! - %s" % e)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_configs.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_configs.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_configs.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_configs.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1381 @@
+# 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.
+""" P1 tests for Project
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test Project Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                        },
+                        "project": {
+                                    "name": "Project",
+                                    "displaytext": "Test project",
+                        },
+                         "mgmt_server": {
+                                   "ipaddress": '192.168.100.21',
+                                   "username": 'root',
+                                   "password": 'password',
+                                   "port": 22,
+                        },
+                        "account": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "user": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "User",
+                                    "lastname": "User",
+                                    "username": "User",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                         },
+                         "template": {
+                                "displaytext": "Public Template",
+                                "name": "Public template",
+                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                                "hypervisor": 'XenServer',
+                                "format": 'VHD',
+                                "isfeatured": True,
+                                "ispublic": True,
+                                "isextractable": True,
+                        },
+                        "configs": {
+                                "project.invite.timeout": 300,
+                        },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced'
+                    }
+
+
+class TestUserProjectCreation(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUserProjectCreation,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='allow.user.create.projects'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: allow.user.create.projects")
+        elif (configs[0].value).lower() != 'true':
+            raise unittest.SkipTest("'allow.user.create.projects' should be true")
+
+        # Create domains, account etc.
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user, cls.domain]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(configuration = "allow.user.create.projects")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_admin_project_creation(self):
+        """Test create project as a domain admin and domain user
+        """
+        # Validate the following
+        # 1. Check if 'allow.user.create.projects' configuration is true
+        # 2. Create a Project as domain admin
+        # 3. Create a Project as domain user
+        # 4. In both 2 and 3 project creation should be successful
+
+        configs = Configurations.list(
+                                      self.apiclient,
+                                      name='allow.user.create.projects'
+                                      )
+        self.assertEqual(
+                            isinstance(configs, list),
+                            True,
+                            "Check for a valid list configurations response"
+                            )
+        config = configs[0]
+        self.assertEqual(
+                            (config.value).lower(),
+                            'true',
+                            "'allow.user.create.projects' should be true"
+                            )
+
+        # Create project as a domain admin
+
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.user.account.name,
+                                 domainid=self.user.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain user with ID: %s" %
+                                                            project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+        return
+
+
+class TestProjectCreationNegative(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestProjectCreationNegative,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Checking for prereqisits - global configs
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='allow.user.create.projects'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: allow.user.create.projects")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'allow.user.create.projects' should be false")
+
+        # Create domains, account etc.
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user, cls.domain]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(configuration = "allow.user.create.projects")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    @unittest.skip("Known bug-able to create project as a domain user")
+    def test_user_project_creation(self):
+        """Test create project as a domain admin and domain user
+        """
+        # Validate the following
+        # 1. Check if 'allow.user.create.projects' configuration is false
+        # 2. Create a Project as domain admin. Project creation should be
+        #    successful.
+        # 3. Create a Project as domain user. Project creation should fail
+
+        configs = Configurations.list(
+                                      self.apiclient,
+                                      name='allow.user.create.projects'
+                                      )
+        self.assertEqual(
+                            isinstance(configs, list),
+                            True,
+                            "Check for a valid list configurations response"
+                            )
+        config = configs[0]
+        self.assertEqual(
+                            (config.value).lower(),
+                            'false',
+                            "'allow.user.create.projects' should be true"
+                            )
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        with self.assertRaises(Exception):
+            project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.user.account.name,
+                                 domainid=self.user.account.domainid
+                                 )
+            self.debug("Project creation with domain user: %s failed" %
+                                                    self.user.account.name)
+        return
+
+
+class TestProjectInviteRequired(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                                TestProjectInviteRequired,
+                                cls
+                            ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create domains, account etc.
+        cls.domain = get_domain(cls.api_client, cls.services)
+
+        # Verify 'project.invite.required' is set to false
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("The 'project.invite.required' is not found in global configs")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be false")
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["user"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_add_user_to_project(self):
+        """Add user to project when 'project.invite.required' is false"""
+
+
+        # Validate the following:
+        # 1. Create a Project
+        # 2. Add users to the project. Verify user is added to project
+        #    as regular user
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+         # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                            self.apiclient,
+                                            projectid=project.id,
+                                            account=self.user.account.name,
+                                            )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+
+        return
+
+class TestProjectInviteRequiredTrue(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                                TestProjectInviteRequiredTrue,
+                                cls
+                            ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create domains, account etc.
+        cls.domain = get_domain(cls.api_client, cls.services)
+
+        # Verify 'project.invite.required' is set to true
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("The 'project.invite.required' is not found in global configs")
+        elif (configs[0].value).lower() != 'true':
+            raise unittest.SkipTest("'project.invite.required' should be true")
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["user"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(configuration = "project.invite.required")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_add_user_to_project(self):
+        """Add user to project when 'project.invite.required' is true"""
+
+
+        # Validate the following:
+        # 1. Create a Project
+        # 2. Add users to the project. verify user is shown in pending state
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+         # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        state='Pending',
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Pending',
+                    "Newly added user is not added as a regular user"
+                    )
+        return
+
+
+class TestProjectInviteTimeout(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                                TestProjectInviteTimeout,
+                                cls
+                            ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create domains, account etc.
+        cls.domain = get_domain(cls.api_client, cls.services)
+
+        # Verify 'project.invite.required' is set to true
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("The 'project.invite.required' is not found in global configs")
+        elif (configs[0].value).lower() != 'true':
+            raise unittest.SkipTest("'project.invite.required' should be true")
+
+        # Verify 'project.invite.timeout' is set to 300
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.timeout'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("The 'project.invite.timeout' is not found in global configs")
+        elif int(configs[0].value) != cls.services["configs"]["project.invite.timeout"]:
+            raise unittest.SkipTest("'project.invite.timeout' should be: %s " %
+                            cls.services["configs"]["project.invite.timeout"])
+
+        cls.config = configs[0]
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["user"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(configuration = "project.invite.timeout")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_invitation_timeout(self):
+        """Test global config project invitation timeout"""
+
+
+        # Validate the following:
+        # 1. Set configuration to 5 mins
+        # 2. Create a Project
+        # 3. Add users to the project
+        # 4. As a user accept invitation within 5 mins. Verify invitation is
+        #    accepted and user become regular user of project
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+         # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        state='Pending',
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Pending',
+                    "Newly added user is not added as a regular user"
+                    )
+
+        # Accept the invite
+        ProjectInvitation.update(
+                                 self.apiclient,
+                                 projectid=project.id,
+                                 accept=True,
+                                 account=self.user.account.name
+                                 )
+        self.debug(
+            "Accepting project invitation for project: %s user: %s" % (
+                                                      project.name,
+                                                      self.user.account.name
+                                                      ))
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                            self.apiclient,
+                                            projectid=project.id,
+                                            account=self.user.account.name,
+                                            )
+
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        return
+
+    @attr(configuration = "project.invite.timeout")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_02_invitation_timeout_after_expiry(self):
+        """Test global config project invitation timeout"""
+
+
+        # Validate the following:
+        # 1. Set configuration to 5 mins
+        # 2. Create a Project
+        # 3. Add users to the project
+        # 4. As a user accept invitation after 5 mins. Verify invitation is
+        #    not accepted and is shown as expired
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+         # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        state='Pending',
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Pending',
+                    "Newly added user is not added as a regular user"
+                    )
+
+        # sleep for 'project.invite.timeout' * 2 interval to wait for invite
+        # to expire
+        time.sleep(int(self.config.value) * 2)
+
+        with self.assertRaises(Exception):
+            # Accept the invite
+            ProjectInvitation.update(
+                                 self.apiclient,
+                                 projectid=project.id,
+                                 accept=True,
+                                 account=self.user.account.name
+                                 )
+            self.debug(
+                "Accepting invitation after expiry project: %s user: %s" % (
+                                                      project.name,
+                                                      self.user.account.name
+                                                      ))
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Expired',
+                    "Newly added user is not added as a regular user"
+                    )
+        return
+
+    @attr(configuration = "project.invite.timeout")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_03_invite_after_expiry(self):
+        """Test global config project invitation timeout"""
+
+        # Validate the following:
+        # 1. Set configuration to 5 mins
+        # 2. Create a Project
+        # 3. Add users to the project
+        # 4. As a user accept invitation after 5 mins.
+        # 5. Resend the invitation
+        # 6. Verify invitation is sent again
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        state='Pending',
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Pending',
+                    "Newly added user is not added as a regular user"
+                    )
+
+        # sleep for 'project.invite.timeout' * 2 interval to wait for invite
+        # to expire
+        time.sleep(int(self.config.value) * 2)
+
+        self.debug("Adding %s user again to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        state='Pending',
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Pending',
+                    "Newly added user is not added as a regular user"
+                    )
+        return
+
+    @attr(configuration = "project.invite.timeout")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_04_decline_invitation(self):
+        """Test decline invitation"""
+
+        # Validate the following:
+        # 1. Set configuration to 5 mins
+        # 2. Create a Project
+        # 3. Add users to the project
+        # 4. As a user decline invitation within 5 mins.
+        # 5. Verify invitation is rejected and user doesn't become regular
+        #    user.
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                      self.user.account.name,
+                                                      project.name
+                                                      ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = ProjectInvitation.list(
+                                        self.apiclient,
+                                        state='Pending',
+                                        account=self.user.account.name,
+                                        domainid=self.user.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                    account.state,
+                    'Pending',
+                    "Newly added user is not added as a regular user"
+                    )
+        # Accept the invite
+        ProjectInvitation.update(
+                                 self.apiclient,
+                                 projectid=project.id,
+                                 accept=False,
+                                 account=self.user.account.name
+                                 )
+        self.debug(
+                "Declining invitation for project: %s user: %s" % (
+                                                      project.name,
+                                                      self.user.account.name
+                                                      ))
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                            self.apiclient,
+                                            projectid=project.id,
+                                            account=self.user.account.name,
+                                            )
+        self.assertEqual(
+                            accounts_reponse,
+                            None,
+                            "Check for a valid list accounts response"
+                            )
+        return
+
+    @unittest.skip("Requires SMPT configs")
+    def test_09_invite_to_project_by_email(self):
+        """Test invite user to project by email"""
+        
+        # Validate the following:
+        # 1. Set configuration to 5 mins
+        # 2. Create a Project
+        # 3. Add users to the project
+        # 4. As a user decline invitation within 5 mins.
+        # 5. Verify invitation is rejected and user doesn't become regular
+        #    user.
+
+        # Verify 'project.invite.required' is set to false
+        configs = Configurations.list(
+                                      self.apiclient,
+                                      name='project.invite.timeout'
+                                      )
+        self.assertEqual(
+                            isinstance(configs, list),
+                            True,
+                            "Check for a valid list configurations response"
+                            )
+        config = configs[0]
+        self.assertEqual(
+                    int(config.value),
+                    self.services["configs"]["project.invite.timeout"],
+                    "'project.invite.timeout' should be %s" %
+                            self.services["configs"]["project.invite.timeout"]
+                    )
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding user with email: %s to project: %s" % (
+                                                      self.user.account.email,
+                                                      project.name
+                                                      ))
+
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           email=self.user.account.user[0].email
+                           )
+
+        # Fetch the latest mail sent to user
+        mail_content = fetch_latest_mail(
+                                         self.services["mail_account"],
+                                         from_mail=self.user.account.user[0].email
+                                         )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_limits.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_limits.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_limits.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_limits.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1047 @@
+# 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.
+""" P1 tests for Resource limits
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+import datetime
+
+
+class Services:
+    """Test Resource Limits Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                        },
+                        "project": {
+                                    "name": "Project",
+                                    "displaytext": "Test project",
+                        },
+                        "account": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "user": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "User",
+                                    "lastname": "User",
+                                    "username": "User",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Tiny Disk Offering",
+                                    "name": "Tiny Disk Offering",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                   "diskname": "Test Volume",
+                        },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                        },
+                        "template": {
+                                    "displaytext": "Cent OS Template",
+                                    "name": "Cent OS Template",
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                        },
+                        "network_offering": {
+                                    "name": 'Network offering-VR services',
+                                    "displaytext": 'Network offering-VR services',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'VirtualRouter',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                        },
+                                    },
+                         "network": {
+                                  "name": "Test Network",
+                                  "displaytext": "Test Network",
+                                },
+                        "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced',
+                    }
+
+
+class TestProjectLimits(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestProjectLimits,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create domains, account etc.
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.admin = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["user"],
+                            domainid=cls.domain.id
+                            )
+        cls._cleanup = [
+            cls.admin,
+            cls.user,
+            cls.domain
+            ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_project_limits(self):
+        """ Test project limits
+        """
+        # Validate the following
+        # 1. Create a Project. Verify once projects are created, they inherit
+        #    a default set of resource limits as configured by the Cloud Stack
+        #    ROOT admin.
+        # 2. Reduce Project resources limits. Verify limits can be reduced by
+        #    the Project Owner of each project and project limit applies to
+        #    number of virtual instances, disk volumes, snapshots, IP address.
+        #    Also, verify resource limits for the project are independent of
+        #    account resource limits
+        # 3. Increase Projects Resources limits above domains limit. Verify
+        #    project can’t have more resources than domain level limit allows.
+        # 4. Create Resource more than its set limit for a project. Verify
+        #    resource allocation should fail giving proper message
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.admin.account.name,
+                                 domainid=self.admin.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        # Get the resource limits for ROOT domain
+        resource_limits = list_resource_limits(self.apiclient)
+
+        self.assertEqual(
+                         isinstance(resource_limits, list),
+                         True,
+                         "List resource API should return a valid list"
+                         )
+        self.assertNotEqual(
+                         len(resource_limits),
+                         0,
+                         "List resource API response should not be empty"
+                         )
+
+        # Reduce resource limits for project
+        # Resource: 0 - Instance. Number of instances a user can create.
+        # Resource: 1 - IP. Number of public IP addresses a user can own.
+        # Resource: 2 - Volume. Number of disk volumes a user can create.
+        # Resource: 3 - Snapshot. Number of snapshots a user can create.
+        # Resource: 4 - Template. Number of templates that a user can
+        #               register/create
+        for resource in resource_limits:
+            update_resource_limit(
+                                    self.apiclient,
+                                    resource.resourcetype,
+                                    max=1,
+                                    projectid=project.id
+                                    )
+            self.debug(
+            "Updating resource (ID: %s) limit for project: %s" % (
+                                                                  resource,
+                                                                  project.id
+                                                                  ))
+        resource_limits = list_resource_limits(
+                                                self.apiclient,
+                                                projectid=project.id
+                                                )
+        self.assertEqual(
+                         isinstance(resource_limits, list),
+                         True,
+                         "List resource API should return a valid list"
+                         )
+        self.assertNotEqual(
+                         len(resource_limits),
+                         0,
+                         "List resource API response should not be empty"
+                         )
+        for resource in resource_limits:
+            self.assertEqual(
+                         resource.max,
+                         1,
+                         "Resource limit should be updated to 1"
+                         )
+
+        # Get the resource limits for domain
+        resource_limits = list_resource_limits(
+                                                self.apiclient,
+                                                domainid=self.domain.id
+                                                )
+        self.assertEqual(
+                         isinstance(resource_limits, list),
+                         True,
+                         "List resource API should return a valid list"
+                         )
+        self.assertNotEqual(
+                         len(resource_limits),
+                         0,
+                         "List resource API response should not be empty"
+                         )
+
+        for resource in resource_limits:
+            # Update domain resource limits to 2
+            update_resource_limit(
+                                        self.apiclient,
+                                        resource.resourcetype,
+                                        domainid=self.domain.id,
+                                        max=2
+                                      )
+            with self.assertRaises(Exception):
+                self.debug(
+                    "Attempting to update project: %s resource limit to: %s" % (
+                                                                project.id,
+                                                                max_value
+                                                                ))
+                # Update project resource limits to 3
+                update_resource_limit(
+                                        self.apiclient,
+                                        resource.resourcetype,
+                                        max=3,
+                                        projectid=project.id
+                                      )
+        return
+
+    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    @unittest.skip("No provision for updating resource limits from account through API")
+    def test_02_project_limits_normal_user(self):
+        """ Test project limits
+        """
+        # Validate the following
+        # 1. Create a Project
+        # 2. Reduce the projects limits as a domain admin. Verify resource
+        #    count is updated
+        # 3. Reduce the projects limits as a project user owner who is not a
+        #    domain admin. Resource count should fail
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.admin.account.name,
+                                 domainid=self.admin.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        # Get the resource limits for ROOT domain
+        resource_limits = list_resource_limits(self.apiclient)
+
+        self.assertEqual(
+                         isinstance(resource_limits, list),
+                         True,
+                         "List resource API should return a valid list"
+                         )
+        self.assertNotEqual(
+                         len(resource_limits),
+                         0,
+                         "List resource API response should not be empty"
+                         )
+
+        # Reduce resource limits for project
+        # Resource: 0 - Instance. Number of instances a user can create.
+        # Resource: 1 - IP. Number of public IP addresses a user can own.
+        # Resource: 2 - Volume. Number of disk volumes a user can create.
+        # Resource: 3 - Snapshot. Number of snapshots a user can create.
+        # Resource: 4 - Template. Number of templates that a user can
+        #               register/create
+        for resource in resource_limits:
+            update_resource_limit(
+                                    self.apiclient,
+                                    resource.resourcetype,
+                                    max=1,
+                                    projectid=project.id
+                                    )
+            self.debug(
+            "Updating resource (ID: %s) limit for project: %s" % (
+                                                                  resource,
+                                                                  project.id
+                                                                  ))
+        resource_limits = list_resource_limits(
+                                                self.apiclient,
+                                                projectid=project.id
+                                                )
+        self.assertEqual(
+                         isinstance(resource_limits, list),
+                         True,
+                         "List resource API should return a valid list"
+                         )
+        self.assertNotEqual(
+                         len(resource_limits),
+                         0,
+                         "List resource API response should not be empty"
+                         )
+        for resource in resource_limits:
+            self.assertEqual(
+                         resource.max,
+                         1,
+                         "Resource limit should be updated to 1"
+                         )
+
+        self.debug("Adding %s user to project: %s" % (
+                                                self.user.account.name,
+                                                project.name
+                                                ))
+
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           )
+
+        # Get the resource limits for domain
+        resource_limits = list_resource_limits(
+                                                self.apiclient,
+                                                domainid=self.domain.id
+                                                )
+        self.assertEqual(
+                         isinstance(resource_limits, list),
+                         True,
+                         "List resource API should return a valid list"
+                         )
+        self.assertNotEqual(
+                         len(resource_limits),
+                         0,
+                         "List resource API response should not be empty"
+                         )
+
+        for resource in resource_limits:
+            #with self.assertRaises(Exception):
+            self.debug(
+                    "Attempting to update resource limit by user: %s" % (
+                                                        self.user.account.name
+                                                        ))
+            # Update project resource limits to 3
+            update_resource_limit(
+                                    self.apiclient,
+                                    resource.resourcetype,
+                                    account=self.user.account.name,
+                                    domainid=self.user.account.domainid,
+                                    max=3,
+                                    projectid=project.id
+                                )
+        return
+
+
+class TestResourceLimitsProject(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestResourceLimitsProject, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create Domains, Account etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        # Create project as a domain admin
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+        cls.services["account"] = cls.account.account.name
+
+        # Create Service offering and disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_03_vm_per_project(self):
+        """Test VM limit per project
+        """
+        # Validate the following
+        # 1. Set max VM per project to 2
+        # 2. Create account and start 2 VMs. Verify VM state is Up and Running
+        # 3. Try to create 3rd VM instance. The appropriate error or alert
+        #    should be raised
+
+        self.debug(
+            "Updating instance resource limits for project: %s" %
+                                                        self.project.id)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              0, # Instance
+                              max=2,
+                              projectid=self.project.id
+                              )
+
+        self.debug("Deploying VM for project: %s" % self.project.id)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        self.debug("Deploying VM for project: %s" % self.project.id)
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        # Exception should be raised for second instance
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        return
+
+    @attr(tags=["advanced", "eip", "advancedns", "simulator"])
+    def test_04_publicip_per_project(self):
+        """Test Public IP limit per project
+        """
+        # Validate the following
+        # 1. set max no of IPs per project to 2.
+        # 2. Create an account in this domain
+        # 3. Create 1 VM in this domain
+        # 4. Acquire 1 IP in the domain. IP should be successfully acquired
+        # 5. Try to acquire 3rd IP in this domain. It should give the user an
+        #    appropriate error and an alert should be generated.
+
+        self.debug(
+            "Updating public IP resource limits for project: %s" %
+                                                            self.project.id)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              1, # Public Ip
+                              max=2,
+                              projectid=self.project.id
+                              )
+
+        self.debug("Deploying VM for Project: %s" % self.project.id)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        networks = Network.list(
+                                self.apiclient,
+                                projectid=self.project.id,
+                                listall=True
+                                )
+        self.assertEqual(
+                    isinstance(networks, list),
+                    True,
+                    "Check list networks response returns a valid response"
+                    )
+        self.assertNotEqual(
+                    len(networks),
+                    0,
+                    "Check list networks response returns a valid network"
+                    )
+        network = networks[0]
+        self.debug("Associating public IP for project: %s" %
+                                                            self.project.id)
+        public_ip_1 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           zoneid=virtual_machine_1.zoneid,
+                                           services=self.services["server"],
+                                           networkid=network.id,
+                                           projectid=self.project.id
+                                           )
+        self.cleanup.append(public_ip_1)
+        # Verify Public IP state
+        self.assertEqual(
+                            public_ip_1.ipaddress.state in [
+                                                 'Allocated',
+                                                 'Allocating'
+                                                 ],
+                            True,
+                            "Check Public IP state is allocated or not"
+                        )
+
+        # Exception should be raised for second Public IP
+        with self.assertRaises(Exception):
+            public_ip_2 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           zoneid=virtual_machine_1.zoneid,
+                                           services=self.services["server"],
+                                           networkid=network.id,
+                                           projectid=self.project.id
+                                           )
+        return
+
+    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_05_snapshots_per_project(self):
+        """Test Snapshot limit per project
+        """
+        # Validate the following
+        # 1. set max no of snapshots per project to 1.
+        # 2. Create one snapshot in the project. Snapshot should be
+        #    successfully created
+        # 5. Try to create another snapshot in this project. It should give
+        #    user an appropriate error and an alert should be generated.
+
+        self.debug(
+            "Updating snapshot resource limits for project: %s" %
+                                        self.project.id)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              3, # Snapshot
+                              max=1,
+                              projectid=self.project.id
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            projectid=self.project.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        # Create a snapshot from the ROOTDISK
+        snapshot_1 = Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            projectid=self.project.id
+                            )
+        self.cleanup.append(snapshot_1)
+        # Verify Snapshot state
+        self.assertEqual(
+                            snapshot_1.state in [
+                                                 'BackedUp',
+                                                 'CreatedOnPrimary'
+                                                 ],
+                            True,
+                            "Check Snapshot state is Running or not"
+                        )
+
+        # Exception should be raised for second snapshot
+        with self.assertRaises(Exception):
+            Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            projectid=self.project.id
+                            )
+        return
+
+    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_06_volumes_per_project(self):
+        """Test Volumes limit per project
+        """
+        # Validate the following
+        # 1. set max no of volume per project to 1.
+        # 2. Create 1 VM in this project
+        # 4. Try to Create another VM in the project. It should give the user
+        #    an appropriate error that Volume limit is exhausted and an alert
+        #    should be generated.
+
+        self.debug(
+            "Updating volume resource limits for project: %s" %
+                                                    self.project.id)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              2, # Volume
+                              max=2,
+                              projectid=self.project.id
+                              )
+
+        self.debug("Deploying VM for project: %s" % self.project.id)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Exception should be raised for second volume
+        with self.assertRaises(Exception):
+            Volume.create(
+                          self.apiclient,
+                          self.services["volume"],
+                          zoneid=self.zone.id,
+                          diskofferingid=self.disk_offering.id,
+                          projectid=self.project.id
+                        )
+        return
+
+    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_07_templates_per_project(self):
+        """Test Templates limit per project
+        """
+        # 1. set max no of templates per project to 1.
+        # 2. Create a template in this project. Both template should be in
+        #    ready state
+        # 3. Try create 2nd template in the project. It should give the user
+        #    appropriate error and an alert should be generated.
+
+        # Reset the volume limits
+        update_resource_limit(
+                              self.apiclient,
+                              2, # Volume
+                              max=5,
+                              projectid=self.project.id
+                              )
+        self.debug(
+            "Updating template resource limits for domain: %s" %
+                                        self.account.account.domainid)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              4, # Template
+                              max=1,
+                              projectid=self.project.id
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        virtual_machine_1.stop(self.apiclient)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            projectid=self.project.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating template from volume: %s" % volume.id)
+        # Create a template from the ROOTDISK
+        template_1 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            projectid=self.project.id
+                            )
+
+        self.cleanup.append(template_1)
+        # Verify Template state
+        self.assertEqual(
+                            template_1.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+
+        # Exception should be raised for second template
+        with self.assertRaises(Exception):
+            Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            projectid=self.project.id
+                            )
+        return
+
+
+class TestMaxProjectNetworks(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestMaxProjectNetworks,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator",
+                "api", "basic", "eip", "sg"])
+    def test_maxAccountNetworks(self):
+        """Test Limit number of guest account specific networks
+        """
+
+        # Steps for validation
+        # 1. Fetch max.account.networks from configurations
+        # 2. Create an account. Create account more that max.accout.network
+        # 3. Create network should fail
+
+        self.debug("Creating project with '%s' as admin" %
+                                            self.account.account.name)
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        config = Configurations.list(
+                                    self.apiclient,
+                                    name='max.project.networks',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(config, list),
+                True,
+                "List configurations hsould have max.project.networks"
+                )
+
+        config_value = int(config[0].value)
+        self.debug("max.project.networks: %s" % config_value)
+
+        for ctr in range(config_value):
+            # Creating network using the network offering created
+            self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+            network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    projectid=project.id,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+            self.debug("Created network with ID: %s" % network.id)
+        self.debug(
+            "Creating network in account already having networks : %s" %
+                                                            config_value)
+
+        with self.assertRaises(Exception):
+            Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    projectid=project.id,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug('Create network failed (as expected)')
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_resources.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_resources.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_resources.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_resources.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1320 @@
+# 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.
+""" P1 tests for Resource creation
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test Resource creation Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                        },
+                        "project": {
+                                    "name": "Project",
+                                    "displaytext": "Test project",
+                        },
+                        "account": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "user": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "User",
+                                    "lastname": "User",
+                                    "username": "User",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Tiny Disk Offering",
+                                    "name": "Tiny Disk Offering",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                   "diskname": "Test Volume",
+                        },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                        },
+                        "template": {
+                                    "displaytext": "Cent OS Template",
+                                    "name": "Cent OS Template",
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                                    "ispublic": False,
+                        },
+                        "network": {
+                                    "name": "Test Network",
+                                    "displaytext": "Test Network",
+                        },
+                        "domain_network": {
+                                    "name": "Domainwide Network",
+                                    "displaytext": "Domainwide Network",
+                                    "gateway": '192.168.100.1',
+                                    "netmask": '255.255.255.0',
+                                    "startip": '192.168.100.200',
+                                    "endip": '192.168.100.201',
+                                    "vlan": 4001,
+                                    "acltype": 'domain'
+                        },
+                        "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                        },
+                        "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                        },
+                        "fw_rule": {
+                                    "startport": 1,
+                                    "endport": 6000,
+                                    "cidr": '55.55.0.0/11',
+                                    # Any network (For creating FW rule)
+                        },
+                        "security_group": {
+                                    "name": 'SSH',
+                                    "protocol": 'TCP',
+                                    "startport": 22,
+                                    "endport": 22,
+                                    "cidrlist": '0.0.0.0/0',
+                        },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced',
+                    }
+
+
+class TestOfferings(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestOfferings,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone and template
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create domains, account etc.
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            domainid=cls.domain.id
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering,
+                        cls.disk_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_service_offerings(self):
+        """ Test service offerings in a project
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. List service offerings for the project. All SO available in the
+        #    domain can be used for project resource creation.
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        self.debug(
+            "Deploying VM instance for project: %s & service offering: %s" % (
+                                                    project.id,
+                                                    self.service_offering.id
+                                                    ))
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=project.id
+                                )
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_02_project_disk_offerings(self):
+        """ Test project disk offerings
+        """
+
+        # Validate the following
+        # 1. Create a project.
+        # 2. List service offerings for the project. All disk offerings
+        #    available in the domain can be used for project resource creation
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug(
+            "Create a data volume for project: %s" % project.id)
+        # Create a volume for project
+        volume = Volume.create(
+                               self.apiclient,
+                               self.services["volume"],
+                               zoneid=self.zone.id,
+                               diskofferingid=self.disk_offering.id,
+                               projectid=project.id
+                               )
+        self.cleanup.append(volume)
+        # Verify Volume state
+        self.assertEqual(
+                            volume.state in [
+                                                 'Allocated',
+                                                 'Ready'
+                                                 ],
+                            True,
+                            "Check Volume state is Ready or not"
+                        )
+        return
+
+
+class TestNetwork(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNetwork,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone and template
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create domains, account etc.
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            domainid=cls.domain.id
+                                            )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_03_network_create(self):
+        """ Test create network in project
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Add virtual/direct network resource to the project. User shared
+        #    network resource for the project
+        # 3. Verify any number of Project level Virtual/Direct networks can be
+        #    created and used for vm deployment within the project.
+        # 4. Verify shared networks (zone and domain wide) from outside the
+        #    project can also be used in a project.
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        network_offerings = list_network_offerings(
+                                                self.apiclient,
+                                                projectid=project.id,
+                                                supportedServices='SourceNat',
+                                                type='isolated',
+                                                state='Enabled'
+                                                )
+        self.assertEqual(
+                         isinstance(network_offerings, list),
+                         True,
+                         "Check for the valid network offerings"
+                         )
+        network_offering = network_offerings[0]
+
+        self.debug("creating a network with network offering ID: %s" %
+                                                        network_offering.id)
+        self.services["network"]["zoneid"] = self.zone.id
+        network = Network.create(
+                                 self.apiclient,
+                                 self.services["network"],
+                                 networkofferingid=network_offering.id,
+                                 projectid=project.id
+                                 )
+        self.debug("Created network with ID: %s" % network.id)
+        networks = Network.list(
+                               self.apiclient,
+                               projectid=project.id,
+                               listall=True
+                               )
+        self.assertEqual(
+                         isinstance(networks, list),
+                         True,
+                         "Check for the valid network list response"
+                         )
+        network_response = networks[0]
+
+        self.debug("Deploying VM with network: %s" % network.id)
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                networkids=[str(network.id)],
+                                serviceofferingid=self.service_offering.id,
+                                projectid=project.id
+                                )
+        self.debug("Deployed VM with ID: %s" % virtual_machine.id)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        network_offerings = list_network_offerings(
+                                        self.apiclient,
+                                        state='Enabled',
+                                        guestiptype='Shared',
+                                        name='DefaultSharedNetworkOffering',
+                                        displaytext='Offering for Shared networks'
+                                        )
+        self.assertEqual(
+                         isinstance(network_offerings, list),
+                         True,
+                         "Check for the valid network offerings"
+                         )
+        network_offering = network_offerings[0]
+
+        self.debug("creating a shared network in domain: %s" %
+                                                        self.domain.id)
+        domain_network = Network.create(
+                                 self.apiclient,
+                                 self.services["domain_network"],
+                                 domainid=self.domain.id,
+                                 networkofferingid=network_offering.id,
+                                 zoneid=self.zone.id
+                                 )
+        self._cleanup.append(domain_network)
+        self.debug("Created network with ID: %s" % domain_network.id)
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                networkids=[str(domain_network.id)],
+                                serviceofferingid=self.service_offering.id,
+                                projectid=project.id
+                                )
+        self.debug("Deployed VM with ID: %s" % virtual_machine.id)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        return
+
+
+class TestTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestTemplates,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create Domains, Account etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        # Create project as a domain admin
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+        cls.services["account"] = cls.account.account.name
+
+        # Create Service offering and disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        cls.user,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_04_public_template_use_in_project(self):
+        """Test Templates creation in projects
+        """
+        # 1. Create a project
+        # 2. Verify Public templates can be used without any restriction
+        # 3. Verify that template created in project can be used in project
+        #    without any restrictions
+
+        self.debug("Deploying VM for with public template: %s" %
+                                                        self.template.id)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        virtual_machine_1.stop(self.apiclient)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            projectid=self.project.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating template from volume: %s" % volume.id)
+        # Create a template from the ROOTDISK
+        template_1 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            projectid=self.project.id
+                            )
+
+        self.cleanup.append(template_1)
+        # Verify Template state
+        self.assertEqual(
+                            template_1.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_05_use_private_template_in_project(self):
+        """Test use of private template in a project
+        """
+        # 1. Create a project
+        # 2. Verify that in order to use somebody’s Private template for vm
+        #    creation in the project, permission to use the template has to
+        #    be granted to the Project (use API “updateTemplatePermissions”
+        #    with project id to achieve that).
+
+        self.debug("Deploying VM for with public template: %s" %
+                                                        self.template.id)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        self.debug("Stopping the VM: %s" % virtual_machine_1.id)
+        virtual_machine_1.stop(self.apiclient)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            projectid=self.project.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating template from volume: %s" % volume.id)
+        # Create a template from the ROOTDISK
+        template_1 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            projectid=self.project.id
+                            )
+
+        self.cleanup.append(template_1)
+        # Verify Template state
+        self.assertEqual(
+                            template_1.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+
+        # Update template permissions to grant permission to project
+        self.debug(
+          "Updating template permissions:%s to grant access to project: %s" % (
+                                                            template_1.id,
+                                                            self.project.id
+                                                        ))
+
+        template_1.updatePermissions(
+                                     self.apiclient,
+                                     op='add',
+                                     projectids=self.project.id
+                                     )
+        self.debug("Deploying VM for with privileged template: %s" %
+                                                        self.template.id)
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=template_1.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        return
+
+
+class TestSnapshots(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestSnapshots,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create Domains, Account etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        # Create project as a domain admin
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+        cls.services["account"] = cls.account.account.name
+
+        # Create Service offering and disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_06_create_snapshots_in_project(self):
+        """Test create snapshots in project
+        """
+        # Validate the following
+        # 1. Create a project
+        # 2. Add some snapshots to the project
+        # 3. Verify snapshot created inside project can only be used in inside
+        #    the project
+
+        self.debug("Deploying VM for Project: %s" % self.project.id)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            projectid=self.project.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        # Create a snapshot from the ROOTDISK
+        snapshot = Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            projectid=self.project.id
+                            )
+        self.cleanup.append(snapshot)
+        # Verify Snapshot state
+        self.assertEqual(
+                            snapshot.state in [
+                                                 'BackedUp',
+                                                 'CreatedOnPrimary'
+                                                 ],
+                            True,
+                            "Check Snapshot state is Running or not"
+                        )
+
+        snapshots = Snapshot.list(
+                                  self.apiclient,
+                                  account=self.account.account.name,
+                                  domainid=self.account.account.domainid
+                                  )
+        self.assertEqual(
+                    snapshots,
+                    None,
+                    "Snapshots should not be available outside the project"
+                    )
+        return
+
+
+class TestPublicIpAddress(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestPublicIpAddress,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create Domains, Account etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        # Create project as a domain admin
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+        cls.services["account"] = cls.account.account.name
+
+        # Create Service offering and disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=cls.template.id,
+                                    serviceofferingid=cls.service_offering.id,
+                                    projectid=cls.project.id
+                                )
+
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_07_associate_public_ip(self):
+        """Test associate public IP within the project
+        """
+        # Validate the following
+        # 1. Create a project
+        # 2. Add some public Ips to the project
+        # 3. Verify public IP assigned can only used to create PF/LB rules
+        #    inside project
+
+        networks = Network.list(
+                                self.apiclient,
+                                projectid=self.project.id,
+                                listall=True
+                                )
+        self.assertEqual(
+                    isinstance(networks, list),
+                    True,
+                    "Check list networks response returns a valid response"
+                    )
+        self.assertNotEqual(
+                    len(networks),
+                    0,
+                    "Check list networks response returns a valid network"
+                    )
+        network = networks[0]
+        self.debug("Associating public IP for project: %s" % self.project.id)
+        public_ip = PublicIPAddress.create(
+                                           self.apiclient,
+                                           zoneid=self.virtual_machine.zoneid,
+                                           services=self.services["server"],
+                                           networkid=network.id,
+                                           projectid=self.project.id
+                                           )
+        self.cleanup.append(public_ip)
+
+        #Create NAT rule
+        self.debug(
+                "Creating a NAT rule within project, VM ID: %s" %
+                                                    self.virtual_machine.id)
+        nat_rule = NATRule.create(
+                                  self.apiclient,
+                                  self.virtual_machine,
+                                  self.services["natrule"],
+                                  public_ip.ipaddress.id,
+                                  projectid=self.project.id
+                                  )
+        self.debug("created a NAT rule with ID: %s" % nat_rule.id)
+        nat_rule_response = NATRule.list(
+                                            self.apiclient,
+                                            id=nat_rule.id
+                                        )
+        self.assertEqual(
+                            isinstance(nat_rule_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(nat_rule_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        self.assertEqual(
+                            nat_rule_response[0].id,
+                            nat_rule.id,
+                            "Check Correct Port forwarding Rule is returned"
+                        )
+
+        #Create Load Balancer rule and assign VMs to rule
+        self.debug("Created LB rule for public IP: %s" %
+                                        public_ip.ipaddress.ipaddress)
+        lb_rule = LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          public_ip.ipaddress.id,
+                                          projectid=self.project.id
+                                          )
+        self.cleanup.append(lb_rule)
+        self.debug("Assigning VM: %s to LB rule: %s" % (
+                                                    self.virtual_machine.name,
+                                                    lb_rule.id
+                                                    ))
+        lb_rule.assign(self.apiclient, [self.virtual_machine])
+
+        lb_rules = list_lb_rules(
+                                 self.apiclient,
+                                 id=lb_rule.id
+                                 )
+        self.assertEqual(
+                            isinstance(lb_rules, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #verify listLoadBalancerRules lists the added load balancing rule
+        self.assertNotEqual(
+                            len(lb_rules),
+                            0,
+                            "Check Load Balancer Rule in its List"
+                        )
+        self.assertEqual(
+                            lb_rules[0].id,
+                            lb_rule.id,
+                            "Check List Load Balancer Rules returns valid Rule"
+                        )
+
+        #Create Firewall rule with configurations from settings file
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=public_ip.ipaddress.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"],
+                            projectid=self.project.id
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        # After Router start, FW rule should be in Active state
+        fw_rules = FireWallRule.list(
+                                     self.apiclient,
+                                     id=fw_rule.id,
+                                     )
+        self.assertEqual(
+                        isinstance(fw_rules, list),
+                        True,
+                        "Check for list FW rules response return valid data"
+                        )
+
+        self.assertEqual(
+                    fw_rules[0].state,
+                    'Active',
+                    "Check list load balancing rules"
+                    )
+        self.assertEqual(
+                    fw_rules[0].startport,
+                    str(self.services["fw_rule"]["startport"]),
+                    "Check start port of firewall rule"
+                    )
+
+        self.assertEqual(
+                    fw_rules[0].endport,
+                    str(self.services["fw_rule"]["endport"]),
+                    "Check end port of firewall rule"
+                    )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id,
+                                )
+        self.cleanup.append(virtual_machine_1)
+
+        self.debug("VM state after deploy: %s" % virtual_machine_1.state)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug("Creating NAT rule for VM (ID: %s) outside project" %
+                                                    virtual_machine_1.id)
+        with self.assertRaises(Exception):
+            NATRule.create(
+                                  self.apiclient,
+                                  virtual_machine_1,
+                                  self.services["natrule"],
+                                  public_ip.ipaddress.id,
+                                  )
+
+        self.debug("Creating LB rule for public IP: %s outside project" %
+                                                public_ip.ipaddress.ipaddress)
+        with self.assertRaises(Exception):
+            LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          public_ip.ipaddress.id,
+                                          accountid=self.account.account.name
+                                          )
+        self.debug(
+                "Creating firewall rule for public IP: %s outside project" %
+                                                public_ip.ipaddress.ipaddress)
+        with self.assertRaises(Exception):
+            FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=public_ip.ipaddress.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"],
+                            )
+        return
+
+
+class TestSecurityGroup(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestSecurityGroup,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["server"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        # Create project as a domain admin
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+        cls.services["account"] = cls.account.account.name
+
+        cls._cleanup = [
+                        cls.project,
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestSecurityGroup, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_08_security_group(self):
+        """Test security groups in project
+        """
+        # Validate the following:
+        # 1. Create a project
+        # 2. Assign some security groups to that project
+        # 3. Verify the security groups can only be assigned to VM belonging
+        #    to that project.
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              projectid=self.project.id
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              projectid=self.project.id
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertNotEqual(
+                            len(sercurity_groups),
+                            0,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                self.apiclient,
+                                self.services["security_group"],
+                                projectid=self.project.id
+                                )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        self.debug(
+            "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server"],
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id],
+                                    projectid=self.project.id
+                                )
+        self.debug("Deployed VM (ID: %s) in project: %s" % (
+                                                    self.virtual_machine.id,
+                                                    self.project.id
+                                                    ))
+        self.assertEqual(
+                         self.virtual_machine.state,
+                         'Running',
+                         "VM state should be running after deployment"
+                         )
+        # Deploy another VM with same security group outside the project
+        self.debug(
+            "Deploying VM with security group: %s outside project:%s" % (
+                                                            security_group.id,
+                                                            self.project.id
+                                                            ))
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server"],
+                                    serviceofferingid=self.service_offering.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    securitygroupids=[security_group.id],
+                                )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_projects.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_projects.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_projects.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_projects.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1715 @@
+# 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.
+""" P1 tests for Project
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test Project Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                        },
+                        "project": {
+                                    "name": "Project",
+                                    "displaytext": "Test project",
+                        },
+                         "mgmt_server": {
+                                   "ipaddress": '192.168.100.21',
+                                   "username": 'root',
+                                   "password": 'password',
+                                   "port": 22,
+                        },
+                        "account": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "user": {
+                                    "email": "administrator@clogeny.com",
+                                    "firstname": "User",
+                                    "lastname": "User",
+                                    "username": "User",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                        "disk_offering": {
+                                    "displaytext": "Tiny Disk Offering",
+                                    "name": "Tiny Disk Offering",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                "diskname": "Test Volume",
+                        },
+                        "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                         },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced'
+                    }
+
+
+class TestMultipleProjectCreation(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestMultipleProjectCreation,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create domains, account etc.
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_create_multiple_projects_by_account(self):
+        """ Verify an account can own multiple projects and can belong to
+            multiple projects
+        """
+        # Validate the following
+        # 1. Create multiple project. Verify at step 1 An account is allowed
+        #    to create multiple projects
+        # 2. add one account to multiple project. Verify at step 2 an account
+        #    is allowed to added to multiple project
+
+        # Create project as a domain admin
+        project_1 = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project_1)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project_1.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project_1.id,
+                                             listall=True
+                                             )
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project_1.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        # Create another project as a domain admin
+        project_2 = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project_2)
+        self.debug("Created project with domain user with ID: %s" %
+                                                            project_2.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project_2.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                        len(list_projects_reponse),
+                        0,
+                        "Check list project response returns a valid project"
+                        )
+
+        # Add user to the project
+        project_1.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                            self.apiclient,
+                                            projectid=project_1.id,
+                                            account=self.user.account.name,
+                                            )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        # Add user to the project
+        project_2.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           self.user.account.email
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                            self.apiclient,
+                                            projectid=project_2.id,
+                                            account=self.user.account.name,
+                                            )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        return
+
+
+class TestCrossDomainAccountAdd(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestCrossDomainAccountAdd,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        # Create domains, account etc.
+        cls.new_domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.new_domain.id
+                            )
+
+        cls._cleanup = [cls.account, cls.user]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_02_cross_domain_account_add(self):
+        """ Verify No cross domain projects
+        """
+        # Validate the following
+        # 1. Create a project in a domain.
+        # 2. Add different domain account to the project. Add account should
+        #    fail
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+
+        self.debug("Adding user: %s from domain: %s to project: %s" % (
+                                                    self.user.account.name,
+                                                    self.user.account.domainid,
+                                                    project.id
+                                                    ))
+        with self.assertRaises(Exception):
+            # Add user to the project from different domain
+            project.addAccount(
+                           self.apiclient,
+                           self.user.account.name
+                           )
+            self.debug("User add to project failed!")
+        return
+
+
+class TestDeleteAccountWithProject(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDeleteAccountWithProject,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        # Create account
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls._cleanup = [cls.account]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_03_delete_account_with_project(self):
+        """ Test As long as the project exists, its owner can't be removed
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Delete account who is owner of the project. Delete account should
+        #    fail
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        # Deleting account who is owner of the project
+        with self.assertRaises(Exception):
+            self.account.delete(self.apiclient)
+            self.debug("Deleting account %s failed!" %
+                                    self.account.account.name)
+        return
+
+
+@unittest.skip("Deleting domain doesn't cleanup account")
+class TestDeleteDomainWithProject(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDeleteDomainWithProject,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        # Create account
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_04_delete_domain_with_project(self):
+        """ Test Verify delete domain with cleanup=true should delete projects
+            belonging to the domain
+        """
+        # Validate the following
+        # 1. Create a project in a domain
+        # 2. Delete domain forcefully. Verify that project is also deleted as
+        #    as part of domain cleanup
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+
+        self.debug("Deleting domain: %s forcefully" % self.domain.name)
+        # Delete domain with cleanup=True
+        self.domain.delete(self.apiclient, cleanup=True)
+        self.debug("Removed domain: %s" % self.domain.name)
+
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+        self.assertEqual(
+                            isinstance(interval, list),
+                            True,
+                            "Check if account.cleanup.interval config present"
+                        )
+        self.debug(
+                "Sleep for account cleanup interval: %s" %
+                                                    interval[0].value)
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value))
+
+        # Project should be deleted as part of domain cleanup
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+        self.assertEqual(
+                        list_projects_reponse,
+                        None,
+                        "Project should be deleted as part of domain cleanup"
+                        )
+        return
+
+
+class TestProjectOwners(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestProjectOwners,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        # Create accounts
+        cls.admin = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.new_admin = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls._cleanup = [cls.admin, cls.new_admin]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_05_user_project_owner_promotion(self):
+        """ Test Verify a project user can be later promoted to become a
+            owner
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Add account to the project. Edit account to make it a project
+        #    owner. verify new user is project owner and old account is
+        #    regular user of the project.
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.admin.account.name,
+                                 domainid=self.admin.account.domainid
+                                 )
+        self.cleanup.append(project)
+        # Cleanup created project at end of test
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                self.new_admin.account.name,
+                                                project.name
+                                                ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.new_admin.account.name,
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.new_admin.account.name,
+                                        )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+
+        # Update the project with new admin
+        project.update(
+                       self.apiclient,
+                       account=self.new_admin.account.name
+                       )
+
+        # listProjectAccount to verify the user is new admin of the project
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.new_admin.account.name,
+                                        )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Admin',
+                            "Newly added user is not added as a regular user"
+                            )
+
+        # listProjectAccount to verify old user becomes a regular user
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.admin.account.name,
+                                        )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_06_max_one_project_owner(self):
+        """ Test Verify there can only be one owner of a project at a time
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Add account to the project. Edit account to make it a project
+        #    owner.
+        # 3. Update project to add another account as an owner
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.admin.account.name,
+                                 domainid=self.admin.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+        self.user = Account.create(
+                              self.apiclient,
+                              self.services["account"],
+                              admin=True,
+                              domainid=self.domain.id
+                              )
+        self.cleanup.append(self.user)
+        self.debug("Created account with ID: %s" %
+                                                self.user.account.name)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                self.new_admin.account.name,
+                                                project.name
+                                                ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.new_admin.account.name,
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.new_admin.account.name,
+                                        )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        self.debug("Updating project with new Admin: %s" %
+                                                self.new_admin.account.name)
+        # Update the project with new admin
+        project.update(
+                       self.apiclient,
+                       account=self.new_admin.account.name
+                       )
+
+        # listProjectAccount to verify the user is new admin of the project
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.new_admin.account.name,
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Admin',
+                            "Newly added user is not added as a regular user"
+                            )
+
+        self.debug("Adding %s user to project: %s" % (
+                                                self.user.account.name,
+                                                project.name
+                                                ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.user.account.name,
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+
+        self.debug("Updating project with new Admin: %s" %
+                                                self.user.account.name)
+
+        # Update the project with new admin
+        project.update(
+                       self.apiclient,
+                       account=self.user.account.name
+                       )
+
+        # listProjectAccount to verify the user is new admin of the project
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.user.account.name,
+                                        )
+        self.debug(accounts_reponse)
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Admin',
+                            "Newly added user is not added as a regular user"
+                            )
+
+       # listProjectAccount to verify old user becomes a regular user
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.new_admin.account.name,
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        return
+
+
+class TestProjectResources(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestProjectResources,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        # Create account, disk offering etc.
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls._cleanup = [cls.account, cls.disk_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_07_project_resources_account_delete(self):
+        """ Test Verify after an account is removed from the project, all his
+            resources stay with the project.
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Add some accounts to project. Add resources to the project
+        # 3. Delete the account. Verify resources are still there after
+        #    account deletion.
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.cleanup.append(project)
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.debug("Adding %s user to project: %s" % (
+                                                self.user.account.name,
+                                                project.name
+                                                ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.user.account.name,
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        # Create some resources(volumes) for the projects
+        volume = Volume.create(
+                               self.apiclient,
+                               self.services["volume"],
+                               zoneid=self.zone.id,
+                               diskofferingid=self.disk_offering.id,
+                               projectid=project.id
+                               )
+        self.cleanup.append(volume)
+
+        # Delete the project user
+        self.user.delete(self.apiclient)
+
+        volumes = Volume.list(self.apiclient, id=volume.id)
+
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check for a valid list volumes response"
+                            )
+
+        self.assertNotEqual(
+                    len(volumes),
+                    0,
+                    "Check list volumes API response returns a valid list"
+                    )
+        volume_response = volumes[0]
+
+        self.assertEqual(
+                         volume_response.name,
+                         volume.name,
+                         "Volume should exist after project user deletion."
+                        )
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_08_cleanup_after_project_delete(self):
+        """ Test accounts are unassigned from project after project deletion
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Add some accounts to project. Add resources to the project
+        # 3. Delete the project. Verify resources are freed after
+        #    account deletion.
+        # 4. Verify all accounts are unassigned from project.
+
+        # Create project as a domain admin
+        project = Project.create(
+                                 self.apiclient,
+                                 self.services["project"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+        # Cleanup created project at end of test
+        self.debug("Created project with domain admin with ID: %s" %
+                                                                project.id)
+
+        list_projects_reponse = Project.list(
+                                             self.apiclient,
+                                             id=project.id,
+                                             listall=True
+                                             )
+
+        self.assertEqual(
+                            isinstance(list_projects_reponse, list),
+                            True,
+                            "Check for a valid list projects response"
+                            )
+        list_project = list_projects_reponse[0]
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        self.assertEqual(
+                            project.name,
+                            list_project.name,
+                            "Check project name from list response"
+                            )
+        self.user = Account.create(
+                                   self.apiclient,
+                                   self.services["account"],
+                                   admin=True,
+                                   domainid=self.domain.id
+                                   )
+        self.cleanup.append(self.user)
+        self.debug("Adding %s user to project: %s" % (
+                                                self.user.account.name,
+                                                project.name
+                                                ))
+        # Add user to the project
+        project.addAccount(
+                           self.apiclient,
+                           self.user.account.name
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=project.id,
+                                        account=self.user.account.name,
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(list_projects_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+        # Create some resources(volumes) for the projects
+        volume = Volume.create(
+                               self.apiclient,
+                               self.services["volume"],
+                               zoneid=self.zone.id,
+                               diskofferingid=self.disk_offering.id,
+                               projectid=project.id
+                               )
+        self.debug("Created a volume: %s for project: %s" % (
+                                                             volume.id,
+                                                             project.name
+                                                             ))
+        # Delete the project user
+        self.debug("Deleting project: %s" % project.name)
+        project.delete(self.apiclient)
+        self.debug("Successfully deleted project: %s" % project.name)
+
+        volumes = Volume.list(self.apiclient, id=volume.id)
+
+        self.assertEqual(
+                    volumes,
+                    None,
+                    "Resources (volume) should be deleted as part of cleanup"
+                    )
+
+        accounts = Project.listAccounts(self.apiclient, projectid=project.id)
+
+        self.assertEqual(
+                         accounts,
+                         None,
+                         "Accounts should be un-assigned from project"
+                    )
+        return
+
+
+class TestProjectSuspendActivate(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestProjectSuspendActivate,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, domain, template etc
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.domain = get_domain(
+                                   cls.api_client,
+                                   cls.services
+                                   )
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostypeid"]
+                                    )
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='project.invite.required'
+                                      )
+
+        if not isinstance(configs, list):
+            raise unittest.SkipTest("List configurations has no config: project.invite.required")
+        elif (configs[0].value).lower() != 'false':
+            raise unittest.SkipTest("'project.invite.required' should be set to false")
+
+        # Create account, service offering, disk offering etc.
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            domainid=cls.domain.id
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        # Create project as a domain admin
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls._cleanup = [
+                        cls.project,
+                        cls.account,
+                        cls.disk_offering,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_09_project_suspend(self):
+        """ Test Verify after an account is removed from the project, all his
+            resources stay with the project.
+        """
+        # Validate the following
+        # 1. Create a project.
+        # 2. Add some accounts to project. Add resources to the project
+        # 3. Delete the account. Verify resources are still there after
+        #    account deletion.
+
+        self.debug("Adding %s user to project: %s" % (
+                                                self.user.account.name,
+                                                self.project.name
+                                                ))
+        # Add user to the project
+        self.project.addAccount(
+                           self.apiclient,
+                           self.user.account.name,
+                           )
+
+        # listProjectAccount to verify the user is added to project or not
+        accounts_reponse = Project.listAccounts(
+                                        self.apiclient,
+                                        projectid=self.project.id,
+                                        account=self.user.account.name,
+                                        )
+        self.assertEqual(
+                            isinstance(accounts_reponse, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(accounts_reponse),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+        account = accounts_reponse[0]
+
+        self.assertEqual(
+                            account.role,
+                            'Regular',
+                            "Newly added user is not added as a regular user"
+                            )
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["virtual_machine"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+        self.debug("Created a VM: %s for project: %s" % (
+                                                         virtual_machine.id,
+                                                         self.project.id
+                                                         ))
+        self.debug("Suspending a project: %s" % self.project.name)
+        self.project.suspend(self.apiclient)
+
+        # Check status of all VMs associated with project
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  projectid=self.project.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                            isinstance(vms, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        for vm in vms:
+            self.debug("VM ID: %s state: %s" % (vm.id, vm.state))
+            self.assertEqual(
+                    vm.state,
+                    'Stopped',
+                    "VM should be in stopped state after project suspension"
+                    )
+
+        self.debug("Attempting to create volume in suspended project")
+        with self.assertRaises(Exception):
+            # Create some resources(volumes) for the projects
+            volume = Volume.create(
+                               self.apiclient,
+                               self.services["volume"],
+                               zoneid=self.zone.id,
+                               diskofferingid=self.disk_offering.id,
+                               projectid=self.project.id
+                               )
+
+        self.debug("Volume creation failed")
+
+        # Start the stopped VM
+        self.debug("Attempting to start VM: %s in suspended project" %
+                                                        virtual_machine.id)
+        with self.assertRaises(Exception):
+            virtual_machine.start(self.apiclient)
+        self.debug("VM start failed!")
+
+        # Destroy Stopped VM
+        virtual_machine.delete(self.apiclient)
+        self.debug("Destroying VM: %s" % virtual_machine.id)
+
+        # Check status of all VMs associated with project
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  projectid=self.project.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                            isinstance(vms, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        for vm in vms:
+            self.debug("VM ID: %s state: %s" % (vm.id, vm.state))
+            self.assertEqual(
+                    vm.state,
+                    'Destroyed',
+                    "VM should be in stopped state after project suspension"
+                    )
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_10_project_activation(self):
+        """ Test project activation after suspension
+        """
+        # Validate the following
+        # 1. Activate the project
+        # 2. Verify project is activated and we are able to add resources
+
+        # Activating the project
+        self.debug("Activating project: %s" % self.project.name)
+        self.project.activate(self.apiclient)
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["virtual_machine"],
+                                templateid=self.template.id,
+                                serviceofferingid=self.service_offering.id,
+                                projectid=self.project.id
+                                )
+
+        self.cleanup.append(virtual_machine)
+        self.debug("Created a VM: %s for project: %s" % (
+                                                         virtual_machine.id,
+                                                         self.project.id
+                                                         ))
+        # Check status of all VMs associated with project
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                            isinstance(vms, list),
+                            True,
+                            "Check for a valid list accounts response"
+                            )
+
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "Check list project response returns a valid project"
+                    )
+
+        for vm in vms:
+            self.debug("VM ID: %s state: %s" % (vm.id, vm.state))
+            self.assertEqual(
+                    vm.state,
+                    'Running',
+                    "VM should be in Running state after project activation"
+                    )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_usage.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_usage.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_project_usage.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_project_usage.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1717 @@
+# 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.
+""" P1 tests for Snapshots
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test Snapshots Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "project": {
+                                    "name": "Project",
+                                    "displaytext": "Test project",
+                        },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                   "diskname": "TestDiskServ",
+                                   },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                        "templates": {
+                                    "displaytext": 'Template',
+                                    "name": 'Template',
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                                    "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2"
+                                },
+                        "iso": {
+                                  "displaytext": "Test ISO",
+                                  "name": "Test ISO",
+                                  "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                                  # Source URL where ISO is located
+                                  "isextractable": True,
+                                  "isfeatured": True,
+                                  "ispublic": True,
+                                  "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                },
+                        "lbrule": {
+                                   "name": "SSH",
+                                   "alg": "roundrobin",
+                                   # Algorithm used for load balancing
+                                   "privateport": 22,
+                                   "publicport": 2222,
+                                },
+                        "natrule": {
+                                   "privateport": 22,
+                                   "publicport": 22,
+                                   "protocol": "TCP"
+                                },
+                        "vpn_user": {
+                                   "username": "test",
+                                   "password": "test",
+                                },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced'
+                    }
+
+
+class TestVmUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVmUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                serviceofferingid=cls.service_offering.id,
+                                projectid=cls.project.id
+                                )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_vm_usage(self):
+        """Test Create/Destroy VM and verify usage calculation
+        """
+        # Validate the following
+        # 1. Create a VM. Verify usage_events table contains VM .create,
+        #    VM.start , Network.offering.assign , Volume.create events
+        # 2. Stop the VM. Verify usage_events table contains
+        #    network.offerings.remove ,VM .stop Events for the created account.
+        # 3. Destroy the VM after some time. Verify usage_events table contains
+        #    VM.Destroy and volume .delete Event for the created account
+        # 4. Delete the account
+
+        self.debug("Stopping the VM: %s" % self.virtual_machine.id)
+        # Stop the VM
+        self.virtual_machine.stop(self.apiclient)
+
+        time.sleep(self.services["sleep"])
+        # Destroy the VM
+        self.debug("Destroying the VM: %s" % self.virtual_machine.id)
+        self.virtual_machine.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+        # Check if VM.CREATE, VM.DESTROY events present in usage_event table
+        self.assertEqual(
+                            qresult.count('VM.START'),
+                            1,
+                            "Check VM.START event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NETWORK.OFFERING.ASSIGN'),
+                            1,
+                            "Check NETWORK.OFFERING.ASSIGN in events table"
+                        )
+        self.assertEqual(
+                            qresult.count('VM.CREATE'),
+                            1,
+                            "Check VM.CREATE in list events"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VOLUME.CREATE'),
+                            1,
+                            "Check VOLUME.CREATE in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VM.STOP'),
+                            1,
+                            "Check VM.STOP in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NETWORK.OFFERING.REMOVE'),
+                            1,
+                            "Check NETWORK.OFFERING.REMOVE in list events"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VM.DESTROY'),
+                            1,
+                            "Check VM.DESTROY in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VOLUME.DELETE'),
+                            1,
+                            "Check VOLUME.DELETE in events table"
+                        )
+        return
+
+
+class TestPublicIPUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestPublicIPUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = cls.template.id
+
+        # Create VMs, Assign Public IP etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=cls.template.id,
+                                    serviceofferingid=cls.service_offering.id,
+                                    projectid=cls.project.id
+                                )
+        networks = Network.list(
+                                cls.api_client,
+                                projectid=cls.project.id,
+                                listall=True
+                                )
+        if isinstance(networks, list):
+            network = networks[0]
+        else:
+            raise Exception("List networks call failed")
+
+        cls.public_ip = PublicIPAddress.create(
+                                           cls.api_client,
+                                           zoneid=cls.zone.zoneid,
+                                           services=cls.services["server"],
+                                           networkid=network.id,
+                                           projectid=cls.project.id
+                                           )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "simulator"])
+    def test_01_public_ip_usage(self):
+        """Test Assign new IP and verify usage calculation
+        """
+        # Validate the following
+        # 1. Acquire a IP for the network of this account. Verify usage_event
+        #    table has  Acquire IP event for  the IP for this account
+        # 2. Release one of the IP of this account. Verify usage_event table
+        #    has IP.Release event for released IP for this account
+        # 3. Delete the newly created account
+
+        self.debug("Deleting public IP: %s" %
+                                self.public_ip.ipaddress.ipaddress)
+
+        # Release one of the IP
+        self.public_ip.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        # Check if NET.IPASSIGN, NET.IPRELEASE events present in usage_event
+        # table
+        self.assertEqual(
+                            qresult.count('NET.IPASSIGN') > 0,
+                            True,
+                            "Check NET.IPASSIGN event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NET.IPRELEASE') > 0,
+                            True,
+                            "Check NET.IPRELEASE in events table"
+                        )
+        return
+
+
+class TestVolumeUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVolumeUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["server"]["diskoffering"] = cls.disk_offering.id
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                serviceofferingid=cls.service_offering.id,
+                                projectid=cls.project.id
+                                )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_volume_usage(self):
+        """Test Create/delete a volume and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Volume.create event for both root and data disk is there for the
+        #    created account in cloud.usage_event table
+        # 2. Stop the VM
+        # 3. Detach the data disk from this VM
+        # 4. Destroy the Data disk. Volume.delete event is generated for data
+        #    disk of the destroyed VM
+
+        # Stop VM
+        self.debug("Stopping VM with ID: %s" % self.virtual_machine.id)
+        self.virtual_machine.stop(self.apiclient)
+
+        volume_response = list_volumes(
+                                    self.apiclient,
+                                    projectid=self.project.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                         isinstance(volume_response, list),
+                         True,
+                         "Check for valid list volumes response"
+                         )
+        data_volume = volume_response[0]
+
+        # Detach data Disk
+        self.debug("Detaching volume ID: %s VM with ID: %s" % (
+                                                 data_volume.id,
+                                                 self.virtual_machine.id
+                                                 ))
+        self.virtual_machine.detach_volume(self.apiclient, data_volume)
+
+        # Delete Data disk
+        self.debug("Delete volume ID: %s" % data_volume.id)
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = data_volume.id
+        self.apiclient.deleteVolume(cmd)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+        # Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('VOLUME.CREATE'),
+                            2,
+                            "Check VOLUME.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VOLUME.DELETE'),
+                            1,
+                            "Check VOLUME.DELETE in events table"
+                        )
+        return
+
+
+class TestTemplateUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestTemplateUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["server"]["zoneid"] = cls.zone.id
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        #create virtual machine
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=template.id,
+                                    serviceofferingid=cls.service_offering.id,
+                                    projectid=cls.project.id
+                                    )
+
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        #Wait before server has be successfully stopped
+        time.sleep(30)
+        list_volume = list_volumes(
+                                   cls.api_client,
+                                   projectid=cls.project.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+        if isinstance(list_volume, list):
+            cls.volume = list_volume[0]
+        else:
+            raise Exception("List Volumes failed!")
+        cls._cleanup = [
+                        cls.project,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, templates
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_01_template_usage(self):
+        """Test Upload/ delete a template and verify correct usage is generated
+            for the template uploaded
+        """
+        # Validate the following
+        # 1. Create a account
+        # 2. Upload a template from this account. template.create event is
+        #    recorded in cloud.usage_event table for this account
+        # 3. Delete the template. template.delete event is recorded in
+        #    cloud.usage_event tables for this account
+        # 4. Destroy the account
+
+        #Create template from Virtual machine and Volume ID
+        self.template = Template.create(
+                                self.apiclient,
+                                self.services["templates"],
+                                self.volume.id,
+                                projectid=self.project.id
+                                )
+        self.debug("Created template with ID: %s" % self.template.id)
+        # Delete template
+        self.template.delete(self.apiclient)
+        self.debug("Deleted template with ID: %s" % self.template.id)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('TEMPLATE.CREATE'),
+                            1,
+                            "Check TEMPLATE.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('TEMPLATE.DELETE'),
+                            1,
+                            "Check TEMPLATE.DELETE in events table"
+                        )
+        return
+
+
+class TestISOUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestISOUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["iso"]["zoneid"] = cls.zone.id
+        # Create Account, ISO image etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.iso = Iso.create(
+                                cls.api_client,
+                                cls.services["iso"],
+                                projectid=cls.project.id
+                            )
+        try:
+            # Wait till ISO gets downloaded
+            cls.iso.download(cls.api_client)
+        except Exception as e:
+            raise Exception("%s: Failed to download ISO: %s" % (
+                                                        e,
+                                                        cls.iso.id
+                                                        ))
+        cls._cleanup = [
+                        cls.project,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created ISO images
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_01_ISO_usage(self):
+        """Test Create/Delete a ISO and verify its usage is generated correctly
+        """
+        # Validate the following
+        # 1. Create a account
+        # 2. Upload a ISO from this account. ISO.create event is recorded in
+        #    cloud.usage_event table for this account
+        # 3. Delete the ISO. ISO.delete event is recorded in cloud.usage_event
+        #    tables for this account
+        # 4. Destroy the account
+
+        # Delete the ISO
+        self.debug("Deleting ISO with ID: %s" % self.iso.id)
+        self.iso.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for ISO.CREATE, ISO.DELETE events in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('ISO.CREATE'),
+                            1,
+                            "Check ISO.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('ISO.DELETE'),
+                            1,
+                            "Check ISO.DELETE in events table"
+                        )
+        return
+
+
+class TestLBRuleUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestLBRuleUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, LB Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                serviceofferingid=cls.service_offering.id,
+                                projectid=cls.project.id
+                                )
+        networks = Network.list(
+                                cls.api_client,
+                                projectid=cls.project.id,
+                                listall=True
+                                )
+        if isinstance(networks, list):
+            network = networks[0]
+        else:
+            raise Exception("List networks call failed")
+
+        cls.public_ip_1 = PublicIPAddress.create(
+                                           cls.api_client,
+                                           zoneid=cls.zone.zoneid,
+                                           services=cls.services["server"],
+                                           networkid=network.id,
+                                           projectid=cls.project.id
+                                           )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, LB rules
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "simulator"])
+    def test_01_lb_usage(self):
+        """Test Create/Delete a LB rule and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Acquire a IP for this account. lb.rule.create event is registered
+        #    for this account in cloud.usage_event table
+        # 2. Create a LB rule on the IP associated with this account
+        # 3. Delete the created LB rule from the account. lb.rule.delete event
+        #    is registered for this account in cloud.usage_event table
+        # 4. Delete this account.
+
+        self.debug(
+            "Creating load balancer rule for public IP: %s" %
+                                    self.public_ip_1.ipaddress.id)
+        #Create Load Balancer rule and assign VMs to rule
+        lb_rule = LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          self.public_ip_1.ipaddress.id,
+                                          projectid=self.project.id
+                                          )
+        # Delete LB Rule
+        self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
+        lb_rule.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for LB.CREATE, LB.DELETE in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('LB.CREATE'),
+                            1,
+                            "Check LB.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('LB.DELETE'),
+                            1,
+                            "Check LB.DELETE in events table"
+                        )
+        return
+
+
+class TestSnapshotUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestSnapshotUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                serviceofferingid=cls.service_offering.id,
+                                projectid=cls.project.id
+                                )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_snapshot_usage(self):
+        """Test Create/Delete a manual snap shot and verify
+        correct usage is recorded
+        """
+        # Validate the following
+        # 1. Create snapshot of the root disk  for this account.Snapshot.create
+        #    event is there for the created account in cloud.usage_event table
+        # 2. Destroy the snapshot after some time. Snapshot.delete event is
+        #    generated for the destroyed Snapshot
+        # 3. Delete the account
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            projectid=self.project.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                         isinstance(volumes, list),
+                         True,
+                         "Check if list volumes return a valid data"
+                        )
+
+        volume = volumes[0]
+
+        # Create a snapshot from the ROOTDISK
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+
+        # Delete snapshot Rule
+        self.debug("Deleting snapshot: %s" % snapshot.id)
+        snapshot.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check if database query returns a valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query Result: %s" % qresult)
+
+        # Check for SNAPSHOT.CREATE, SNAPSHOT.DELETE events in cloud.usage_event
+        # table
+        self.assertEqual(
+                            qresult.count('SNAPSHOT.CREATE'),
+                            1,
+                            "Check SNAPSHOT.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('SNAPSHOT.DELETE'),
+                            1,
+                            "Check SNAPSHOT.DELETE in events table"
+                        )
+        return
+
+
+class TestNatRuleUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestNatRuleUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                serviceofferingid=cls.service_offering.id,
+                                projectid=cls.project.id
+                                )
+        networks = Network.list(
+                                cls.api_client,
+                                projectid=cls.project.id,
+                                listall=True
+                                )
+        if isinstance(networks, list):
+            network = networks[0]
+        else:
+            raise Exception("List networks call failed")
+
+        cls.public_ip_1 = PublicIPAddress.create(
+                                           cls.api_client,
+                                           zoneid=cls.zone.zoneid,
+                                           services=cls.services["server"],
+                                           networkid=network.id,
+                                           projectid=cls.project.id
+                                           )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, NAT rules
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_01_nat_usage(self):
+        """Test Create/Delete a PF rule and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Acquire a IP for this account
+        # 2. Create a PF rule on the IP associated with this account.
+        #    NET.RULEADD event is registered for this account in
+        #    cloud.usage_event table
+        # 3. Delete the created PF rule from the account. NET.RULEDelete event
+        #    is registered for this account in cloud.usage_event table
+        # 4. Delete this account.
+
+        self.debug("Creating NAT rule with public IP: %s" %
+                                    self.public_ip_1.ipaddress.id)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                        self.apiclient,
+                        self.virtual_machine,
+                        self.services["natrule"],
+                        self.public_ip_1.ipaddress.id
+                        )
+
+        # Delete NAT Rule
+        self.debug("Deleting NAT rule: %s" % nat_rule.id)
+        nat_rule.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for NET.RULEADD, NET.RULEDELETE in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('NET.RULEADD'),
+                            1,
+                            "Check NET.RULEADD event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NET.RULEDELETE'),
+                            1,
+                            "Check NET.RULEDELETE in events table"
+                        )
+        return
+
+
+class TestVpnUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVpnUsage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Service offerings, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.project = Project.create(
+                                 cls.api_client,
+                                 cls.services["project"],
+                                 account=cls.account.account.name,
+                                 domainid=cls.account.account.domainid
+                                 )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                serviceofferingid=cls.service_offering.id,
+                                projectid=cls.project.id
+                                )
+        networks = Network.list(
+                                cls.api_client,
+                                projectid=cls.project.id,
+                                listall=True
+                                )
+        if isinstance(networks, list):
+            network = networks[0]
+        else:
+            raise Exception("List networks call failed")
+
+        cls.public_ip = PublicIPAddress.create(
+                                           cls.api_client,
+                                           zoneid=cls.zone.zoneid,
+                                           services=cls.services["server"],
+                                           networkid=network.id,
+                                           projectid=cls.project.id
+                                           )
+        cls._cleanup = [
+                        cls.project,
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, VPN users
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_01_vpn_usage(self):
+        """Test Create/Delete a VPN and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Enable VPN for this IP. vpn.add.user event is registered for this
+        #    account in cloud.usage_event table
+        # 2. Add user to this vpn
+        # 3. Delete user for this VPN. vpn.user.delete event is registered for
+        #    this account in cloud.usage_event table
+        # 4. Delete this account.
+
+        self.debug("Created VPN with public IP: %s" %
+                                    self.public_ip.ipaddress.id)
+        #Assign VPN to Public IP
+        vpn = Vpn.create(
+                        self.apiclient,
+                        self.public_ip.ipaddress.id,
+                        projectid=self.project.id
+                        )
+
+        self.debug("Created VPN user for account: %s" %
+                                    self.account.account.name)
+
+        vpnuser = VpnUser.create(
+                                 self.apiclient,
+                                 self.services["vpn_user"]["username"],
+                                 self.services["vpn_user"]["password"],
+                                 projectid=self.project.id
+                                 )
+
+        # Remove VPN user
+        self.debug("Deleting VPN user: %s" % vpnuser.id)
+        vpnuser.delete(self.apiclient)
+
+        # Delete VPN access
+        self.debug("Deleting VPN: %s" % vpn.publicipid)
+        vpn.delete(self.apiclient)
+
+        # Fetch project account ID from project UUID
+        self.debug(
+            "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id)
+
+        qresultset = self.dbclient.execute(
+                        "select project_account_id from projects where uuid = '%s';" \
+                        % self.project.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for VPN user related events
+        self.assertEqual(
+                            qresult.count('VPN.USER.ADD'),
+                            1,
+                            "Check VPN.USER.ADD event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VPN.USER.ADD'),
+                            1,
+                            "Check VPN.USER.ADD in events table"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_resource_limits.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_resource_limits.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_resource_limits.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_resource_limits.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1453 @@
+# 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.
+""" P1 tests for Resource limits
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+import datetime
+
+
+class Services:
+    """Test Resource Limits Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "domain": {
+                                   "name": "Domain",
+                                   },
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    # in MHz
+                                    "memory": 64,
+                                    # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                   "diskname": "TestDiskServ",
+                        },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                        },
+                        "template": {
+                                    "displaytext": "Cent OS Template",
+                                    "name": "Cent OS Template",
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                        },
+                        "network_offering": {
+                                    "name": 'Network offering',
+                                    "displaytext": 'Network offering',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'VirtualRouter',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                        },
+                                    },
+                         "network": {
+                                     "name": "test network",
+                                     "displaytext": "test network"
+                        },
+                        "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced',
+                    }
+
+
+class TestResourceLimitsAccount(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestResourceLimitsAccount, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create Account, VMs etc
+        cls.account_1 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        # Create Account, VMs etc
+        cls.account_2 = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.disk_offering,
+                        cls.service_offering,
+                        cls.account_1,
+                        cls.account_2
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_01_vm_per_account(self):
+        """Test VM limit per account
+        """
+
+        # Validate the following
+        # 1. Set user_vm=1 limit for account 1.
+        # 2. Try to start 2 VMs account 1. Verify start of second VM is denied
+        #    for this account.
+        # 3. Try to start 2 VMs account 2. Verify 2 SM are started properly
+
+        self.debug(
+            "Updating instance resource limit for account: %s" %
+                                                self.account_1.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              0, # Instance
+                              account=self.account_1.account.name,
+                              domainid=self.account_1.account.domainid,
+                              max=1
+                              )
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_1.account.name)
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine)
+
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Exception should be raised for second instance (account_1)
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_2.account.name)
+        # Start 2 instances for account_2
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_2.account.name)
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_02_publicip_per_account(self):
+        """Test Public IP limit per account
+        """
+
+        # Validate the following
+        # 1. Set Public_IP= 2 limit for account 1.
+        # 2. start 1 VMs account 1
+        # 3. start 1 VMs account 2
+        # 4. Acquire 2 IP in account 1. Verify  account with limit should be
+        #    denied to acquire more than one IP.
+        # 5. Acquire 2 IP in account 2. Verify account 2 should be able to
+        #    Acquire IP without any warning
+
+        self.debug(
+            "Updating public IP resource limit for account: %s" %
+                                                self.account_1.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              1, # Public Ip
+                              account=self.account_1.account.name,
+                              domainid=self.account_1.account.domainid,
+                              max=2
+                              )
+
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_1.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_2.account.name)
+        # Create VM for second account
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        self.debug(
+            "Associating public IP for account: %s" %
+                                        virtual_machine_1.account)
+        public_ip_1 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           virtual_machine_1.account,
+                                           virtual_machine_1.zoneid,
+                                           virtual_machine_1.domainid,
+                                           self.services["server"]
+                                           )
+        self.cleanup.append(public_ip_1)
+
+        # Sleep to ensure that state is reflected across all the calls
+        time.sleep(self.services["sleep"])
+
+        # Verify Public IP state
+        self.assertEqual(
+                            public_ip_1.ipaddress.state in [
+                                                            'Allocated',
+                                                            'Allocating'
+                                                            ],
+                            True,
+                            "Check Public IP state is allocated or not"
+                        )
+
+        # Exception should be raised for second instance (account_1)
+        with self.assertRaises(Exception):
+            public_ip_2 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           virtual_machine_1.account,
+                                           virtual_machine_1.zoneid,
+                                           virtual_machine_1.domainid,
+                                           self.services["server"]
+                                           )
+
+        self.debug(
+            "Associating public IP for account: %s" %
+                                        virtual_machine_2.account)
+        # Assign Public IP for account 2
+        public_ip_3 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           virtual_machine_2.account,
+                                           virtual_machine_2.zoneid,
+                                           virtual_machine_2.domainid,
+                                           self.services["server"]
+                                           )
+        self.cleanup.append(public_ip_3)
+
+        # Verify Public IP state
+        self.assertEqual(
+                            public_ip_3.ipaddress.state in [
+                                                            'Allocated',
+                                                            'Allocating'
+                                                            ],
+                            True,
+                            "Check Public IP state is allocated or not"
+                        )
+        self.debug(
+            "Associating public IP for account: %s" %
+                                        virtual_machine_2.account)
+        public_ip_4 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           virtual_machine_2.account,
+                                           virtual_machine_2.zoneid,
+                                           virtual_machine_2.domainid,
+                                           self.services["server"]
+                                           )
+        self.cleanup.append(public_ip_4)
+        # Verify Public IP state
+        self.assertEqual(
+                            public_ip_4.ipaddress.state in [
+                                                            'Allocated',
+                                                            'Allocating'
+                                                            ],
+                            True,
+                            "Check Public IP state is allocated or not"
+                        )
+        return
+
+    @attr(speed="slow")
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_03_snapshots_per_account(self):
+        """Test Snapshot limit per account
+        """
+
+        # Validate the following
+        # 1. Set snapshot= 2 limit for account 1.
+        # 2. start 1 VMs account 1
+        # 3. start 1 VMs account 2
+        # 4. Create 2 snapshot  in account 1. Verify account with limit should
+        #    be denied to create more than one snapshot.
+        # 5. Create 2 snapshot in account 2. Verify account 2 should be able to
+        #    create snapshots without any warning
+
+        self.debug(
+            "Updating public IP resource limit for account: %s" %
+                                                self.account_1.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              3, # Snapshot
+                              account=self.account_1.account.name,
+                              domainid=self.account_1.account.domainid,
+                              max=1
+                              )
+
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_1.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account_1.account.name)
+        # Create VM for second account
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_1.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        # Create a snapshot from the ROOTDISK (Account 1)
+        snapshot_1 = Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            account=self.account_1.account.name,
+                            domainid=self.account_1.account.domainid,
+                            )
+        self.cleanup.append(snapshot_1)
+        # Verify Snapshot state
+        self.assertEqual(
+                            snapshot_1.state in [
+                                                 'BackedUp',
+                                                 'CreatedOnPrimary'
+                                                 ],
+                            True,
+                            "Check Snapshot state is Running or not"
+                        )
+
+        # Exception should be raised for second snapshot (account_1)
+        with self.assertRaises(Exception):
+            Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            account=self.account_1.account.name,
+                            domainid=self.account_1.account.domainid,
+                            )
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_2.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        # Create a snapshot from the ROOTDISK (Account 2)
+        snapshot_2 = Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            account=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            )
+        self.cleanup.append(snapshot_2)
+        # Verify Snapshot state
+        self.assertEqual(
+                            snapshot_2.state in [
+                                                 'BackedUp',
+                                                 'CreatedOnPrimary'
+                                                 ],
+                            True,
+                            "Check Snapshot state is Running or not"
+                        )
+
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        # Create a second snapshot from the ROOTDISK (Account 2)
+        snapshot_3 = Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            account=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            )
+        self.cleanup.append(snapshot_3)
+        # Verify Snapshot state
+        self.assertEqual(
+                            snapshot_3.state in [
+                                                 'BackedUp',
+                                                 'CreatedOnPrimary'
+                                                 ],
+                            True,
+                            "Check Snapshot state is Running or not"
+                        )
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_04_volumes_per_account(self):
+        """Test Volumes limit per account
+        """
+
+        # Validate the following
+        # 1. Set volumes=2 limit for account 1.
+        # 2. Start 1 VMs account 1
+        # 3. Start 1 VMs account 2
+        # 4. Create 2 volumes in account 1. Verify account with limit should be
+        #    denied to create more than one volume.
+        # 5. Create 2 volumes in account 2. Verify account 2 should be able to
+        #    create Volume without any warning
+
+        self.debug(
+            "Updating volume resource limit for account: %s" %
+                                                self.account_1.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              2, # Volume
+                              account=self.account_1.account.name,
+                              domainid=self.account_1.account.domainid,
+                              max=2
+                              )
+
+        self.debug(
+            "Deploying VM for account: %s" % self.account_1.account.name)
+
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug(
+            "Deploying VM for account: %s" % self.account_2.account.name)
+
+        # Create VM for second account
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug(
+            "Create a data volume for account: %s" % self.account_1.account.name)
+        volume_1 = Volume.create(
+                                   self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.account_1.account.name,
+                                   domainid=self.account_1.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+        self.cleanup.append(volume_1)
+        # Verify Volume state
+        self.assertEqual(
+                            volume_1.state in [
+                                                 'Allocated',
+                                                 'Ready'
+                                                 ],
+                            True,
+                            "Check Volume state is Ready or not"
+                        )
+
+        # Exception should be raised for second snapshot (account_1)
+        with self.assertRaises(Exception):
+            Volume.create(
+                          self.apiclient,
+                          self.services["volume"],
+                          zoneid=self.zone.id,
+                          account=self.account_1.account.name,
+                          domainid=self.account_1.account.domainid,
+                          diskofferingid=self.disk_offering.id
+                        )
+
+        self.debug(
+            "Create a data volume for account: %s" % self.account_2.account.name)
+        # Create volume for Account 2
+        volume_2 = Volume.create(
+                                   self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.account_2.account.name,
+                                   domainid=self.account_2.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+        self.cleanup.append(volume_2)
+        # Verify Volume state
+        self.assertEqual(
+                            volume_2.state in [
+                                                 'Allocated',
+                                                 'Ready'
+                                                 ],
+                            True,
+                            "Check Volume state is Ready or not"
+                        )
+
+        self.debug(
+            "Create a data volume for account: %s" % self.account_2.account.name)
+        # Create a second volume from the ROOTDISK (Account 2)
+        volume_3 = Volume.create(
+                                   self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.account_2.account.name,
+                                   domainid=self.account_2.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+        self.cleanup.append(volume_3)
+        # Verify Volume state
+        self.assertEqual(
+                            volume_3.state in [
+                                                 'Allocated',
+                                                 'Ready'
+                                                 ],
+                            True,
+                            "Check Volume state is Ready or not"
+                        )
+        return
+
+    @attr(tags=["advanced", "advancedns"])
+    def test_05_templates_per_account(self):
+        """Test Templates limit per account
+        """
+
+        # Validate the following
+        # 1. Set templates=1 limit for account 1.
+        # 2. Try to create 2 templates in account 1. Verify account with limit
+        #    should be denied to create more than 1 template.
+        # 3. Try to create 2 templates in account 2. Verify account 2 should be
+        #    able to create template without any error
+
+        self.debug(
+            "Updating template resource limit for account: %s" %
+                                                self.account_1.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              4, # Template
+                              account=self.account_1.account.name,
+                              domainid=self.account_1.account.domainid,
+                              max=1
+                              )
+
+        self.debug(
+            "Updating volume resource limit for account: %s" %
+                                                self.account_1.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account_1.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        self.debug(
+            "Deploying virtual machine for account: %s" %
+                                                self.account_2.account.name)
+        # Create VM for second account
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_2.account.name,
+                                domainid=self.account_2.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        virtual_machine_1.stop(self.apiclient)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_1.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug(
+            "Creating template from volume: %s" % volume.id)
+        # Create a template from the ROOTDISK (Account 1)
+        template_1 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account_1.account.name,
+                            domainid=self.account_1.account.domainid,
+                            )
+
+        self.cleanup.append(template_1)
+        # Verify Template state
+        self.assertEqual(
+                            template_1.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+
+        # Exception should be raised for second snapshot (account_1)
+        with self.assertRaises(Exception):
+            Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account_1.account.name,
+                            domainid=self.account_1.account.domainid,
+                            )
+        virtual_machine_2.stop(self.apiclient)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_2.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug(
+            "Creating template from volume: %s" % volume.id)
+        # Create a snapshot from the ROOTDISK (Account 1)
+        template_2 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            )
+
+        self.cleanup.append(template_2)
+        # Verify Template state
+        self.assertEqual(
+                            template_2.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+        self.debug(
+            "Creating template from volume: %s" % volume.id)
+        # Create a second volume from the ROOTDISK (Account 2)
+        template_3 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account_2.account.name,
+                            domainid=self.account_2.account.domainid,
+                            )
+
+        self.cleanup.append(template_3)
+        # Verify Template state
+        self.assertEqual(
+                            template_3.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+        return
+
+
+class TestResourceLimitsDomain(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestResourceLimitsDomain, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        # Create Domains, Account etc
+        cls.domain = Domain.create(
+                                   cls.api_client,
+                                   cls.services["domain"]
+                                   )
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        # Create Service offering and disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        cls.domain
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_01_vm_per_domain(self):
+        """Test VM limit per domain
+        """
+
+        # Validate the following
+        # 1. Set max VM per domain to 2
+        # 2. Create account and start 2 VMs. Verify VM state is Up and Running
+        # 3. Try to create 3rd VM instance. The appropriate error or alert
+        #    should be raised
+
+        self.debug(
+            "Updating instance resource limits for domain: %s" %
+                                        self.account.account.domainid)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              0, # Instance
+                              domainid=self.account.account.domainid,
+                              max=2
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_2)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_2.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        # Exception should be raised for second instance
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account_1.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_01_publicip_per_domain(self):
+        """Test Public IP limit per domain
+        """
+
+        # Validate the following
+        # 1. set max no of IPs per domain to 2.
+        # 2. Create an account in this domain
+        # 3. Create 1 VM in this domain
+        # 4. Acquire 1 IP in the domain. IP should be successfully acquired
+        # 5. Try to acquire 3rd IP in this domain. It should give the user an
+        #    appropriate error and an alert should be generated.
+
+        self.debug(
+            "Updating public IP resource limits for domain: %s" %
+                                        self.account.account.domainid)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              1, # Public Ip
+                              domainid=self.account.account.domainid,
+                              max=2
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        self.debug("Associating public IP for account: %s" % self.account.account.name)
+        public_ip_1 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           virtual_machine_1.account,
+                                           virtual_machine_1.zoneid,
+                                           virtual_machine_1.domainid,
+                                           self.services["server"]
+                                           )
+        self.cleanup.append(public_ip_1)
+        # Verify Public IP state
+        self.assertEqual(
+                            public_ip_1.ipaddress.state in [
+                                                 'Allocated',
+                                                 'Allocating'
+                                                 ],
+                            True,
+                            "Check Public IP state is allocated or not"
+                        )
+
+        # Exception should be raised for second Public IP
+        with self.assertRaises(Exception):
+            public_ip_2 = PublicIPAddress.create(
+                                           self.apiclient,
+                                           virtual_machine_1.account,
+                                           virtual_machine_1.zoneid,
+                                           virtual_machine_1.domainid,
+                                           self.services["server"]
+                                           )
+        return
+
+    @attr(speed="slow")
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_03_snapshots_per_domain(self):
+        """Test Snapshot limit per domain
+        """
+
+        # Validate the following
+        # 1. set max no of snapshots per domain to 1.
+        # 2. Create an account in this domain
+        # 3. Create 1 VM in this domain
+        # 4. Create one snapshot in the domain. Snapshot should be successfully
+        #    created
+        # 5. Try to create another snapshot in this domain. It should give the
+        #    user an appropriate error and an alert should be generated.
+
+        self.debug(
+            "Updating snapshot resource limits for domain: %s" %
+                                        self.account.account.domainid)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              3, # Snapshot
+                              domainid=self.account.account.domainid,
+                              max=1
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_1.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        # Create a snapshot from the ROOTDISK
+        snapshot_1 = Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            )
+        self.cleanup.append(snapshot_1)
+        # Verify Snapshot state
+        self.assertEqual(
+                            snapshot_1.state in [
+                                                 'BackedUp',
+                                                 'CreatedOnPrimary'
+                                                 ],
+                            True,
+                            "Check Snapshot state is Running or not"
+                        )
+
+        # Exception should be raised for second snapshot
+        with self.assertRaises(Exception):
+            Snapshot.create(self.apiclient,
+                            volumes[0].id,
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            )
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator"])
+    def test_04_volumes_per_domain(self):
+        """Test Volumes limit per domain
+        """
+
+        # Validate the following
+        # 1. set max no of volume per domain to 1.
+        # 2. Create an account in this domain
+        # 3. Create 1 VM in this domain
+        # 4. Try to Create another VM in the domain. It should give the user an
+        #    appropriate error that Volume limit is exhausted and an alert
+        #    should be generated.
+
+        self.debug(
+            "Updating volume resource limits for domain: %s" %
+                                        self.account.account.domainid)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              2, # Volume
+                              domainid=self.account.account.domainid,
+                              max=2
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+
+        # Exception should be raised for second volume
+        with self.assertRaises(Exception):
+            Volume.create(
+                          self.apiclient,
+                          self.services["volume"],
+                          zoneid=self.zone.id,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid,
+                          diskofferingid=self.disk_offering.id
+                        )
+        return
+
+    @attr(tags=["advanced", "advancedns"])
+    def test_05_templates_per_domain(self):
+        """Test Templates limit per domain
+        """
+
+        # Validate the following
+        # 1. set max no of templates per domain to 2.
+        # 2. Create an account in this domain
+        # 3. Create 2 templates in this domain. Both template should be in
+        #    ready state
+        # 4. Try create 3rd template in the domain. It should give the user an
+        #    appropriate error and an alert should be generated.
+
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              2, # Volume
+                              domainid=self.account.account.domainid,
+                              max=5
+                              )
+
+        self.debug(
+            "Updating template resource limits for domain: %s" %
+                                        self.account.account.domainid)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              4, # Template
+                              domainid=self.account.account.domainid,
+                              max=2
+                              )
+
+        self.debug("Deploying VM for account: %s" % self.account.account.name)
+        virtual_machine_1 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.cleanup.append(virtual_machine_1)
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine_1.state,
+                            'Running',
+                            "Check VM state is Running or not"
+                        )
+        virtual_machine_1.stop(self.apiclient)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_1.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                        isinstance(volumes, list),
+                        True,
+                        "Check for list volume response return valid data"
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating template from volume: %s" % volume.id)
+        # Create a template from the ROOTDISK
+        template_1 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            )
+
+        self.cleanup.append(template_1)
+        # Verify Template state
+        self.assertEqual(
+                            template_1.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+        self.debug("Creating template from volume: %s" % volume.id)
+        # Create a template from the ROOTDISK
+        template_2 = Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            )
+
+        self.cleanup.append(template_2)
+        # Verify Template state
+        self.assertEqual(
+                            template_2.isready,
+                            True,
+                            "Check Template is in ready state or not"
+                        )
+
+        # Exception should be raised for second template
+        with self.assertRaises(Exception):
+            Template.create(
+                            self.apiclient,
+                            self.services["template"],
+                            volumeid=volume.id,
+                            account=self.account.account.name,
+                            domainid=self.account.account.domainid,
+                            )
+        return
+
+
+class TestMaxAccountNetworks(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestMaxAccountNetworks,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.network_offering = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=True
+                                            )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.network_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator",
+                "api", "basic", "eip", "sg"])
+    def test_maxAccountNetworks(self):
+        """Test Limit number of guest account specific networks
+        """
+
+        # Steps for validation
+        # 1. Fetch max.account.networks from configurations
+        # 2. Create an account. Create account more that max.accout.network
+        # 3. Create network should fail
+
+        config = Configurations.list(
+                                    self.apiclient,
+                                    name='max.account.networks',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(config, list),
+                True,
+                "List configurations should have max.account.networks"
+                )
+
+        config_value = int(config[0].value)
+        self.debug("max.account.networks: %s" % config_value)
+
+        for ctr in range(config_value):
+            # Creating network using the network offering created
+            self.debug("Creating network with network offering: %s" %
+                                                    self.network_offering.id)
+            network = Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+            self.debug("Created network with ID: %s" % network.id)
+        self.debug(
+            "Creating network in account already having networks : %s" %
+                                                            config_value)
+
+        with self.assertRaises(Exception):
+            Network.create(
+                                    self.apiclient,
+                                    self.services["network"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    networkofferingid=self.network_offering.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.debug('Create network failed (as expected)')
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_routers.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_routers.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_routers.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_routers.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1227 @@
+# 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.
+""" P1 tests for routers
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+
+#Import System modules
+import time
+
+
+class Services:
+    """Test router Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                                    },
+                        "virtual_machine":
+                                    {
+                                        "displayname": "Test VM",
+                                        "username": "root",
+                                        "password": "password",
+                                        "ssh_port": 22,
+                                        "hypervisor": 'XenServer',
+                                        # Hypervisor type should be same as
+                                        # hypervisor type of cluster
+                                        "privateport": 22,
+                                        "publicport": 22,
+                                        "protocol": 'TCP',
+                                },
+                        "host": {
+                                        "username": "root",
+                                        "password": "password",
+                                        "publicport": 22,
+                            },
+                        "account": {
+                                        "email": "test@test.com",
+                                        "firstname": "Test",
+                                        "lastname": "User",
+                                        "username": "testuser",
+                                        "password": "password",
+                                    },
+                        "natrule":
+                                {
+                                    "privateport": 22,
+                                    "publicport": 222,
+                                    "protocol": "TCP"
+                                },
+                         "lbrule":
+                                {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                                    "protocol": 'TCP',
+                                },
+                         "fw_rule": {
+                                    "startport": 1,
+                                    "endport": 6000,
+                                    "cidr": '55.55.0.0/11',
+                                    # Any network (For creating FW rule
+                                    },
+                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         # Used for Get_Template : CentOS 5.3 (64 bit)
+                         "mode": 'advanced',    # Networking mode: Advanced, basic
+                        }
+
+
+class TestRouterServices(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestRouterServices, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=cls.template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.vm_2 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=cls.template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.cleanup = [
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestRouterServices, cls).getClsTestClient().getApiClient()
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self._cleanup = []
+        return
+
+    @attr(tags = ["advanced"])
+    def test_01_AdvancedZoneRouterServices(self):
+        """Test advanced zone router services
+        """
+        # Validate the following:
+        # 1. Verify that list of services provided by this network are running
+        #    a. DNS
+        #    b. DHCP
+        #    c. Gateway
+        #    d. Firewall
+        #    e. LB
+        #    f. VPN
+        #    g. userdata
+        # 2. wait for router to start and guest network to be created
+        #    a. listRouters account=user, domainid=1 (router state=Running)
+        #    b. listNetworks account=user domainid=1 (network state=Implemented)
+        #    c. listVirtualMachines account=user domainid=1 (VM state=Running)
+        # 3. listNetwork
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+        for router in routers:
+            self.assertEqual(
+                        router.state,
+                        'Running',
+                        "Check list router response for router state"
+                    )
+            self.debug("Router ID: %s & Router state: %s" % (
+                                                             router.id,
+                                                             router.state
+                                                             ))
+        # Network state associated with account should be 'Implemented'
+        networks = list_networks(
+                                 self.apiclient,
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid,
+                                 )
+        self.assertEqual(
+                        isinstance(networks, list),
+                        True,
+                        "Check for list networks response return valid data"
+                        )
+
+        self.assertNotEqual(
+                             len(networks),
+                             0,
+                             "Check list networks response"
+                             )
+        for network in networks:
+            self.assertIn(
+                        network.state,
+                        ['Implemented', 'Allocated'],
+                        "Check list network response for network state"
+                    )
+            self.debug("Network ID: %s & Network state: %s" % (
+                                                             network.id,
+                                                             network.state
+                                                             ))
+        # VM state associated with account should be 'Running'
+        virtual_machines = list_virtual_machines(
+                                self.apiclient,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+
+        self.assertEqual(
+                        isinstance(virtual_machines, list),
+                        True,
+                        "Check for list virtual machines response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(virtual_machines),
+                             0,
+                             "Check list virtual machines response"
+                             )
+        for virtual_machine in virtual_machines:
+            self.assertEqual(
+                        virtual_machine.state,
+                        'Running',
+                        "Check list VM response for Running state"
+                    )
+            self.debug("VM ID: %s & VM state: %s" % (
+                                                     virtual_machine.id,
+                                                     virtual_machine.state
+                                                    ))
+
+        # Check status of DNS, DHCP, FIrewall, LB VPN processes
+        networks = list_networks(
+                                 self.apiclient,
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid,
+                                 )
+        self.assertEqual(
+                        isinstance(networks, list),
+                        True,
+                        "Check for list networks response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(networks),
+                             0,
+                             "Check list networks response"
+                             )
+        # Load Balancer, Userdata, VPN, Firewall, Gateway, DNS processes should
+        # be running
+        for network in networks:
+            self.assertEqual(
+                        'Lb' in str(network.service),
+                        True,
+                        "Check Load balancing process in list networks"
+                    )
+            self.assertEqual(
+                        'UserData' in str(network.service),
+                        True,
+                        "Check UserData service in list networks"
+                    )
+            self.assertEqual(
+                        'Vpn' in str(network.service),
+                        True,
+                        "Check Vpn service in list networks"
+                    )
+            self.assertEqual(
+                        'Firewall' in str(network.service),
+                        True,
+                        "Check Firewall service in list networks"
+                    )
+            self.assertEqual(
+                        'Dns' in str(network.service),
+                        True,
+                        "Check Dns service in list networks"
+                    )
+        return
+
+    @attr(configuration = "network.gc")
+    @attr(tags = ["advanced"])
+    def test_02_NetworkGarbageCollection(self):
+        """Test network garbage collection
+        """
+        # Validate the following
+        # 1. wait for router to start and guest network to be created
+        #    a.listRouters account=user, domainid=1 (router state=Running)
+        #    b.listNetworks account=user domainid=1 (network state=Implemented)
+        #    c.listVirtualMachines account=user domainid=1 (VM states=Running)
+        # 4. stopVirtualMachines (stop all VMs in this account)
+        # 5. wait for VMs to stop-listVirtualMachines account=user, domainid=1
+        #    (Both VM states = Stopped)
+        # 6. wait for network.gc.interval*2 seconds (600s)
+        # 7. listRouters account=user, domainid=1
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+        # Router associated with account should be in running state
+        for router in routers:
+            self.assertEqual(
+                        router.state,
+                        'Running',
+                        "Check list router response for router state"
+                    )
+            self.debug("Router ID: %s & Router state: %s" % (
+                                                             router.id,
+                                                             router.state
+                                                             ))
+        # Network state associated with account should be 'Implemented'
+        networks = list_networks(
+                                 self.apiclient,
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid,
+                                 )
+        self.assertEqual(
+                        isinstance(networks, list),
+                        True,
+                        "Check for list networks response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(networks),
+                             0,
+                             "Check list networks response"
+                             )
+        # Check if network in 'Implemented' state
+        for network in networks:
+            self.assertIn(
+                        network.state,
+                        ['Implemented', 'Allocated'],
+                        "Check list network response for network state"
+                    )
+            self.debug("Network ID: %s & Network state: %s" % (
+                                                             network.id,
+                                                             network.state
+                                                             ))
+        # VM state associated with account should be 'Running'
+        virtual_machines = list_virtual_machines(
+                                self.apiclient,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                )
+
+        self.assertEqual(
+                        isinstance(virtual_machines, list),
+                        True,
+                        "Check for list virtual machines response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(virtual_machines),
+                             0,
+                             "Check list virtual machines response"
+                             )
+        for virtual_machine in virtual_machines:
+            self.assertEqual(
+                        virtual_machine.state,
+                        'Running',
+                        "Check list VM response for Running state"
+                    )
+            self.debug("VM ID: %s & VM state: %s" % (
+                                                     virtual_machine.id,
+                                                     virtual_machine.state
+                                                    ))
+            # Stop virtual machine
+            cmd = stopVirtualMachine.stopVirtualMachineCmd()
+            cmd.id = virtual_machine.id
+            self.apiclient.stopVirtualMachine(cmd)
+
+        gcinterval = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.interval'
+                                    )
+        self.assertEqual(
+                        isinstance(gcinterval, list),
+                        True,
+                        "Check for list intervals response return valid data"
+                        )
+        self.debug("network.gc.interval: %s" % gcinterval[0].value)
+
+        gcwait = list_configurations(
+                                    self.apiclient,
+                                    name='network.gc.wait'
+                                    )
+        self.assertEqual(
+                        isinstance(gcwait, list),
+                        True,
+                        "Check for list intervals response return valid data"
+                        )
+        self.debug("network.gc.wait: %s" % gcwait[0].value)
+
+        total_wait = int(gcinterval[0].value) + int(gcwait[0].value)
+        # Router is stopped after (network.gc.interval *2) time. Wait for
+        # (network.gc.interval+network.gc.wait) * 2 for moving router to 'Stopped'
+        time.sleep(total_wait * 2)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+        for router in routers:
+            self.assertEqual(
+                        router.state,
+                        'Stopped',
+                        "Check list router response for router state"
+                    )
+            self.debug("Router ID: %s & Router state: %s" % (
+                                                             router.id,
+                                                             router.state
+                                                             ))
+        # Cleanup Vm_2 - Not required for further tests
+        self._cleanup.append(self.vm_2)
+        return
+
+    @attr(tags = ["advanced"])
+    def test_03_RouterStartOnVmDeploy(self):
+        """Test router start on VM deploy
+        """
+        # Validate the following
+        # 1. deployVirtualMachine in the account
+        # 2. listVirtualMachines account=user, domainid=1
+        # 3. when listVirtualMachines reports the userVM to be in state=Running
+        # 4. listRouters should report router to have come back to "Running" state
+        # 5. All other VMs in the account should remain in "Stopped" state
+
+        vm = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+        self.debug("Deployed a VM with ID: %s" % vm.id)
+
+        virtual_machines = list_virtual_machines(
+                                self.apiclient,
+                                id=vm.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                )
+
+        self.assertEqual(
+                        isinstance(virtual_machines, list),
+                        True,
+                        "Check for list virtual machines response return valid data"
+                        )
+
+        self.assertNotEqual(
+                             len(virtual_machines),
+                             0,
+                             "Check list virtual machines response"
+                             )
+        # VM state should be 'Running'
+        for virtual_machine in virtual_machines:
+            self.assertEqual(
+                        virtual_machine.state,
+                        'Running',
+                        "Check list VM response for Running state"
+                    )
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+        # Routers associated with account should be 'Running' after deployment
+        # of VM
+        for router in routers:
+            self.assertEqual(
+                        router.state,
+                        'Running',
+                        "Check list router response for router state"
+                    )
+            self.debug("Router ID: %s & Router state: %s" % (
+                                                             router.id,
+                                                             router.state
+                                                             ))
+
+        # All other VMs (VM_1) should be in 'Stopped'
+        virtual_machines = list_virtual_machines(
+                                self.apiclient,
+                                id=self.vm_1.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                )
+
+        self.assertEqual(
+                        isinstance(virtual_machines, list),
+                        True,
+                        "Check for list VMs response return valid data"
+                        )
+
+        self.assertNotEqual(
+                             len(virtual_machines),
+                             0,
+                             "Check list virtual machines response"
+                             )
+        for virtual_machine in virtual_machines:
+            self.assertEqual(
+                        virtual_machine.state,
+                        'Stopped',
+                        "Check list VM response for Stopped state"
+                    )
+            self.debug("VM ID: %s & VM state: %s" % (
+                                                     virtual_machine.id,
+                                                     virtual_machine.state
+                                                    ))
+        return
+
+
+class TestRouterStopCreatePF(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestRouterStopCreatePF, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.cleanup = [
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestRouterStopCreatePF, cls).getClsTestClient().getApiClient()
+            # Clean up, terminate the created resources
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up, terminate the created resources
+            cleanup_resources(self.apiclient, self._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self._cleanup = []
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_RouterStopCreatePF(self):
+        """Test router stop create port forwarding
+        """
+        # validate the following
+        # 1. wait for router to start, guest network to be implemented and
+        #    VM to report Running
+        # 2. stopRouter for this account
+        # 3. wait for listRouters to report Router as 'Stopped'
+        # 4. listPublicIpAddresses account=user, domainid=1 - pick ipaddressid
+        # 5. createPortForwardingRule (ipaddressid from step 5.)
+        #    a. for port 22 (ssh) for user VM deployed in step 1.
+        #    b. public port 222 , private port 22
+        # 6. startRouter stopped for this account
+        # 7. wait for listRouters to show router as Running
+
+        # Get router details associated for that account
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+        router = routers[0]
+
+        self.debug("Stopping router ID: %s" % router.id)
+
+        #Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        router = routers[0]
+
+        self.assertEqual(
+                    router.state,
+                    'Stopped',
+                    "Check list router response for router state"
+                    )
+
+        public_ips = list_publicIP(
+                                   self.apiclient,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid,
+                                   zoneid=self.zone.id
+                                   )
+        self.assertEqual(
+                        isinstance(public_ips, list),
+                        True,
+                        "Check for list public IPs response return valid data"
+                        )
+        public_ip = public_ips[0]
+
+        # Open up firewall port for SSH
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=public_ip.id,
+                            protocol=self.services["natrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=self.services["natrule"]["publicport"],
+                            endport=self.services["natrule"]["publicport"]
+                            )
+
+        self.debug("Creating NAT rule for VM ID: %s" % self.vm_1.id)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                        self.apiclient,
+                        self.vm_1,
+                        self.services["natrule"],
+                        public_ip.id
+                        )
+
+        self.debug("Starting router ID: %s" % router.id)
+        #Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               zoneid=self.zone.id
+                               )
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        router = routers[0]
+
+        self.assertEqual(
+                    router.state,
+                    'Running',
+                    "Check list router response for router state"
+                    )
+        # NAT Rule should be in Active state after router start
+        nat_rules = list_nat_rules(
+                                   self.apiclient,
+                                   id=nat_rule.id
+                                   )
+        self.assertEqual(
+                        isinstance(nat_rules, list),
+                        True,
+                        "Check for list NAT rules response return valid data"
+                        )
+        self.assertEqual(
+                    nat_rules[0].state,
+                    'Active',
+                    "Check list port forwarding rules"
+                    )
+        try:
+
+            self.debug("SSH into VM with ID: %s" % nat_rule.ipaddress)
+
+            self.vm_1.ssh_port = nat_rule.publicport
+            self.vm_1.get_ssh_client(nat_rule.ipaddress)
+        except Exception as e:
+            self.fail(
+                      "SSH Access failed for %s: %s" % \
+                      (self.vm_1.ipaddress, e)
+                      )
+        return
+
+
+class TestRouterStopCreateLB(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestRouterStopCreateLB, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.cleanup = [
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestRouterStopCreateLB, cls).getClsTestClient().getApiClient()
+            #Clean up, terminate the created resources
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self._cleanup = []
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_RouterStopCreateLB(self):
+        """Test router stop create Load balancing
+        """
+        # validate the following
+        # 1. listLoadBalancerRules (publicipid=ipaddressid of source NAT)
+        # 2. rule should be for port 2222 as applied and
+        #    should be in state=Active
+        # 3. ssh access should be allowed to the userVMs over the source NAT IP
+        #    and port 2222
+
+        # Get router details associated for that account
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+
+        router = routers[0]
+
+        self.debug("Stopping router with ID: %s" % router.id)
+        #Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        router = routers[0]
+
+        self.assertEqual(
+                    router.state,
+                    'Stopped',
+                    "Check list router response for router state"
+                    )
+
+        public_ips = list_publicIP(
+                                   self.apiclient,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.assertEqual(
+                        isinstance(public_ips, list),
+                        True,
+                        "Check for list public IPs response return valid data"
+                        )
+        public_ip = public_ips[0]
+
+        # Open up firewall port for SSH
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=public_ip.id,
+                            protocol=self.services["lbrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=self.services["lbrule"]["publicport"],
+                            endport=self.services["lbrule"]["publicport"]
+                            )
+        self.debug("Creating LB rule for public IP: %s" % public_ip.id)
+        #Create Load Balancer rule and assign VMs to rule
+        lb_rule = LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          public_ip.id,
+                                          accountid=self.account.account.name
+                                          )
+        self.debug("Assigning VM %s to LB rule: %s" % (
+                                                       self.vm_1.id,
+                                                       lb_rule.id
+                                                       ))
+        lb_rule.assign(self.apiclient, [self.vm_1])
+
+        #Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        router = routers[0]
+
+        self.assertEqual(
+                    router.state,
+                    'Running',
+                    "Check list router response for router state"
+                    )
+        # After router start, LB RUle should be in Active state
+        lb_rules = list_lb_rules(
+                                   self.apiclient,
+                                   id=lb_rule.id
+                                   )
+        self.assertEqual(
+                        isinstance(lb_rules, list),
+                        True,
+                        "Check for list LB rules response return valid data"
+                        )
+        self.assertEqual(
+                    lb_rules[0].state,
+                    'Active',
+                    "Check list load balancing rules"
+                    )
+        self.assertEqual(
+                    lb_rules[0].publicport,
+                    str(self.services["lbrule"]["publicport"]),
+                    "Check list load balancing rules"
+                    )
+
+        try:
+            self.debug("SSH into VM with IP: %s" % public_ip.ipaddress)
+            self.vm_1.ssh_port = self.services["lbrule"]["publicport"]
+            self.vm_1.get_ssh_client(public_ip.ipaddress)
+        except Exception as e:
+            self.fail(
+                      "SSH Access failed for %s: %s" % \
+                      (self.vm_1.ipaddress, e)
+                      )
+        return
+
+
+class TestRouterStopCreateFW(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestRouterStopCreateFW, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     domainid=cls.domain.id
+                                     )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.cleanup = [
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestRouterStopCreateFW, cls).getClsTestClient().getApiClient()
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self._cleanup = []
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_RouterStopCreateFW(self):
+        """Test router stop create Firewall rule
+        """
+        # validate the following
+        # 1. 1. listFirewallRules (filter by ipaddressid of sourcenat)
+        # 2. rule should be for ports 1-600 and in state=Active
+        #    (optional backend)
+        # 3. verify on router using iptables -t nat -nvx if rules are applied
+
+        # Get the router details associated with account
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+
+        self.assertNotEqual(
+                             len(routers),
+                             0,
+                             "Check list router response"
+                             )
+
+        router = routers[0]
+
+        self.debug("Stopping the router: %s" % router.id)
+        #Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+        router = routers[0]
+
+        self.assertEqual(
+                    router.state,
+                    'Stopped',
+                    "Check list router response for router state"
+                    )
+
+        public_ips = list_publicIP(
+                                   self.apiclient,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.assertEqual(
+                        isinstance(public_ips, list),
+                        True,
+                        "Check for list public IP response return valid data"
+                        )
+        public_ip = public_ips[0]
+
+        #Create Firewall rule with configurations from settings file
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=public_ip.id,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        self.debug("Starting the router: %s" % router.id)
+        #Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        routers = list_routers(
+                               self.apiclient,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid,
+                               )
+        self.assertEqual(
+                        isinstance(routers, list),
+                        True,
+                        "Check for list routers response return valid data"
+                        )
+
+        router = routers[0]
+
+        self.assertEqual(
+                    router.state,
+                    'Running',
+                    "Check list router response for router state"
+                    )
+        # After Router start, FW rule should be in Active state
+        fw_rules = list_firewall_rules(
+                                   self.apiclient,
+                                   id=fw_rule.id,
+                                   )
+        self.assertEqual(
+                        isinstance(fw_rules, list),
+                        True,
+                        "Check for list FW rules response return valid data"
+                        )
+
+        self.assertEqual(
+                    fw_rules[0].state,
+                    'Active',
+                    "Check list load balancing rules"
+                    )
+        self.assertEqual(
+                    fw_rules[0].startport,
+                    str(self.services["fw_rule"]["startport"]),
+                    "Check start port of firewall rule"
+                    )
+
+        self.assertEqual(
+                    fw_rules[0].endport,
+                    str(self.services["fw_rule"]["endport"]),
+                    "Check end port of firewall rule"
+                    )
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=router.hostid,
+                           )
+        self.assertEqual(
+                        isinstance(hosts, list),
+                        True,
+                        "Check for list hosts response return valid data"
+                        )
+        host = hosts[0]
+        # For DNS and DHCP check 'dnsmasq' process status
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['host']["publicport"],
+                                self.services['host']["username"],
+                                self.services['host']["password"],
+                                router.linklocalip,
+                                'iptables -t nat -L'
+                                )
+        self.debug("iptables -t nat -L: %s" % result)
+        self.debug("Public IP: %s" % public_ip.ipaddress)
+        res = str(result)
+        self.assertEqual(
+                            res.count(str(public_ip.ipaddress)),
+                            1,
+                            "Check public IP address"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_security_groups.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_security_groups.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_security_groups.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_security_groups.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1657 @@
+# 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.
+
+""" P1 for Security groups
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+
+#Import System modules
+import time
+import subprocess
+
+
+class Services:
+    """Test Security groups Services
+    """
+
+    def __init__(self):
+        self.services = {
+                "disk_offering": {
+                    "displaytext": "Small",
+                    "name": "Small",
+                    "disksize": 1
+                },
+                "account": {
+                    "email": "test@test.com",
+                    "firstname": "Test",
+                    "lastname": "User",
+                    "username": "test",
+                    # Random characters are appended in create account to
+                    # ensure unique username generated each time
+                    "password": "password",
+                },
+                "virtual_machine": {
+                # Create a small virtual machine instance with disk offering
+                    "displayname": "Test VM",
+                    "username": "root",     # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                    "userdata": 'This is sample data',
+                },
+                "host": {
+                         "publicport": 22,
+                         "username": "root",    # Host creds for SSH
+                         "password": "password",
+                },
+                "service_offering": {
+                    "name": "Tiny Instance",
+                    "displaytext": "Tiny Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,    # in MHz
+                    "memory": 64,       # In MBs
+                },
+                "security_group": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '0.0.0.0/0',
+                },
+                "security_group_2": {
+                    "name": 'ICMP',
+                    "protocol": 'ICMP',
+                    "startport": -1,
+                    "endport": -1,
+                    "cidrlist": '0.0.0.0/0',
+                },
+            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            # CentOS 5.3 (64-bit)
+            "sleep": 60,
+            "timeout": 10,
+            "mode": 'basic',
+            # Networking mode: Basic or Advanced
+        }
+
+
+class TestDefaultSecurityGroup(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestDefaultSecurityGroup, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestDefaultSecurityGroup, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_deployVM_InDefaultSecurityGroup(self):
+        """Test deploy VM in default security group
+        """
+
+
+        # Validate the following:
+        # 1. deploy Virtual machine using admin user
+        # 2. listVM should show a VM in Running state
+        # 3. listRouters should show one router running
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                )
+        self.debug("Deployed VM with ID: %s" % self.virtual_machine.id)
+        self.cleanup.append(self.virtual_machine)
+
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check for list VM response"
+                         )
+        vm_response = list_vm_response[0]
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM available in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+
+                            vm_response.id,
+                            self.virtual_machine.id,
+                            "Check virtual machine id in listVirtualMachines"
+                        )
+
+        self.assertEqual(
+                    vm_response.displayname,
+                    self.virtual_machine.displayname,
+                    "Check virtual machine displayname in listVirtualMachines"
+                    )
+
+        # Verify List Routers response for account
+        self.debug(
+                   "Verify list routers response for account: %s" \
+                   % self.account.account.name
+                   )
+        routers = list_routers(
+                               self.apiclient,
+                               zoneid=self.zone.id,
+                               listall=True
+                               )
+        self.assertEqual(
+                         isinstance(routers, list),
+                         True,
+                         "Check for list Routers response"
+                         )
+
+        self.debug("Router Response: %s" % routers)
+        self.assertEqual(
+                        len(routers),
+                        1,
+                        "Check virtual router is created for account or not"
+                        )
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_02_listSecurityGroups(self):
+        """Test list security groups for admin account
+        """
+
+
+        # Validate the following:
+        # 1. listSecurityGroups in admin account
+        # 2. There should be one security group (default) listed for the admin account
+        # 3. No Ingress Rules should be part of the default security group
+
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertNotEqual(
+                            len(sercurity_groups),
+                            0,
+                            "Check List Security groups response"
+                            )
+        self.debug("List Security groups response: %s" %
+                                            str(sercurity_groups))
+        self.assertEqual(
+                         hasattr(sercurity_groups, 'ingressrule'),
+                         False,
+                         "Check ingress rule attribute for default security group"
+                         )
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_03_accessInDefaultSecurityGroup(self):
+        """Test access in default security group
+        """
+
+
+        # Validate the following:
+        # 1. deploy Virtual machine using admin user
+        # 2. listVM should show a VM in Running state
+        # 3. listRouters should show one router running
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                )
+        self.debug("Deployed VM with ID: %s" % self.virtual_machine.id)
+        self.cleanup.append(self.virtual_machine)
+
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+        self.assertEqual(
+                         isinstance(list_vm_response, list),
+                         True,
+                         "Check for list VM response"
+                         )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        vm_response = list_vm_response[0]
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM available in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+
+                            vm_response.id,
+                            self.virtual_machine.id,
+                            "Check virtual machine id in listVirtualMachines"
+                        )
+
+        self.assertEqual(
+                    vm_response.displayname,
+                    self.virtual_machine.displayname,
+                    "Check virtual machine displayname in listVirtualMachines"
+                    )
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.debug("List Security groups response: %s" %
+                                            str(sercurity_groups))
+        self.assertNotEqual(
+                            len(sercurity_groups),
+                            0,
+                            "Check List Security groups response"
+                            )
+        self.assertEqual(
+                         hasattr(sercurity_groups, 'ingressrule'),
+                         False,
+                         "Check ingress rule attribute for default security group"
+                         )
+
+        # SSH Attempt to VM should fail
+        with self.assertRaises(Exception):
+            self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
+            ssh = remoteSSHClient.remoteSSHClient(
+                                    self.virtual_machine.ssh_ip,
+                                    self.virtual_machine.ssh_port,
+                                    self.virtual_machine.username,
+                                    self.virtual_machine.password
+                                    )
+        return
+
+
+class TestAuthorizeIngressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestAuthorizeIngressRule, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestAuthorizeIngressRule, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_authorizeIngressRule(self):
+        """Test authorize ingress rule
+        """
+
+
+        # Validate the following:
+        #1. Create Security group for the account.
+        #2. Createsecuritygroup (ssh-incoming) for this account
+        #3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        #4. deployVirtualMachine into this security group (ssh-incoming)
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                self.apiclient,
+                                self.services["security_group"],
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        self.debug("Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        return
+
+
+class TestRevokeIngressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestRevokeIngressRule, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestRevokeIngressRule, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_revokeIngressRule(self):
+        """Test revoke ingress rule
+        """
+
+
+        # Validate the following:
+        #1. Create Security group for the account.
+        #2. Createsecuritygroup (ssh-incoming) for this account
+        #3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        #4. deployVirtualMachine into this security group (ssh-incoming)
+        #5. Revoke the ingress rule, SSH access should fail
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug("Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        self.debug("Revoking ingress rule for sec group ID: %s for ssh access"
+                                                            % security_group.id)
+        # Revoke Security group to SSH to VM
+        result = security_group.revoke(
+                                self.apiclient,
+                                id=ssh_rule["ruleid"]
+                                )
+
+        # SSH Attempt to VM should fail
+        with self.assertRaises(Exception):
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            remoteSSHClient.remoteSSHClient(
+                                        self.virtual_machine.ssh_ip,
+                                        self.virtual_machine.ssh_port,
+                                        self.virtual_machine.username,
+                                        self.virtual_machine.password
+                                        )
+        return
+
+
+class TestDhcpOnlyRouter(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestDhcpOnlyRouter, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestDhcpOnlyRouter, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip", "basic"])
+    def test_01_dhcpOnlyRouter(self):
+        """Test router services for user account
+        """
+
+
+        # Validate the following
+        #1. List routers for any user account
+        #2. The only service supported by this router should be dhcp
+
+        # Find router associated with user account
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    zoneid=self.zone.id,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           zoneid=router.zoneid,
+                           type='Routing',
+                           state='Up',
+                           id=router.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list host returns a valid list"
+                        )
+        host = hosts[0]
+
+        self.debug("Router ID: %s, state: %s" % (router.id, router.state))
+
+        self.assertEqual(
+                            router.state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['host']["publicport"],
+                                self.services['host']["username"],
+                                self.services['host']["password"],
+                                router.linklocalip,
+                                "service dnsmasq status"
+                                )
+        res = str(result)
+        self.debug("Dnsmasq process status: %s" % res)
+
+        self.assertEqual(
+                            res.count("running"),
+                            1,
+                            "Check dnsmasq service is running or not"
+                        )
+        return
+
+
+class TestdeployVMWithUserData(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestdeployVMWithUserData, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestdeployVMWithUserData, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_deployVMWithUserData(self):
+        """Test Deploy VM with User data"""
+
+
+        # Validate the following
+        # 1. CreateAccount of type user
+        # 2. CreateSecurityGroup ssh-incoming
+        # 3. authorizeIngressRule to allow ssh-access
+        # 4. deployVirtualMachine into this group with some base64 encoded user-data
+        # 5. wget http://10.1.1.1/latest/user-data to get the latest userdata from the
+        #    router for this VM
+
+        # Find router associated with user account
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    zoneid=self.zone.id,
+                                    listall=True
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Should be able to SSH VM
+        try:
+            self.debug(
+                       "SSH to VM with IP Address: %s"\
+                       % self.virtual_machine.ssh_ip
+                       )
+
+            ssh = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        cmds = [
+               "wget http://%s/latest/user-data" % router.guestipaddress,
+               "cat user-data",
+               ]
+        for c in cmds:
+            result = ssh.execute(c)
+            self.debug("%s: %s" % (c, result))
+
+        res = str(result)
+        self.assertEqual(
+                            res.count(self.services["virtual_machine"]["userdata"]),
+                            1,
+                            "Verify user data"
+                        )
+        return
+
+
+class TestDeleteSecurityGroup(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+
+        self.services = Services().services
+
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+
+        template = get_template(
+                            self.apiclient,
+                            self.zone.id,
+                            self.services["ostypeid"]
+                            )
+
+        self.services["domainid"] = self.domain.id
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["template"] = template.id
+
+        self.service_offering = ServiceOffering.create(
+                                            self.apiclient,
+                                            self.services["service_offering"]
+                                            )
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.services["account"] = self.account.account.name
+        self.cleanup = [
+                        self.account,
+                        self.service_offering
+                        ]
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestDeleteSecurityGroup, cls).getClsTestClient().getApiClient()
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestDeleteSecurityGroup, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_delete_security_grp_running_vm(self):
+        """Test delete security group with running VM"""
+
+
+        # Validate the following
+        # 1. createsecuritygroup (ssh-incoming) for this account
+        # 2. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 3. deployVirtualMachine into this security group (ssh-incoming)
+        # 4. deleteSecurityGroup created in step 1. Deletion should fail
+        #    complaining there are running VMs in this group
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Deleting Security group should raise exception
+        security_group.delete(self.apiclient)
+
+        #sleep to ensure that Security group is deleted properly
+        time.sleep(self.services["sleep"])
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              id=security_group.id
+                                              )
+        self.assertNotEqual(
+                            sercurity_groups,
+                            None,
+                            "Check List Security groups response"
+                            )
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_02_delete_security_grp_withoout_running_vm(self):
+        """Test delete security group without running VM"""
+
+
+        # Validate the following
+        # 1. createsecuritygroup (ssh-incoming) for this account
+        # 2. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 3. deployVirtualMachine into this security group (ssh-incoming)
+        # 4. deleteSecurityGroup created in step 1. Deletion should fail
+        #    complaining there are running VMs in this group
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # Destroy the VM
+        self.virtual_machine.delete(self.apiclient)
+
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='expunge.delay'
+                                     )
+        self.assertEqual(
+                          isinstance(config, list),
+                          True,
+                          "Check list configurations response"
+                    )
+        response = config[0]
+        self.debug("expunge.delay: %s" % response.value)
+        # Wait for some time more than expunge.delay
+        time.sleep(int(response.value) * 2)
+
+        # Deleting Security group should raise exception
+        try:
+            self.debug("Deleting Security Group: %s" % security_group.id)
+            security_group.delete(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to delete security group - ID: %s" \
+                      % security_group.id
+                      )
+        return
+
+
+class TestIngressRule(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+        self.services = Services().services
+
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+
+        template = get_template(
+                            self.apiclient,
+                            self.zone.id,
+                            self.services["ostypeid"]
+                            )
+
+        self.services["domainid"] = self.domain.id
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["template"] = template.id
+
+        self.service_offering = ServiceOffering.create(
+                                            self.apiclient,
+                                            self.services["service_offering"]
+                                            )
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.services["account"] = self.account.account.name
+        self.cleanup = [
+                        self.account,
+                        self.service_offering
+                        ]
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestIngressRule, cls).getClsTestClient().getApiClient()
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestIngressRule, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_01_authorizeIngressRule_AfterDeployVM(self):
+        """Test delete security group with running VM"""
+
+
+        # Validate the following
+        # 1. createsecuritygroup (ssh-incoming, 22via22) for this account
+        # 2. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 3. deployVirtualMachine into this security group (ssh-incoming)
+        # 4. authorizeSecurityGroupIngress to allow ssh access (startport:222 to
+        #    endport:22) to the VM
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        # Authorize Security group to SSH to VM
+        ingress_rule_1 = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule_1, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+        # Authorize Security group to SSH to VM
+        ingress_rule_2 = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group_2"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule_2, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+        # SSH should be allowed on 22 & 2222 ports
+        try:
+            self.debug("Trying to SSH into VM %s on port %s" % (
+                                        self.virtual_machine.ssh_ip,
+                                        self.services["security_group"]["endport"]
+                                        ))
+            self.virtual_machine.get_ssh_client()
+
+        except Exception as e:
+            self.fail("SSH access failed for ingress rule ID: %s, %s" \
+                      % (ingress_rule_1["id"], e))
+
+        # User should be able to ping VM
+        try:
+            self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip)
+            result = subprocess.call(['ping', '-c 1', self.virtual_machine.ssh_ip])
+
+            self.debug("Ping result: %s" % result)
+            # if ping successful, then result should be 0
+            self.assertEqual(
+                          result,
+                          0,
+                          "Check if ping is successful or not"
+                    )
+
+        except Exception as e:
+            self.fail("Ping failed for ingress rule ID: %s, %s" \
+                      % (ingress_rule_2["id"], e))
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_02_revokeIngressRule_AfterDeployVM(self):
+        """Test Revoke ingress rule after deploy VM"""
+
+
+        # Validate the following
+        # 1. createsecuritygroup (ssh-incoming, 22via22) for this account
+        # 2. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 3. deployVirtualMachine into this security group (ssh-incoming)
+        # 4. authorizeSecurityGroupIngress to allow ssh access (startport:222
+        #    to endport:22) to the VM
+        # 5. check ssh access via port 222
+        # 6. revokeSecurityGroupIngress to revoke rule added in step 5. verify
+        #    that ssh-access into the VM is now NOT allowed through ports 222
+        #    but allowed through port 22
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        # Authorize Security group to SSH to VM
+        ingress_rule_2 = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group_2"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule_2, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+        icmp_rule = (ingress_rule_2["ingressrule"][0]).__dict__
+
+        # SSH should be allowed on 22
+        try:
+            self.debug("Trying to SSH into VM %s on port %s" % (
+                                        self.virtual_machine.ssh_ip,
+                                        self.services["security_group"]["endport"]
+                                        ))
+            self.virtual_machine.get_ssh_client()
+
+        except Exception as e:
+            self.fail("SSH access failed for ingress rule ID: %s, %s" \
+                      % (ssh_rule["ruleid"], e))
+
+         # User should be able to ping VM
+        try:
+            self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip)
+            result = subprocess.call(['ping', '-c 1', self.virtual_machine.ssh_ip])
+
+            self.debug("Ping result: %s" % result)
+            # if ping successful, then result should be 0
+            self.assertEqual(
+                          result,
+                          0,
+                          "Check if ping is successful or not"
+                    )
+
+        except Exception as e:
+            self.fail("Ping failed for ingress rule ID: %s, %s" \
+                      % (icmp_rule["ruleid"], e))
+
+        self.debug(
+            "Revoke Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        result = security_group.revoke(
+                                self.apiclient,
+                                id=icmp_rule["ruleid"]
+                                )
+        self.debug("Revoke ingress rule result: %s" % result)
+
+        time.sleep(self.services["sleep"])
+        # User should not be able to ping VM
+        try:
+            self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip)
+            result = subprocess.call(['ping', '-c 1', self.virtual_machine.ssh_ip])
+
+            self.debug("Ping result: %s" % result)
+            # if ping successful, then result should be 0
+            self.assertNotEqual(
+                          result,
+                          0,
+                          "Check if ping is successful or not"
+                    )
+
+        except Exception as e:
+            self.fail("Ping failed for ingress rule ID: %s, %s" \
+                      % (icmp_rule["ruleid"], e))
+        return
+
+    @attr(tags = ["sg", "eip"])
+    def test_03_stopStartVM_verifyIngressAccess(self):
+        """Test Start/Stop VM and Verify ingress rule"""
+
+
+        # Validate the following
+        # 1. createsecuritygroup (ssh-incoming, 22via22) for this account
+        # 2. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 3. deployVirtualMachine into this security group (ssh-incoming)
+        # 4. once the VM is running and ssh-access is available,
+        #    stopVirtualMachine
+        # 5. startVirtualMachine. After stop start of the VM is complete
+        #    verify that ssh-access to the VM is allowed
+
+        security_group = SecurityGroup.create(
+                                              self.apiclient,
+                                              self.services["security_group"],
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.debug("Created security group with ID: %s" % security_group.id)
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                              self.apiclient,
+                                              account=self.account.account.name,
+                                              domainid=self.account.account.domainid
+                                              )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+
+        self.debug(
+            "Authorize Ingress Rule for Security Group %s for account: %s" \
+                % (
+                    security_group.id,
+                    self.account.account.name
+                ))
+
+        # Authorize Security group to SSH to VM
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+
+        # SSH should be allowed on 22 port
+        try:
+            self.debug("Trying to SSH into VM %s" % self.virtual_machine.ssh_ip)
+            self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH access failed for ingress rule ID: %s" \
+                      % ingress_rule["id"]
+                      )
+
+        self.virtual_machine.stop(self.apiclient)
+
+        # Sleep to ensure that VM is in stopped state
+        time.sleep(self.services["sleep"])
+
+        self.virtual_machine.start(self.apiclient)
+
+        # Sleep to ensure that VM is in running state
+        time.sleep(self.services["sleep"])
+
+        # SSH should be allowed on 22 port after restart
+        try:
+            self.debug("Trying to SSH into VM %s" % self.virtual_machine.ssh_ip)
+            self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH access failed for ingress rule ID: %s" \
+                      % ingress_rule["id"]
+                      )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_security_keys_encryption.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_security_keys_encryption.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_security_keys_encryption.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_security_keys_encryption.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,483 @@
+# 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.
+
+
+
+""" P1 tests for Security Keys Encryption
+"""
+#Import Local Modules
+from nose.plugins.attrib import attr
+from integration.lib.base import *
+from integration.lib.common import *
+from integration.lib.utils import *
+from marvin import remoteSSHClient
+from marvin.cloudstackAPI import *
+from marvin.cloudstackTestCase import *
+import datetime
+import marvin
+
+
+class Services:
+    """Test Security encryption Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    # in MHz
+                                    "memory": 64,
+                                    # In MBs
+                        },
+                        "virtual_machine": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                        "vpn_user": {
+                                   "username": "test",
+                                   "password": "test",
+                                },
+                         "host": {
+                                   "username": "root",
+                                   "password": "password",
+                                },
+                         "globalconfig": {
+                                   "security.hash.key": "test",
+                                    "vmware.guest.vswitch" : "test",
+                                    "vmware.public.vswitch" : "test",
+                                    "vmware.private.vswitch" : "test",
+                                    "kvm.guest.network.device" : "test",
+                                    "ovm.guest.network.device" : "test",
+                                    "xen.guest.network.device" : "test",
+                                    "kvm.public.network.device" : "test",
+                                    "ovm.public.network.device" : "test",
+                                    "xen.public.network.device" : "test",
+                                    "kvm.private.network.device" : "test",
+                                    "ovm.private.network.device" : "test",
+                                    "xen.private.network.device" : "test",
+                                    "xen.storage.network.device1" : "test",
+                                    "xen.storage.network.device2" : "test",
+                                    "alert.smtp.password" : "test",
+                                    "project.smtp.password" : "test",
+                                },
+                        "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced'
+                    }
+
+
+class TestSecurityKeysEncryption(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestSecurityKeysEncryption,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["virtual_machine"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+
+        cls.public_ip = PublicIPAddress.create(
+                                           cls.api_client,
+                                           cls.virtual_machine.account,
+                                           cls.virtual_machine.zoneid,
+                                           cls.virtual_machine.domainid,
+                                           cls.services["virtual_machine"]
+                                           )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic"])
+    def test_vm_instance_vnc_password(self):
+        """ Verify vm_instance table's vnc_password column encryption """
+
+
+        #Steps,
+        #Deploy  a VM
+        #Once VM is running goto db Server
+        #Validation,
+        #Verify vm_instance table's vnc_password column is encrypted
+
+        qresultset = self.dbclient.execute(
+                        "select vnc_password from vm_instance where uuid = '%s';" \
+                        % self.virtual_machine.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                         qresultset[0][0],
+                         self.services["virtual_machine"]["password"],
+                         "Check vnc_password in vm_instance table to verify encryption"
+                         )
+        return
+
+    @attr(tags = ["advanced"])
+    def test_vpn_users_password(self):
+        """ Verify vpn_users table's password column encryption """
+
+
+        #Steps,
+        #Deploy a VM
+        #Aquire a IP
+        #Enable VPN on the acquired  IP
+        #Add VPN user
+        #Validations,
+        #Verify vpn_users table's password column is encrypted
+
+        self.debug("Created VPN with public IP: %s" % self.public_ip.ipaddress.id)
+
+        #Assign VPN to Public IP
+        vpn = Vpn.create(
+                        self.apiclient,
+                        self.public_ip.ipaddress.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+
+        self.debug("Created VPN user for account: %s" %
+                                    self.account.account.name)
+
+        vpnuser = VpnUser.create(
+                                 self.apiclient,
+                                 self.services["vpn_user"]["username"],
+                                 self.services["vpn_user"]["password"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+
+        qresultset = self.dbclient.execute(
+                        "select password from vpn_users where uuid = '%s';" \
+                        % vpnuser.id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                         qresultset[0][0],
+                         self.services["vpn_user"]["password"],
+                         "Check password in vpn_users table to verify encryption"
+                         )
+
+    @attr(tags = ["advanced", "basic"])
+    def test_user_secret_key(self):
+        """ Verify user table's SECRET key column encryption """
+        #Steps,
+        #generate key for the user of the account
+        #Validations,
+        #Verify user table's secret key column is encrypted
+
+
+        user_keys = User.registerUserKeys(self.apiclient, self.account.account.user[0].id)
+        qresultset = self.dbclient.execute(
+                        "select secret_key from user where uuid = '%s';" \
+                        % self.account.account.user[0].id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                         qresultset[0][0],
+                         user_keys.secretkey,
+                         "Check secret key in users table to verify encryption"
+                         )
+        return
+
+    @attr(tags = ["advanced", "basic"])
+    def test_host_password(self):
+        """ Verify host details table's  value column encryption where name is password """
+
+
+        #Validations,
+        #Verify host details table's value column is encrypted where name is password
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           zoneid=self.services["virtual_machine"]["zoneid"],
+                           type='Routing',
+                           state='Up'
+                           )
+        self.assertEqual(
+                        isinstance(hosts, list),
+                        True,
+                        "Check list host returns a valid list"
+                        )
+
+        host = hosts[0]
+
+        qresultset = self.dbclient.execute(
+                        "select id from host where uuid = '%s';" \
+                        % host.id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        hostid = qresultset[0][0]
+
+        qresultset = self.dbclient.execute(
+                        "select value from host_details where host_id = '%s' and name='password';" \
+                        % hostid
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                         qresultset[0][0],
+                         self.services["host"]["password"],
+                         "Check password field value in host_details table to verify encryption"
+                         )
+        return
+
+    @attr(tags = ["advanced", "basic"])
+    def test_configurations_value_encryption(self):
+        """ verify configuration tables following name records value field  are encrypted """
+
+
+        #Steps
+        #verify configuration tables following name records value field  are encrypted
+        #security.hash.key
+        #vmware.guest.vswitch
+        #vmware.public.vswitch
+        #vmware.private.vswitch
+        #kvm.guest.network.device
+        #ovm.guest.network.device
+        #xen.guest.network.device
+        #kvm.public.network.device
+        #ovm.public.network.device
+        #xen.public.network.device
+        #kvm.private.network.device
+        #ovm.private.network.device
+        #xen.private.network.device
+        #xen.storage.network.device1
+        #xen.storage.network.device2
+        #alert.smtp.password
+        #project.smtp.password
+        #Validations,
+        #Verify configuration  table's following name records value filed is encrypted
+
+        for k, v in self.services["globalconfig"].items():
+
+            #setting some test value to the configuration
+            Configurations.update(self.apiclient, k, v)
+
+            #fetching the value of the configuration from DB
+            qresultset = self.dbclient.execute(
+                        "select value from configuration where name = '%s';" \
+                        % k
+                        )
+
+            self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+            config_value = qresultset[0][0]
+
+            #verifying the value from db and set are not equal and the value in db is encrypted
+            self.assertNotEqual(
+                         config_value,
+                         v,
+                         "Check configuration value in database is not equal to value set to verify the value is encrypted"
+                         )
+
+            #Setting the configuration value back to None as default value
+            Configurations.update(self.apiclient, k)
+        return
+
+
+class TestSingleSignOnEncryption(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestSingleSignOnEncryption,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "configuration", "advancedns", "simulator",
+                "api", "basic", "eip", "sg"])
+    def test_SingleSignOnEncryption(self):
+        """List listConfigurations API should get decrypted
+            security.singlesignon.key
+        """
+
+        # Steps for validation
+        # 1. listConfigurations - security.singlesignon.key
+        # Validate the following
+        # 1. assert that the field is encrypted (value mismatch)
+        # 2. assert that section of the DB for this config is "Secure"
+        #    and not "Hidden"
+
+        config = Configurations.list(
+                                    self.apiclient,
+                                    name='security.singlesignon.key',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                isinstance(config, list),
+                True,
+                "List configurations should have security.singlesignon.key"
+                )
+
+        config_value = config[0].value
+        config_category = config[0].category
+        qresultset = self.dbclient.execute(
+                        "select value from configuration where name='security.singlesignon.key';"
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                         qresultset[0][0],
+                         config_value,
+                         "The security.singlesignon.key is not encrypted"
+                         )
+        self.assertEqual(
+                         config_category,
+                         "Secure",
+                         "The configuration category should be secure"
+                         )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_shared_networks.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_shared_networks.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_shared_networks.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_shared_networks.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2983 @@
+# -*- encoding: utf-8 -*-
+# 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
+
+""" P1 tests for shared networks
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+import netaddr
+
+class Services:
+    """ Test shared networks """
+
+    def __init__(self):
+        self.services = {
+                          "domain": {
+                                   "name": "DOM",
+                                   },
+                         "project": {
+                                    "name": "Project",
+                                    "displaytext": "Test project",
+                                    },
+                         "account": {
+                                    "email": "admin-XABU1@test.com",
+                                    "firstname": "admin-XABU1",
+                                    "lastname": "admin-XABU1",
+                                    "username": "admin-XABU1",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "fr3sca",
+                                    },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                                    },
+                         "network_offering": {
+                                    "name": 'MySharedOffering',
+                                    "displaytext": 'MySharedOffering',
+                                    "guestiptype": 'Shared',
+                                    "supportedservices": 'Dhcp,Dns,UserData',
+                                    "specifyVlan" : "False",
+                                    "specifyIpRanges" : "False",
+                                    "traffictype": 'GUEST',
+                                    "serviceProviderList" : {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "UserData": 'VirtualRouter'
+                                        },
+                                },
+                         "network": {
+                                  "name": "MySharedNetwork - Test",
+                                  "displaytext": "MySharedNetwork",
+                                  "networkofferingid":"1",
+                                  "vlan" :"898",
+                                  "gateway" :"172.16.15.1",
+                                  "netmask" :"255.255.255.0",
+                                  "startip" :"172.16.15.2",
+                                  "endip" :"172.16.15.20",
+                                  "acltype" : "Domain",
+                                  "scope":"all",
+                                },
+                         "network1": {
+                                  "name": "MySharedNetwork - Test1",
+                                  "displaytext": "MySharedNetwork1",
+                                  "vlan" :"989",
+                                  "gateway" :"172.16.15.1",
+                                  "netmask" :"255.255.255.0",
+                                  "startip" :"172.16.15.21",
+                                  "endip" :"172.16.15.41",
+                                  "acltype" : "Domain",
+                                  "scope":"all",
+                                },
+						 "isolated_network_offering": {
+                                    "name": 'Network offering-VR services',
+                                    "displaytext": 'Network offering-VR services',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                            "Vpn": 'VirtualRouter',
+                                            "Firewall": 'VirtualRouter',
+                                            "Lb": 'VirtualRouter',
+                                            "UserData": 'VirtualRouter',
+                                            "StaticNat": 'VirtualRouter',
+                                        },
+                         },
+                         "isolated_network": {
+                                  "name": "Isolated Network",
+                                  "displaytext": "Isolated Network",
+                         },
+                         "fw_rule": {
+                                    "startport": 22,
+                                    "endport": 22,
+                                    "cidr": '0.0.0.0/0',
+                         },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "ostypeid": '0c22776c-f0b4-4e62-a8fe-f87fbba70723',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 90,
+                         "timeout": 10,
+                         "mode": 'advanced'
+                    }
+        
+class TestSharedNetworks(cloudstackTestCase):
+    
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestSharedNetworks,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.api_client = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        self.cleanup_networks = []
+        self.cleanup_accounts = []
+        self.cleanup_domains = []
+        self.cleanup_projects = []
+        self.cleanup_vms = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.api_client, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        
+        #below components is not a part of cleanup because to mandate the order and to cleanup network
+        try:
+            for vm in self.cleanup_vms:
+               vm.delete(self.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during virtual machines cleanup : %s" % e)
+    
+        try:
+            for project in self.cleanup_projects:
+                 project.delete(self.api_client)    
+        except Exception as e:
+             raise Exception("Warning: Exception during project cleanup : %s" % e)
+        
+        try:
+            for account in self.cleanup_accounts:
+                account.delete(self.api_client)    
+        except Exception as e:
+            raise Exception("Warning: Exception during account cleanup : %s" % e)
+        
+        try:
+            for domain in self.cleanup_domains:
+                domain.delete(self.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during domain cleanup : %s" % e)
+            
+        #Wait till all resources created are cleaned up completely and then attempt to delete Network
+        time.sleep(self.services["sleep"])
+        
+        try:
+            for network in self.cleanup_networks:
+                network.delete(self.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during network cleanup : %s" % e)
+        return
+
+    def test_sharedNetworkOffering_01(self):
+        """  Test shared network Offering 01 """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #   - name = "MySharedOffering"
+        #   - guestiptype="shared"
+        #   - services = {Dns, Dhcp, UserData}
+        #   -  conservemode = false
+        #   - specifyVlan = true
+        #   - specifyIpRanges = true
+        #  4. Enable network offering - updateNetworkOffering - state=Enabled
+        #  5. delete the admin account
+        # Validations,
+        #  1. listAccounts name=admin-XABU1, state=enabled returns your account
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+
+        #Create an account
+        self.account = Account.create(
+                         self.api_client,
+                         self.services["account"],
+                         admin=True,
+                         domainid=self.domain.id
+                         )
+        
+        self.cleanup_accounts.append(self.account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+
+        self.debug("Admin Type account created: %s" % self.account.account.name)
+                
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                          self.shared_network_offering,
+                                                          self.api_client,
+                                                          id=self.shared_network_offering.id,
+                                                          state="enabled"
+                                                          )
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        self.debug("NetworkOffering created and enabled: %s" % self.shared_network_offering.id)
+
+    def test_sharedNetworkOffering_02(self):
+        """ Test Shared Network Offering 02 """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #    - name = "MySharedOffering"
+        #    - guestiptype="shared"
+        #    - services = {Dns, Dhcp, UserData}
+        #    -  conservemode = false
+        #    - specifyVlan = false
+        #    - specifyIpRanges = false
+        #  4. delete the admin account
+        # Validations,
+        #  1. listAccounts name=admin-XABU1, state=enabled returns your account
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. createNetworkOffering fails - vlan should be specified in advanced zone
+        
+        #Create an account
+        self.account = Account.create(
+                         self.api_client,
+                         self.services["account"],
+                         admin=True,
+                         domainid=self.domain.id
+                         )
+        
+        self.cleanup_accounts.append(self.account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin type account created: %s" % self.account.account.name)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "False"
+        self.services["network_offering"]["specifyIpRanges"] = "False"
+        
+        try:
+            #Create Network Offering
+            self.shared_network_offering = NetworkOffering.create(
+                                                     self.api_client,
+                                                     self.services["network_offering"],
+                                                     conservemode=False
+                                                     )
+            self.fail("Network offering got created with vlan as False in advance mode and shared guest type, which is invalid case.")
+        except Exception as e:
+            self.debug("Network Offering creation failed with vlan as False in advance mode and shared guest type.")
+
+    def test_sharedNetworkOffering_03(self):
+        """ Test Shared Network Offering 03 """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #    - name = "MySharedOffering"
+        #    - guestiptype="shared"
+        #    - services = {Dns, Dhcp, UserData}
+        #    -  conservemode = false
+        #    - specifyVlan = true
+        #    - specifyIpRanges = false
+        #  4. delete the admin account
+        # Validations,
+        #  1. listAccounts name=admin-XABU1, state=enabled returns your account
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. createNetworkOffering fails - ip ranges should be specified when creating shared network offering
+
+        
+        #Create an account
+        self.account = Account.create(
+                         self.api_client,
+                         self.services["account"],
+                         admin=True,
+                         domainid=self.domain.id
+                         )
+        
+        self.cleanup_accounts.append(self.account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin Type account created: %s" % self.account.account.name)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "False"
+        
+        try:
+            #Create Network Offering
+            self.shared_network_offering = NetworkOffering.create(
+                                                     self.api_client,
+                                                     self.services["network_offering"],
+                                                     conservemode=False
+                                                     )
+            self.fail("Network offering got created with vlan as True and ip ranges as False in advance mode and with shared guest type, which is invalid case.")
+        except Exception as e:
+            self.debug("Network Offering creation failed with vlan as true and ip ranges as False in advance mode and with shared guest type.")
+
+    def test_createSharedNetwork_All(self):
+        """ Test Shared Network ALL  """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #    - name = "MySharedOffering"
+        #    - guestiptype="shared"
+        #    - services = {Dns, Dhcp, UserData}
+        #    -  conservemode = false
+        #    - specifyVlan = true
+        #    - specifyIpRanges = true
+        #  4. Enable network offering - updateNetworkOffering - state=Enabled
+        #  5. createNetwork
+        #    - name = mysharednetwork, displaytext = mysharednetwork
+        #    - vlan = 123 (say)
+        #    - networkofferingid = <mysharedoffering>
+        #    - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
+        #    - scope = all
+        #  6. create User account - user-ASJDK
+        #  7. deployVirtualMachine in this account and in admin account & within networkid = <mysharednetwork>
+        #  8. delete the admin account and the user account
+        # Validations,
+        #  1. listAccounts name=admin-XABU1, state=enabled returns your account
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+        #  5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
+        #  6. No checks reqd
+        #  7. a. listVirtualMachines should show both VMs in running state in the user account and the admin account
+        #     b. VM's IPs shoud be in the range of the shared network ip ranges
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                    self.api_client,
+                                    self.services["account"],
+                                    admin=True,
+                                    domainid=self.domain.id
+                                    )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin type account created: %s" % self.admin_account.account.name)
+        
+        #Create an user account
+        self.user_account = Account.create(
+                                   self.api_client,
+                                   self.services["account"],
+                                   admin=False,
+                                   domainid=self.domain.id
+                                   )
+        
+        self.cleanup_accounts.append(self.user_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.user_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The user account created is not enabled."
+            )
+        
+        self.debug("User type account created: %s" % self.user_account.account.name)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "Domain"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+
+        self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id,
+                         )
+        
+        self.cleanup_networks.append(self.network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+        
+        self.debug("Shared Network created for scope domain: %s" % self.network.id)
+        
+        self.admin_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       networkids=self.network.id,
+                                                       serviceofferingid=self.service_offering.id
+                                                       )
+        
+        self.cleanup_vms.append(self.admin_account_virtual_machine)
+        
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+            
+        self.debug("Virtual Machine created: %s" % self.admin_account_virtual_machine.id)
+        
+        ip_range = list(netaddr.iter_iprange(unicode(self.services["network"]["startip"]), unicode(self.services["network"]["endip"])))
+        if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+            self.fail("Virtual machine ip should be from the ip range assigned to network created.")
+        
+        self.user_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.user_account.account.name,
+                                                       domainid=self.user_account.account.domainid,
+                                                       serviceofferingid=self.service_offering.id,
+                                                       networkids=self.network.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.user_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+
+        self.debug("Virtual Machine created: %s" % self.user_account_virtual_machine.id)
+        
+        ip_range = list(netaddr.iter_iprange(unicode(self.services["network"]["startip"]), unicode(self.services["network"]["endip"])))
+        if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+            self.fail("Virtual machine ip should be from the ip range assigned to network created.")
+
+    def test_createSharedNetwork_accountSpecific(self):
+        """ Test Shared Networm with scope account """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #     create a user account = user-SOPJD
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #    - name = "MySharedOffering"
+        #    - guestiptype="shared"
+        #    - services = {Dns, Dhcp, UserData}
+        #    -  conservemode = false
+        #    - specifyVlan = true
+        #    - specifyIpRanges = true
+        #  4. Enable network offering - updateNetworkOffering - state=Enabled
+        #  5. createNetwork
+        #    - name = mysharednetwork, displaytext = mysharednetwork
+        #    - vlan = 123 (say)
+        #    - networkofferingid = <mysharedoffering>
+        #    - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
+        #    - scope = account, account = user-SOPJD, domain = ROOT
+        #  6. deployVirtualMachine in this account and in admin account & within networkid = <mysharednetwork>
+        #  7. delete the admin account and the user account
+        # Validations,
+        #  1. listAccounts name=admin-XABU1 and user-SOPJD, state=enabled returns your account
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+        #  5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
+        #  6. VM deployed in admin account should FAIL to deploy
+        #     VM should be deployed in user account only
+        #    verify VM's IP is within shared network range
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin type account created: %s" % self.admin_account.account.name)
+        
+        #Create an user account
+        self.user_account = Account.create(
+                         self.api_client,
+                         self.services["account"],
+                         admin=False,
+                         domainid=self.domain.id
+                         )
+        
+        self.cleanup_accounts.append(self.user_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.user_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The user account created is not enabled."
+            )
+        
+        self.debug("User type account created: %s" % self.user_account.account.name)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )         
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network Offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                               self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "Account"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        
+        self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         accountid=self.user_account.account.name,
+                         domainid=self.user_account.account.domainid,
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id
+                         )
+        
+        self.cleanup_networks.append(self.network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+        
+        self.debug("Network created: %s" % self.network.id)
+        
+        try:
+            self.admin_account_virtual_machine = VirtualMachine.create(
+                                                           self.api_client,
+                                                           self.services["virtual_machine"],
+                                                           accountid=self.admin_account.account.name,
+                                                           domainid=self.admin_account.account.domainid,
+                                                           networkids=self.network.id,
+                                                           serviceofferingid=self.service_offering.id
+                                                           )
+            self.fail("Virtual Machine got created in admin account with network created but the network used is of scope account and for user account.")
+        except Exception as e:
+            self.debug("Virtual Machine creation failed as network used have scoped only for user account.")
+
+        self.user_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.user_account.account.name,
+                                                       domainid=self.user_account.account.domainid,
+                                                       networkids=self.network.id,
+                                                       serviceofferingid=self.service_offering.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.user_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        
+        ip_range = list(netaddr.iter_iprange(unicode(self.services["network"]["startip"]), unicode(self.services["network"]["endip"])))
+        if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+            self.fail("Virtual machine ip should be from the ip range assigned to network created.")
+
+    def test_createSharedNetwork_domainSpecific(self):
+        """ Test Shared Network with scope domain """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #    create a domain - DOM
+        #    create a domain admin account = domadmin-SOPJD
+        #    create a user in domain - DOM
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #    - name = "MySharedOffering"
+        #    - guestiptype="shared"
+        #    - services = {Dns, Dhcp, UserData}
+        #    -  conservemode = false
+        #    - specifyVlan = true
+        #    - specifyIpRanges = true
+        #  4. Enable network offering - updateNetworkOffering - state=Enabled
+        #  5. createNetwork
+        #    - name = mysharednetwork, displaytext = mysharednetwork
+        #    - vlan = 123 (say)
+        #    - networkofferingid = <mysharedoffering>
+        #    - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
+        #    - scope = domain, domain = DOM
+        #  6. deployVirtualMachine in this admin, domainadmin and user account & within networkid = <mysharednetwork>
+        #  7. delete all the accounts
+        # Validations,
+        #  1. listAccounts state=enabled returns your accounts, listDomains - DOM should be created
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+        #  5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
+        #  6. VM should NOT be deployed in admin account
+        #     VM should be deployed in user account and domain admin account
+        #     verify VM's IP are within shared network range
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin type account created: %s" % self.admin_account.account.id)
+        
+        #create domain
+        self.dom_domain = Domain.create(
+                                self.api_client,
+                                self.services["domain"],
+                                )
+        
+        self.cleanup_domains.append(self.dom_domain)
+        
+        #verify that the account got created with state enabled
+        list_domains_response = Domain.list(
+                                      self.api_client,
+                                      id=self.dom_domain.id 
+                                      )
+        self.assertEqual(
+            isinstance(list_domains_response, list),
+            True,
+            "listDomains returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_domains_response),
+            0,
+            "listDomains returned empty list."
+            )
+        
+        self.debug("Domain created: %s" % self.dom_domain.id)
+        
+        #Create admin account
+        self.domain_admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.dom_domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.domain_admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.domain_admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The domain admin account created is not enabled."
+            )
+        
+        self.debug("Domain admin account created: %s" % self.domain_admin_account.account.id)
+        
+        #Create an user account
+        self.domain_user_account = Account.create(
+                         self.api_client,
+                         self.services["account"],
+                         admin=False,
+                         domainid=self.dom_domain.id
+                         )
+        
+        self.cleanup_accounts.append(self.domain_user_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.domain_user_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The domain user account created is not enabled."
+            )
+        
+        self.debug("Domain user account created: %s" % self.domain_user_account.account.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Network Offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "domain"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        
+        self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         domainid=self.dom_domain.id,
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id
+                         )
+        
+        self.cleanup_networks.append(self.network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+        
+        self.debug("Shared Network created: %s" % self.network.id)
+        
+        try:
+            self.admin_account_virtual_machine = VirtualMachine.create(
+                                                           self.api_client,
+                                                           self.services["virtual_machine"],
+                                                           accountid=self.admin_account.account.name,
+                                                           domainid=self.admin_account.account.domainid,
+                                                           networkids=self.network.id,
+                                                           serviceofferingid=self.service_offering.id
+                                                           )
+            self.fail("Virtual Machine got created in admin account with network specified but the network used is of scope domain and admin account is not part of this domain.")
+        except Exception as e:
+            self.debug("Virtual Machine creation failed as network used have scoped only for DOM domain.")
+
+        self.domain_user_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.domain_user_account.account.name,
+                                                       domainid=self.domain_user_account.account.domainid,
+                                                       networkids=self.network.id,
+                                                       serviceofferingid=self.service_offering.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.domain_user_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+            
+        ip_range = list(netaddr.iter_iprange(unicode(self.services["network"]["startip"]), unicode(self.services["network"]["endip"])))
+        if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+            self.fail("Virtual machine ip should be from the ip range assigned to network created.")
+            
+        self.domain_admin_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.domain_admin_account.account.name,
+                                                       domainid=self.domain_admin_account.account.domainid,
+                                                       networkids=self.network.id,
+                                                       serviceofferingid=self.service_offering.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.domain_admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+            
+        ip_range = list(netaddr.iter_iprange(unicode(self.services["network"]["startip"]), unicode(self.services["network"]["endip"])))
+        if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+            self.fail("Virtual machine ip should be from the ip range assigned to network created.")
+
+    def test_createSharedNetwork_projectSpecific(self):
+        """ Test Shared Network with scope project  """
+        
+        # Steps,
+        #  1. create an Admin Account - admin-XABU1
+        #     create a project - proj-SADJKS
+        #     create another project - proj-SLDJK
+        #  2. listPhysicalNetworks in available zone
+        #  3. createNetworkOffering: 
+        #    - name = "MySharedOffering"
+        #    - guestiptype="shared"
+        #    - services = {Dns, Dhcp, UserData}
+        #    -  conservemode = false
+        #    - specifyVlan = true
+        #    - specifyIpRanges = true
+        #  4. Enable network offering - updateNetworkOffering - state=Enabled
+        #  5. createNetwork
+        #    - name = mysharednetwork, displaytext = mysharednetwork
+        #    - vlan = 123 (say)
+        #    - networkofferingid = <mysharedoffering>
+        #    - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
+        #    - scope = project, project =  proj-SLDJK
+        #  6. deployVirtualMachine in admin, project and user account & within networkid = <mysharednetwork>
+        #  7. delete all the accounts
+        # Validations,
+        #  1. listAccounts state=enabled returns your accounts, listDomains - DOM should be created
+        #  2. listPhysicalNetworks should return at least one active physical network
+        #  3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+        #  5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
+        #  6. VM should NOT be deployed in admin account and user account
+        #     VM should be deployed in project account only
+        #     verify VM's IP are within shared network range
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin account created: %s" % self.admin_account.account.id)
+        
+        self.services["project"]["name"] = "proj-SADJKS"
+        self.services["project"]["displaytext"] = "proj-SADJKS"
+        
+        self.project1 = Project.create(
+                                 self.api_client,
+                                 self.services["project"],
+                                 account=self.admin_account.account.name,
+                                 domainid=self.admin_account.account.domainid
+                                 )
+        
+        self.cleanup_projects.append(self.project1)
+        
+        list_projects_response = Project.list(
+                                        self.api_client,
+                                        id=self.project1.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_projects_response, list),
+            True,
+            "listProjects returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_projects_response),
+            0,
+            "listProjects should return at least one."
+            )
+        
+        self.debug("Project created: %s" % self.project1.id)
+        
+        self.services["project"]["name"] = "proj-SLDJK"
+        self.services["project"]["displaytext"] = "proj-SLDJK"
+        
+        self.project2 = Project.create(
+                                 self.api_client,
+                                 self.services["project"],
+                                 account=self.admin_account.account.name,
+                                 domainid=self.admin_account.account.domainid
+                                 )
+        
+        self.cleanup_projects.append(self.project2)
+        
+        list_projects_response = Project.list(
+                                        self.api_client,
+                                        id=self.project2.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_projects_response, list),
+            True,
+            "listProjects returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_projects_response),
+            0,
+            "listProjects should return at least one."
+            )
+        
+        self.debug("Project2 created: %s" % self.project2.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        self.debug("Shared Network found: %s" % self.shared_network_offering.id)
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "account"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        
+        self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         projectid=self.project1.id,
+                         domainid=self.admin_account.account.domainid,
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id
+                         )
+        self.cleanup_networks.append(self.network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network.id,
+                    projectid=self.project1.id,
+                    listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+        
+        self.debug("Shared Network created: %s" % self.network.id)
+        
+        try:
+            self.project2_admin_account_virtual_machine = VirtualMachine.create(
+                                                           self.api_client,
+                                                           self.services["virtual_machine"],
+                                                           accountid=self.admin_account.account.name,
+                                                           domainid=self.admin_account.account.domainid,
+                                                           networkids=self.network.id,
+                                                           projectid=self.project2.id,
+                                                           serviceofferingid=self.service_offering.id
+                                                           )
+            self.fail("Virtual Machine got created in admin account with network specified but the network used is of scope project and the project2 is not assigned for the network.")
+        except Exception as e:
+            self.debug("Virtual Machine creation failed as network used have scoped only for project project1.")
+
+        self.project1_admin_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.admin_account.account.name,
+                                                       domainid=self.admin_account.account.domainid,
+                                                       networkids=self.network.id,
+                                                       projectid=self.project1.id,
+                                                       serviceofferingid=self.service_offering.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.project1_admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        
+        ip_range = list(netaddr.iter_iprange(unicode(self.services["network"]["startip"]), unicode(self.services["network"]["endip"])))
+        if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+            self.fail("Virtual machine ip should be from the ip range assigned to network created.")
+		
+    def test_createSharedNetwork_usedVlan(self):
+        """ Test Shared Network with used vlan 01 """
+        
+        # Steps,
+        #  1. create an Admin account
+        #  2. create a shared NetworkOffering
+        #  3. enable the network offering
+        #  4. listPhysicalNetworks 
+        #    - vlan = guest VLAN range = 10-90 (say)
+        #  5. createNetwork
+        #    - name = mysharednetwork, displaytext = mysharednetwork
+        #    - vlan = any vlan between 10-90
+        #    - networkofferingid = <mysharedoffering>
+        #    - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
+        #    - scope = all
+        #  6. delete admin account
+        # Validations,
+        #  1. listAccounts state=enabled returns your account
+        #  2. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  3. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+        #  4. listPhysicalNetworks should return at least one active physical network
+        #  5. network creation should FAIL since VLAN is used for guest networks 
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Domain admin account created: %s" % self.admin_account.account.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network Offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["vlan"] = str.split(str(physical_network.vlan), "-")[0]
+        self.services["network"]["acltype"] = "domain"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        
+        try:
+            self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id,
+                         )
+            self.fail("Network created with used vlan id, which is invalid")
+        except Exception as e:
+            self.debug("Network creation failed because the valn id being used by another network.")
+    
+    def test_createSharedNetwork_usedVlan2(self):
+        """ Test Shared Network with used vlan 02 """
+        
+        # Steps,
+        #  1. create an Admin account
+        #  2. create a shared NetworkOffering
+        #  3. enable the network offering
+        #  4. listPhysicalNetworks 
+        #    - vlan = guest VLAN range = 10-90 (say)
+        #  5. createNetwork
+        #    - name = mysharednetwork, displaytext = mysharednetwork
+        #    - vlan = any vlan beyond 10-90 (123 for eg)
+        #    - networkofferingid = <mysharedoffering>
+        #    - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
+        #    - scope = all
+        #  6. createNetwork again with same VLAN  but different IP ranges and gw
+        #  7. delete admin account
+        # Validations,
+        #  1. listAccounts state=enabled returns your account
+        #  2. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
+        #  3. listNetworkOfferings - name=mysharedoffering, should list enabled offering
+        #  4. listPhysicalNetworks should return at least one active physical network
+        #  5. network creation shoud PASS
+        #  6. network creation should FAIL since VLAN is already used by previously created network
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin account created: %s" % self.admin_account.account.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network Offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "Domain"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        self.services["network"]["vlan"] = "567"
+        self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id,
+                         )
+        
+        self.cleanup_networks.append(self.network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+        
+        self.debug("Network created: %s" % self.network.id)
+        
+        self.services["network1"]["vlan"] = self.services["network"]["vlan"] 
+        self.services["network1"]["acltype"] = "domain"
+        self.services["network1"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network1"]["physicalnetworkid"] = physical_network.id
+        
+        try:
+            self.network1 = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id,
+                         )
+	    self.cleanup_networks.append(self.network1)
+            self.fail("Network got created with used vlan id, which is invalid")
+        except Exception as e:
+            self.debug("Network creation failed because the valn id being used by another network.")
+
+    def test_deployVM_multipleSharedNetwork(self):
+        """ Test Vm deployment with multiple shared networks """
+        
+        # Steps,
+        #  0. create a user account
+        #  1. Create two shared Networks (scope=ALL, different IP ranges)
+        #  2. deployVirtualMachine in both the above networkids within the user account
+        #  3. delete the user account
+        # Validations,
+        #  1. shared networks should be created successfully
+        #  2. a. VM should deploy successfully
+        #     b. VM should bedeployed in both networks and have IP in both the networks
+        
+        #Create admin account
+        self.admin_account = Account.create(
+	                     self.api_client,
+					     self.services["account"],
+					     admin=True,
+					     domainid=self.domain.id
+					   )
+
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin account created: %s" % self.admin_account.account.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "domain"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+
+        self.network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id,
+                         )
+        
+        self.cleanup_networks.append(self.network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+            
+        self.debug("Shared Network created: %s" % self.network.id)
+        
+        self.services["network1"]["acltype"] = "domain"
+        self.services["network1"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network1"]["physicalnetworkid"] = physical_network.id
+
+        self.network1 = Network.create(
+                         self.api_client,
+                         self.services["network1"],
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id,
+                         )
+        
+        self.cleanup_networks.append(self.network1)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.network1.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+
+        self.debug("Network created: %s" % self.network1.id)
+        
+        self.network_admin_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.admin_account.account.name,
+                                                       domainid=self.admin_account.account.domainid,
+                                                       networkids=self.network.id,
+						       serviceofferingid=self.service_offering.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.network_admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        
+        self.debug("Virtual Machine created: %s" % self.network_admin_account_virtual_machine.id)
+        
+        self.assertTrue(self.network_admin_account_virtual_machine.nic[0].ipaddress is not None, "ip should be assigned to running virtual machine")
+        
+        self.network1_admin_account_virtual_machine = VirtualMachine.create(
+                                                       self.api_client,
+                                                       self.services["virtual_machine"],
+                                                       accountid=self.admin_account.account.name,
+                                                       domainid=self.admin_account.account.domainid,
+                                                       networkids=self.network1.id,
+                                                       serviceofferingid=self.service_offering.id
+                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.network1_admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        self.debug("Virtual Machine created: %s" % self.network1_admin_account_virtual_machine.id)
+        
+        self.assertTrue(self.network1_admin_account_virtual_machine.nic[0].ipaddress is not None, "ip should be assigned to running virtual machine")
+
+    def test_deployVM_isolatedAndShared(self):
+        """ Test VM deployment in shared and isolated networks """
+        
+        # Steps,
+        #  0. create a user account
+        #  1. Create one shared Network (scope=ALL, different IP ranges)
+        #  2. Create one Isolated Network 
+        #  3. deployVirtualMachine in both the above networkids within the user account
+        #  4. apply FW rule and enable PF for port 22 for guest VM on isolated network
+        #  5. delete the user account
+        # Validations,
+        #  1. shared network should be created successfully
+        #  2. isolated network should be created successfully
+        #  3. 
+        #    a. VM should deploy successfully
+        #    b. VM should bedeployed in both networks and have IP in both the networks
+        #  4. FW and PF should apply successfully, ssh into the VM should work over isolated network
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        liistall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )
+        
+        self.debug("Admin type account created: %s" % self.admin_account.account.name)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        self.isolated_network_offering = NetworkOffering.create(
+                                          self.api_client,
+                                          self.services["isolated_network_offering"],
+                                          conservemode=False
+                                          )
+        
+        self.cleanup.append(self.isolated_network_offering)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                                                           self.isolated_network_offering,
+                                                           self.api_client,
+                                                           id=self.isolated_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.isolated_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The isolated network offering state should get updated to Enabled."
+            )
+        
+        self.debug("Isolated Network Offering created: %s" % self.isolated_network_offering.id)
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]        
+
+	    #create network using the shared network offering created
+        self.services["network"]["acltype"] = "domain"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        self.shared_network = Network.create(
+                         self.api_client,
+                         self.services["network"],
+                         domainid=self.admin_account.account.domainid,
+                         networkofferingid=self.shared_network_offering.id,
+                         zoneid=self.zone.id
+                         )
+        
+        self.cleanup_networks.append(self.shared_network)
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.shared_network.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        self.assertEqual(
+            list_networks_response[0].specifyipranges,
+            True,
+            "The network is created with ip range but the flag is set to False."
+            )
+
+        self.debug("Shared Network created: %s" % self.shared_network.id)
+        
+        self.isolated_network = Network.create(
+                         self.api_client,
+                         self.services["isolated_network"],
+		accountid=self.admin_account.account.name,
+                         domainid=self.admin_account.account.domainid,
+                         networkofferingid=self.isolated_network_offering.id,
+                         zoneid=self.zone.id
+                         )
+        
+        self.cleanup_networks.append(self.isolated_network)             
+        
+        list_networks_response = Network.list(
+                                        self.api_client,
+                                        id=self.isolated_network.id
+                                        )
+        self.assertEqual(
+            isinstance(list_networks_response, list),
+            True,
+            "listNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_networks_response),
+            0,
+            "listNetworks returned empty list."
+            )
+        
+        self.debug("Isolated Network created: %s" % self.isolated_network.id)
+        
+        self.shared_network_admin_account_virtual_machine = VirtualMachine.create(
+                                                                     self.api_client,
+                                                                     self.services["virtual_machine"],
+                                                                     accountid=self.admin_account.account.name,
+                                                                     domainid=self.admin_account.account.domainid,
+                                                                     networkids=self.shared_network.id,
+								     serviceofferingid=self.service_offering.id
+                                                                     )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.shared_network_admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        self.debug("Virtual Machine created: %s" % self.shared_network_admin_account_virtual_machine.id)
+        
+        self.assertTrue(self.shared_network_admin_account_virtual_machine.nic[0].ipaddress is not None, "ip should be assigned to running virtual machine")
+        
+        self.isolated_network_admin_account_virtual_machine = VirtualMachine.create(
+                                                                       self.api_client,
+                                                                       self.services["virtual_machine"],
+                                                                       accountid=self.admin_account.account.name,
+                                                                       domainid=self.admin_account.account.domainid,
+                                                                       networkids=self.isolated_network.id,
+								       serviceofferingid=self.service_offering.id
+                                                                       )
+        vms = VirtualMachine.list(
+                            self.api_client,
+                            id=self.isolated_network_admin_account_virtual_machine.id,
+                            listall=True
+                            )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+            )
+        
+        self.debug("Virtual Machine created: %s" % self.isolated_network_admin_account_virtual_machine.id)
+        
+        self.assertTrue(self.isolated_network_admin_account_virtual_machine.nic[0].ipaddress is not None, "ip should be assigned to running virtual machine")
+        
+        self.debug("Associating public IP for account: %s" % self.admin_account.account.name)
+        self.public_ip = PublicIPAddress.create(
+                                    self.api_client,
+                                    accountid=self.admin_account.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.admin_account.account.domainid,
+                                    networkid=self.isolated_network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (self.public_ip.ipaddress.ipaddress, self.isolated_network.id))
+        self.debug("Creating PF rule for IP address: %s" % self.public_ip.ipaddress.ipaddress)
+	    
+        public_ip = self.public_ip.ipaddress
+
+        # Enable Static NAT for VM
+        StaticNATRule.enable(
+                             self.api_client,
+                             public_ip.id,
+                             self.isolated_network_admin_account_virtual_machine.id
+                            )
+        
+        self.debug("Enabled static NAT for public IP ID: %s" % public_ip.id)
+        #Create Firewall rule on source NAT
+        fw_rule = FireWallRule.create(
+                            self.api_client,
+                            ipaddressid=self.public_ip.ipaddress,
+                            protocol='TCP',
+                            cidrlist=[self.services["fw_rule"]["cidr"]],
+                            startport=self.services["fw_rule"]["startport"],
+                            endport=self.services["fw_rule"]["endport"]
+                            )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        fw_rules = FireWallRule.list(
+                                     self.api_client,
+                                     id=fw_rule.id
+                                    )
+        self.assertEqual(
+                         isinstance(fw_rules, list),
+                         True,
+                         "List fw rules should return a valid firewall rules"
+                         )
+
+        self.assertNotEqual(
+                            len(fw_rules),
+                            0,
+                            "Length of fw rules response should not be zero"
+                            )		
+						
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.isolated_network_admin_account_virtual_machine.id)
+            ssh = self.isolated_network_admin_account_virtual_machine.get_ssh_client(ipaddress=self.public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % (self.isolated_network_admin_account_virtual_machine.ipaddress, e))
+
+    def test_networkWithsubdomainaccessTrue(self):
+        """ Test Shared Network with subdomainaccess=True """
+        
+        # Steps,
+        #  1. create Network using shared network offering for scope=Account and subdomainaccess=true.
+        # Validations,
+        #  (Expected) API should fail saying that subdomainaccess cannot be given when scope is Account
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )        
+        
+        self.debug("Admin type account created: %s" % self.admin_account.account.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )         
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network Offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                               self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "Account"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        self.services["network"]["subdomainaccess"] = "True"
+        
+        try:
+            self.network = Network.create(
+                             self.api_client,
+                             self.services["network"],
+                             accountid=self.admin_account.account.name,
+                             domainid=self.admin_account.account.domainid,
+                             networkofferingid=self.shared_network_offering.id,
+                             zoneid=self.zone.id
+                             )
+            self.fail("Network creation should fail.")
+        except:
+            self.debug("Network creation failed because subdomainaccess parameter was passed when scope was account.")
+
+    def test_networkWithsubdomainaccessFalse(self):
+        """ Test shared Network with subdomainaccess=False """
+        
+        # Steps,
+        #  1. create Network using shared network offering for scope=Account and subdomainaccess=false
+        # Validations,
+        #  (Expected) API should fail saying that subdomainaccess cannot be given when scope is Account
+        
+        #Create admin account
+        self.admin_account = Account.create(
+                                     self.api_client,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        
+        self.cleanup_accounts.append(self.admin_account)
+        
+        #verify that the account got created with state enabled
+        list_accounts_response = Account.list(
+                                        self.api_client,
+                                        id=self.admin_account.account.id,
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_accounts_response, list),
+            True,
+            "listAccounts returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_accounts_response),
+            0,
+            "listAccounts returned empty list."
+            )
+        self.assertEqual(
+            list_accounts_response[0].state,
+            "enabled",
+            "The admin account created is not enabled."
+            )        
+        
+        self.debug("Admin type account created: %s" % self.admin_account.account.id)
+        
+        #Verify that there should be at least one physical network present in zone.
+        list_physical_networks_response = PhysicalNetwork.list(
+                                                         self.api_client,
+                                                         zoneid=self.zone.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_physical_networks_response, list),
+            True,
+            "listPhysicalNetworks returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_physical_networks_response),
+            0,
+            "listPhysicalNetworks should return at least one physical network."
+            )
+        
+        physical_network = list_physical_networks_response[0]
+        
+        self.debug("Physical Network found: %s" % physical_network.id)
+        
+        self.services["network_offering"]["specifyVlan"] = "True"
+        self.services["network_offering"]["specifyIpRanges"] = "True"
+        
+        #Create Network Offering
+        self.shared_network_offering = NetworkOffering.create(
+                                                 self.api_client,
+                                                 self.services["network_offering"],
+                                                 conservemode=False
+                                                 )         
+        
+        self.cleanup.append(self.shared_network_offering)
+        
+        #Verify that the network offering got created 
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Disabled",
+            "The network offering created should be bydefault disabled."
+            )
+        
+        self.debug("Shared Network Offering created: %s" % self.shared_network_offering.id)
+        
+        #Update network offering state from disabled to enabled.
+        network_offering_update_response = NetworkOffering.update(
+                               self.shared_network_offering,
+                                                           self.api_client,
+                                                           id=self.shared_network_offering.id,
+                                                           state="enabled"
+                                                           )
+        #Verify that the state of the network offering is updated
+        list_network_offerings_response = NetworkOffering.list(
+                                                         self.api_client,
+                                                         id=self.shared_network_offering.id
+                                                         )
+        self.assertEqual(
+            isinstance(list_network_offerings_response, list),
+            True,
+            "listNetworkOfferings returned invalid object in response."
+            )
+        self.assertNotEqual(
+            len(list_network_offerings_response),
+            0,
+            "listNetworkOfferings returned empty list."
+            )
+        self.assertEqual(
+            list_network_offerings_response[0].state,
+            "Enabled",
+            "The network offering state should get updated to Enabled."
+            )
+        
+        #create network using the shared network offering created
+        self.services["network"]["acltype"] = "Account"
+        self.services["network"]["networkofferingid"] = self.shared_network_offering.id
+        self.services["network"]["physicalnetworkid"] = physical_network.id
+        self.services["network"]["subdomainaccess"] = "False"
+        
+        try:
+            self.network = Network.create(
+                             self.api_client,
+                             self.services["network"],
+                             accountid=self.admin_account.account.name,
+                             domainid=self.admin_account.account.domainid,
+                             networkofferingid=self.shared_network_offering.id,
+                             zoneid=self.zone.id
+                             )
+            self.fail("Network creation should fail.")
+        except:
+            self.debug("Network creation failed because subdomainaccess parameter was passed when scope was account.")
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_snapshots.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_snapshots.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_snapshots.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_snapshots.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1436 @@
+# 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.
+""" P1 tests for Snapshots
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+
+
+class Services:
+    """Test Snapshots Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 200,    # in MHz
+                                    "memory": 256,      # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small Disk",
+                                    "name": "Small Disk",
+                                    "disksize": 1
+                        },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "mgmt_server": {
+                                    "ipaddress": '192.168.100.21',
+                                    "username": "root",
+                                    "password": "password",
+                                    "port": 22,
+                                },
+                        "recurring_snapshot": {
+                                    "intervaltype": 'HOURLY',
+                                    # Frequency of snapshots
+                                    "maxsnaps": 1,  # Should be min 2
+                                    "schedule": 1,
+                                    "timezone": 'US/Arizona',
+                                    # Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
+                                },
+                        "templates": {
+                                    "displaytext": 'Template',
+                                    "name": 'Template',
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                                },
+                        "diskdevice": "/dev/xvda",
+                        "diskname": "TestDiskServ",
+                        "size": 1,  # GBs
+
+                        "mount_dir": "/mnt/tmp",
+                        "sub_dir": "test",
+                        "sub_lvl_dir1": "test1",
+                        "sub_lvl_dir2": "test2",
+                        "random_data": "random.data",
+
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced',     # Networking mode: Advanced, Basic
+                    }
+
+
+class TestCreateVMsnapshotTemplate(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestCreateVMsnapshotTemplate, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = cls.template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_createVM_snapshotTemplate(self):
+        """Test create VM, Snapshot and Template
+        """
+        # Validate the following
+        # 1. Deploy VM using default template, small service offering
+        #    and small data disk offering.
+        # 2. Perform snapshot on the root disk of this VM.
+        # 3. Create a template from snapshot.
+        # 4. Create a instance from above created template.
+        # 5. listSnapshots should list the snapshot that was created.
+        # 6. verify that secondary storage NFS share contains the reqd
+        #  volume under /secondary/snapshots/$accountid/$volumeid/$snapshot_uuid
+        # 7. verify backup_snap_id was non null in the `snapshots` table
+        # 8. listTemplates() should return the newly created Template,
+        #    and check for template state as READY"
+        # 9. listVirtualMachines() command should return the deployed VM.
+        #    State of this VM should be Running.
+
+        #Create Virtual Machine
+        self.virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                                )
+        self.debug("Created VM with ID: %s" % self.virtual_machine.id)
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=self.virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        volume = volumes[0]
+
+        # Create a snapshot from the ROOTDISK
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+        self.debug("Snapshot created: ID - %s" % snapshot.id)
+        self.cleanup.append(snapshot)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+        self.debug("select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % snapshot.id)
+        # Verify backup_snap_id is not NULL
+        qresultset = self.dbclient.execute(
+                        "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % snapshot.id
+                        )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = qresultset[0]
+
+        snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
+        account_id = qresult[1]
+        volume_id = qresult[2]
+
+        # Generate template from the snapshot
+        template = Template.create_from_snapshot(
+                                    self.apiclient,
+                                    snapshot,
+                                    self.services["templates"]
+                                    )
+        self.debug("Created template from snapshot: %s" % template.id)
+        self.cleanup.append(template)
+
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+
+        self.assertNotEqual(
+                            templates,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                            templates[0].isready,
+                            True,
+                            "Check new template state in list templates call"
+                        )
+
+        # Deploy new virtual machine using template
+        new_virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+        self.debug("Created VM with ID: %s from template: %s" % (
+                                                        new_virtual_machine.id,
+                                                        template.id
+                                                        ))
+        self.cleanup.append(new_virtual_machine)
+
+        # Newly deployed VM should be 'Running'
+        virtual_machines = list_virtual_machines(
+                                self.apiclient,
+                                id=new_virtual_machine.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+        self.assertEqual(
+                            isinstance(virtual_machines, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                             len(virtual_machines),
+                             0,
+                             "Check list virtual machines response"
+                             )
+        for virtual_machine in virtual_machines:
+            self.assertEqual(
+                        virtual_machine.state,
+                        'Running',
+                        "Check list VM response for Running state"
+                    )
+        # Get the Secondary Storage details from  list Hosts
+        hosts = list_hosts(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                                 )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export/test"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
+
+            # Stripping end ':' from storage type
+            storage_type = parse_url[0][:-1]
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+            if sec_storage_ip[-1] != ":":
+                sec_storage_ip = sec_storage_ip + ":"
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export/test
+
+            # Sleep to ensure that snapshot is reflected in sec storage
+            time.sleep(self.services["sleep"])
+            try:
+                # Login to VM to check snapshot present on sec disk
+                ssh_client = remoteSSHClient(
+                                    self.services["mgmt_server"]["ipaddress"],
+                                    self.services["mgmt_server"]["port"],
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["password"],
+                                    )
+
+                cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount -t %s %s/%s %s" % (
+                                         storage_type,
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                    "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                ]
+                for c in cmds:
+                    self.debug("command: %s" % c)
+                    result = ssh_client.execute(c)
+                    self.debug("Result: %s" % result)
+
+            except Exception as e:
+                self.fail("SSH failed for Management server: %s - %s" %
+                                (self.services["mgmt_server"]["ipaddress"], e))
+            uuids.append(result)
+            # Unmount the Sec Storage
+            cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                    ]
+            try:
+                for c in cmds:
+                    self.debug("command: %s" % c)
+                    result = ssh_client.execute(c)
+                    self.debug("Result: %s" % result)
+
+            except Exception as e:
+                self.fail("SSH failed for Management server: %s - %s" %
+                                (self.services["mgmt_server"]["ipaddress"], e))
+
+        res = str(uuids)
+        self.assertEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+
+        return
+
+
+class TestAccountSnapshotClean(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestAccountSnapshotClean, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            cls.api_client,
+                            virtualmachineid=cls.virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        volume = volumes[0]
+
+        # Create a snapshot from the ROOTDISK
+        cls.snapshot = Snapshot.create(cls.api_client, volumes[0].id)
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns"])
+    def test_02_accountSnapshotClean(self):
+        """Test snapshot cleanup after account deletion
+        """
+        # Validate the following
+        # 1. listAccounts API should list out the newly created account
+        # 2. listVirtualMachines() command should return the deployed VM.
+        #    State of this VM should be "Running"
+        # 3. a)listSnapshots should list the snapshot that was created.
+        #    b)verify that secondary storage NFS share contains the reqd volume
+        #      under /secondary/snapshots/$accountid/$volumeid/$snapshot_uuid
+        # 4. a)listAccounts should not list account that is deleted
+        #    b) snapshot image($snapshot_uuid) should be deleted from the
+        #       /secondary/snapshots/$accountid/$volumeid/
+
+        accounts = list_accounts(
+                                 self.apiclient,
+                                 id=self.account.account.id
+                                 )
+        self.assertEqual(
+                            isinstance(accounts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                             len(accounts),
+                             0,
+                             "Check list Accounts response"
+                             )
+
+        # VM should be in 'Running' state
+        virtual_machines = list_virtual_machines(
+                                self.apiclient,
+                                id=self.virtual_machine.id
+                                )
+        self.assertEqual(
+                            isinstance(virtual_machines, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                             len(virtual_machines),
+                             0,
+                             "Check list virtual machines response"
+                             )
+        for virtual_machine in virtual_machines:
+            self.debug("VM ID: %s, VM state: %s" % (
+                                            virtual_machine.id,
+                                            virtual_machine.state
+                                            ))
+            self.assertEqual(
+                        virtual_machine.state,
+                        'Running',
+                        "Check list VM response for Running state"
+                    )
+
+        # Verify the snapshot was created or not
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=self.snapshot.id
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            self.snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Fetch values from database
+        qresultset = self.dbclient.execute(
+                        "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % self.snapshot.id
+                        )
+        self.assertEqual(
+                            isinstance(qresultset, list),
+                            True,
+                            "Check DB response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = qresultset[0]
+        snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
+        account_id = qresult[1]
+        volume_id = qresult[2]
+
+        # Get the Secondary Storage details from  list Hosts
+        hosts = list_hosts(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                            )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export/test"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
+
+            # Stripping end ':' from storage type
+            storage_type = parse_url[0][:-1]
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+
+            if sec_storage_ip[-1] != ":":
+                sec_storage_ip = sec_storage_ip + ":"
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export/test
+
+            # Sleep to ensure that snapshot is reflected in sec storage
+            time.sleep(self.services["sleep"])
+            try:
+                # Login to Secondary storage VM to check snapshot present on sec disk
+                ssh_client = remoteSSHClient(
+                                    self.services["mgmt_server"]["ipaddress"],
+                                    self.services["mgmt_server"]["port"],
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["password"],
+                                    )
+
+                cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount -t %s %s/%s %s" % (
+                                         storage_type,
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                    "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                ]
+
+                for c in cmds:
+                    self.debug("command: %s" % c)
+                    result = ssh_client.execute(c)
+                    self.debug("Result: %s" % result)
+
+                uuids.append(result)
+
+                # Unmount the Sec Storage
+                cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                    ]
+                for c in cmds:
+                    result = ssh_client.execute(c)
+            except Exception as e:
+                self.fail("SSH failed for management server: %s - %s" %
+                                (self.services["mgmt_server"]["ipaddress"], e))
+
+        res = str(uuids)
+        self.assertEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+
+        self.debug("Deleting account: %s" % self.account.account.name)
+        # Delete account
+        self.account.delete(self.apiclient)
+
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+        self.assertEqual(
+                            isinstance(interval, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.debug("account.cleanup.interval: %s" % interval[0].value)
+
+        # Wait for account cleanup interval
+        time.sleep(int(interval[0].value) * 2)
+
+        accounts = list_accounts(
+                                 self.apiclient,
+                                 id=self.account.account.id
+                                 )
+
+        self.assertEqual(
+            accounts,
+            None,
+            "List accounts should return empty list after account deletion"
+            )
+
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export/test"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
+
+            # Stripping end ':' from storage type
+            storage_type = parse_url[0][:-1]
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+
+            if sec_storage_ip[-1] != ":":
+                sec_storage_ip = sec_storage_ip + ":"
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export/test
+
+            try:
+                cmds = [
+                        "mount -t %s %s/%s %s" % (
+                                         storage_type,
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                        "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                        ]
+
+                for c in cmds:
+                    self.debug("command: %s" % c)
+                    result = ssh_client.execute(c)
+                    self.debug("Result: %s" % result)
+
+                uuids.append(result)
+                # Unmount the Sec Storage
+                cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                    ]
+                for c in cmds:
+                    self.debug("command: %s" % c)
+                    result = ssh_client.execute(c)
+                    self.debug("Result: %s" % result)
+
+            except Exception as e:
+                self.fail("SSH failed for management server: %s - %s" %
+                                (self.services["mgmt_server"]["ipaddress"], e))
+
+        res = str(uuids)
+        self.assertNotEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+        return
+
+
+class TestSnapshotDetachedDisk(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshotDetachedDisk, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["server"]["diskoffering"] = cls.disk_offering.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns"])
+    def test_03_snapshot_detachedDisk(self):
+        """Test snapshot from detached disk
+        """
+        # Validate the following
+        # 1. login in VM  and write some data on data disk(use fdisk to
+        #    partition datadisk,fdisk /dev/sdb, and make filesystem using
+        #    mkfs.ext3)
+        # 2. Detach the data disk and write some data on data disk
+        # 3. perform the snapshot on the detached volume
+        # 4. listvolumes with VM id shouldn't show the detached volume
+        # 5. listSnapshots should list the snapshot that was created
+        # 6. verify that secondary storage NFS share contains the reqd volume
+        #    under /secondary/snapshots/$accountid/$volumeid/$snapshot_uuid
+        # 7. verify backup_snap_id was non null in the `snapshots` table
+
+        volumes = list_volumes(
+                               self.apiclient,
+                               virtualmachineid=self.virtual_machine.id,
+                               type='DATADISK',
+                               listall=True
+                               )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        volume = volumes[0]
+        random_data_0 = random_gen(100)
+        random_data_1 = random_gen(100)
+        try:
+            ssh_client = self.virtual_machine.get_ssh_client()
+
+            #Format partition using ext3
+            format_volume_to_ext3(
+                              ssh_client,
+                              self.services["diskdevice"]
+                              )
+            cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["diskdevice"],
+                                      self.services["mount_dir"]
+                                      ),
+                    "pushd %s" % self.services["mount_dir"],
+                    "mkdir -p %s/{%s,%s} " % (
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["sub_lvl_dir2"]
+                                            ),
+                    "echo %s > %s/%s/%s" % (
+                                               random_data_0,
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["random_data"]
+                                            ),
+                    "echo %s > %s/%s/%s" % (
+                                                random_data_1,
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir2"],
+                                                self.services["random_data"]
+                                            ),
+                    "sync",
+                ]
+            for c in cmds:
+                self.debug(ssh_client.execute(c))
+
+            #detach volume from VM
+            cmd = detachVolume.detachVolumeCmd()
+            cmd.id = volume.id
+            self.apiclient.detachVolume(cmd)
+
+            #Create snapshot from detached volume
+            snapshot = Snapshot.create(self.apiclient, volume.id)
+            self.cleanup.append(snapshot)
+
+            volumes = list_volumes(
+                               self.apiclient,
+                               virtualmachineid=self.virtual_machine.id,
+                               type='DATADISK',
+                               listall=True
+                               )
+
+            self.assertEqual(
+                            volumes,
+                            None,
+                            "Check Volume is detached"
+                      )
+
+            # Verify the snapshot was created or not
+            snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id
+                                   )
+            self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+            self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s - %s" %
+                                (self.virtual_machine.ipaddress, e))
+
+        # Fetch values from database
+        qresultset = self.dbclient.execute(
+                        "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % snapshot.id
+                        )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = qresultset[0]
+        snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
+        account_id = qresult[1]
+        volume_id = qresult[2]
+
+        self.assertNotEqual(
+                            str(qresult[0]),
+                            'NULL',
+                            "Check if backup_snap_id is not null"
+                        )
+
+        # Get the Secondary Storage details from  list Hosts
+        hosts = list_hosts(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                                 )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export/test"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
+
+            # Stripping end ':' from storage type
+            storage_type = parse_url[0][:-1]
+
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+
+            if sec_storage_ip[-1] != ":":
+                sec_storage_ip = sec_storage_ip + ":"
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export/test
+
+            # Sleep to ensure that snapshot is reflected in sec storage
+            time.sleep(self.services["sleep"])
+            try:
+                # Login to Management server to check snapshot present on
+                # sec disk
+                ssh_client = remoteSSHClient(
+                                    self.services["mgmt_server"]["ipaddress"],
+                                    self.services["mgmt_server"]["port"],
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["password"],
+                                    )
+
+                cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount -t %s %s/%s %s" % (
+                                         storage_type,
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                    "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                        ]
+
+                for c in cmds:
+                    result = ssh_client.execute(c)
+
+                uuids.append(result)
+                # Unmount the Sec Storage
+                cmds = [
+                        "umount %s" % (self.services["mount_dir"]),
+                        ]
+                for c in cmds:
+                    result = ssh_client.execute(c)
+            except Exception as e:
+                self.fail("SSH failed for management server: %s - %s" %
+                                (self.services["mgmt_server"]["ipaddress"], e))
+
+        res = str(uuids)
+        self.assertEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+        return
+
+
+class TestSnapshotLimit(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshotLimit, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns"])
+    def test_04_snapshot_limit(self):
+        """Test snapshot limit in snapshot policies
+        """
+        # Validate the following
+        # 1. Perform hourly recurring snapshot on the root disk of VM and keep
+        #    the maxsnapshots as 1
+        # 2. listSnapshots should list the snapshot that was created
+        #    snapshot folder in secondary storage should contain only one
+        #    snapshot image(/secondary/snapshots/$accountid/$volumeid/)
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=self.virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        volume = volumes[0]
+
+        # Create a snapshot policy
+        recurring_snapshot = SnapshotPolicy.create(
+                                           self.apiclient,
+                                           volume.id,
+                                           self.services["recurring_snapshot"]
+                                        )
+        self.cleanup.append(recurring_snapshot)
+
+        snapshot_policy = list_snapshot_policy(
+                                        self.apiclient,
+                                        id=recurring_snapshot.id,
+                                        volumeid=volume.id
+                                        )
+        self.assertEqual(
+                            isinstance(snapshot_policy, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            snapshot_policy,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                        snapshot_policy[0].id,
+                        recurring_snapshot.id,
+                        "Check recurring snapshot id in list resources call"
+                        )
+        self.assertEqual(
+                        snapshot_policy[0].maxsnaps,
+                        self.services["recurring_snapshot"]["maxsnaps"],
+                        "Check interval type in list resources call"
+                        )
+        # Sleep for (maxsnaps+1) hours to verify
+        # only maxsnaps snapshots are retained
+        time.sleep(
+            (self.services["recurring_snapshot"]["maxsnaps"]) * 3600
+            )
+
+        # Verify the snapshot was created or not
+        snapshots = list_snapshots(
+                        self.apiclient,
+                        volumeid=volume.id,
+                        intervaltype=\
+                        self.services["recurring_snapshot"]["intervaltype"],
+                        snapshottype='RECURRING',
+                        listall=True
+                        )
+
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertEqual(
+                         len(snapshots),
+                         self.services["recurring_snapshot"]["maxsnaps"],
+                         "Check maximum number of recurring snapshots retained"
+                        )
+        snapshot = snapshots[0]
+        # Sleep to ensure that snapshot is reflected in sec storage
+        time.sleep(self.services["sleep"])
+
+        # Fetch values from database
+        qresultset = self.dbclient.execute(
+                        "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % snapshot.id
+                        )
+        self.assertEqual(
+                            isinstance(qresultset, list),
+                            True,
+                            "Check DBQuery returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = qresultset[0]
+        snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
+        account_id = qresult[1]
+        volume_id = qresult[2]
+
+        # Get the Secondary Storage details from  list Hosts
+        hosts = list_hosts(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                                 )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export/test"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
+
+            # Stripping end ':' from storage type
+            storage_type = parse_url[0][:-1]
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+
+            if sec_storage_ip[-1] != ":":
+                sec_storage_ip = sec_storage_ip + ":"
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export/test
+            try:
+                # Login to VM to check snapshot present on sec disk
+                ssh_client = remoteSSHClient(
+                                    self.services["mgmt_server"]["ipaddress"],
+                                    self.services["mgmt_server"]["port"],
+                                    self.services["mgmt_server"]["username"],
+                                    self.services["mgmt_server"]["password"],
+                                    )
+
+                cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount -t %s %s/%s %s" % (
+                                         storage_type,
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                    "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                ]
+
+                for c in cmds:
+                    result = ssh_client.execute(c)
+
+                uuids.append(result)
+
+                # Unmount the Sec Storage
+                cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                    ]
+                for c in cmds:
+                    result = ssh_client.execute(c)
+            except Exception as e:
+                raise Exception(
+                        "SSH access failed for management server: %s - %s" %
+                                    (self.services["mgmt_server"]["ipaddress"], e))
+
+        res = str(uuids)
+        self.assertEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+        return
+
+
+class TestSnapshotEvents(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshotEvents, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+    
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns"])
+    def test_05_snapshot_events(self):
+        """Test snapshot events
+        """
+        # Validate the following
+        # 1. Perform snapshot on the root disk of this VM and check the events/alerts.
+        # 2. delete the snapshots and check the events/alerts
+        # 3. listEvents() shows created/deleted snapshot events
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=self.virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        volume = volumes[0]
+
+        # Create a snapshot from the ROOTDISK
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+        self.debug("Snapshot created with ID: %s" % snapshot.id)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+        snapshot.delete(self.apiclient)
+
+        # Sleep to ensure that snapshot is deleted properly
+        time.sleep(self.services["sleep"])
+        events = list_events(
+                             self.apiclient,
+                             account=self.account.account.name,
+                             domainid=self.account.account.domainid,
+                             type='SNAPSHOT.DELETE'
+                             )
+        self.assertEqual(
+                            isinstance(events, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            events,
+                            None,
+                            "Check if event exists in list events call"
+                            )
+        self.assertIn(
+                            events[0].state,
+                            ['Completed', 'Scheduled'],
+                            "Check events state in list events call"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_stopped_vm.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_stopped_vm.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_stopped_vm.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_stopped_vm.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2033 @@
+# -*- encoding: utf-8 -*-
+# 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
+
+""" P1 for stopped Virtual Maschine life cycle
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+#Import System modules
+import time
+
+
+class Services:
+    """Test Stopped VM Life Cycle Services
+    """
+
+    def __init__(self):
+        self.services = {
+                "account": {
+                    "email": "test@test.com",
+                    "firstname": "Test",
+                    "lastname": "User",
+                    "username": "test",
+                    # Random characters are appended in create account to
+                    # ensure unique username generated each time
+                    "password": "password",
+                },
+                "virtual_machine":
+                {
+                    "displayname": "testserver",
+                    "username": "root",     # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                },
+                "service_offering":
+                {
+                    "name": "Tiny Instance",
+                    "displaytext": "Tiny Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,    # in MHz
+                    "memory": 128,      # In MBs
+                },
+                "disk_offering": {
+                    "displaytext": "Small volume",
+                    "name": "Small volume",
+                    "disksize": 20
+                },
+                "volume": {
+                    "diskname": "DataDisk",
+                    "url": '',
+                    "format": 'VHD'
+                },
+                "iso":  # ISO settings for Attach/Detach ISO tests
+                {
+                    "displaytext": "Test ISO",
+                    "name": "testISO",
+                    "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                     # Source URL where ISO is located
+                    "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                    "mode": 'HTTP_DOWNLOAD',    # Downloading existing ISO
+                },
+                "template": {
+                    "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                    "hypervisor": 'XenServer',
+                    "format": 'VHD',
+                    "isfeatured": True,
+                    "ispublic": True,
+                    "isextractable": True,
+                    "displaytext": "Cent OS Template",
+                    "name": "Cent OS Template",
+                    "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                    "templatefilter": 'self',
+                    "passwordenabled": True,
+                },
+            "sleep": 60,
+            "timeout": 10,
+            #Migrate VM to hostid
+            "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+            # CentOS 5.3 (64-bit)
+        }
+
+
+class TestDeployVM(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestDeployVM,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        # Create service offerings, disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offering"]
+                                    )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        # Cleanup
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.services["iso"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_01_deploy_vm_no_startvm(self):
+        """Test Deploy Virtual Machine with no startVM parameter
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  without specifying the startvm parameter
+        # 2. Should be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Running".
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    mode=self.zone.networktype
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Running",
+                            "VM should be in Running state after deployment"
+                        )
+        try:
+            ssh = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH to VM instance failed!")
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_02_deploy_vm_startvm_true(self):
+        """Test Deploy Virtual Machine with startVM=true parameter
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=true
+        # 2. Should be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Running".
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=True,
+                                    diskofferingid=self.disk_offering.id,
+                                    mode=self.zone.networktype
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Running",
+                            "VM should be in Running state after deployment"
+                        )
+        try:
+            ssh = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH to VM instance failed!")
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_03_deploy_vm_startvm_false(self):
+        """Test Deploy Virtual Machine with startVM=false parameter
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=false
+        # 2. Should not be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Stopped".
+        # 4. Check listRouters call for that account. List routers should
+        #    return empty response
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                    diskofferingid=self.disk_offering.id,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Stopped",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+        routers = Router.list(
+                              self.apiclient,
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              listall=True
+                              )
+        self.assertEqual(
+                         routers,
+                         None,
+                         "List routers should return empty response"
+                         )
+        self.debug("Destroying instance: %s" % self.virtual_machine.name)
+        self.virtual_machine.delete(self.apiclient)
+        self.debug("Instance is destroyed!")
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+        self.debug("Instance destroyed..waiting till expunge interval")
+
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='expunge.interval'
+                                    )
+        delay = list_configurations(
+                                    self.apiclient,
+                                    name='expunge.delay'
+                                    )
+        # Sleep to ensure that all resources are deleted
+        time.sleep((int(interval[0].value) + int(delay[0].value)))
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.assertEqual(
+                            list_vm_response,
+                            None,
+                            "Check list response returns a valid list"
+                        )
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_04_deploy_startvm_false_attach_volume(self):
+        """Test Deploy Virtual Machine with startVM=false and attach volume
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=false. Attach volume to the instance
+        # 2. listVM command should return the deployed VM.State of this VM
+        #    should be "Stopped".
+        # 3. Attach volume should be successful
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                    diskofferingid=self.disk_offering.id,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Stopped",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+        self.debug("Creating a volume in account: %s" %
+                                                    self.account.account.name)
+        volume = Volume.create(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                diskofferingid=self.disk_offering.id
+                                )
+        self.debug("Created volume in account: %s" % self.account.account.name)
+        self.debug("Attaching volume to instance: %s" %
+                                                self.virtual_machine.name)
+        try:
+            self.virtual_machine.attach_volume(self.apiclient, volume)
+        except Exception as e:
+            self.fail("Attach volume failed!")
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_05_deploy_startvm_false_change_so(self):
+        """Test Deploy Virtual Machine with startVM=false and
+            change service offering
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=false. Attach volume to the instance
+        # 2. listVM command should return the deployed VM.State of this VM
+        #    should be "Stopped".
+        # 3. Attach volume should be successful
+        # 4. Change service offering
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                    diskofferingid=self.disk_offering.id,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Stopped",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+        self.debug("Creating a volume in account: %s" %
+                                                    self.account.account.name)
+        volume = Volume.create(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                diskofferingid=self.disk_offering.id
+                                )
+        self.debug("Created volume in account: %s" % self.account.account.name)
+        self.debug("Attaching volume to instance: %s" %
+                                                self.virtual_machine.name)
+        try:
+            self.virtual_machine.attach_volume(self.apiclient, volume)
+        except Exception as e:
+            self.fail("Attach volume failed!")
+        self.debug("Fetching details of medium service offering")
+        medium_service_offs = ServiceOffering.list(
+                                                  self.apiclient,
+                                                  name="Medium Instance"
+                                                  )
+        if isinstance(medium_service_offs, list):
+            medium_service_off = medium_service_offs[0]
+        else:
+            self.debug("Service offering not found! Creating a new one..")
+            medium_service_off = ServiceOffering.create(
+                                    self.apiclient,
+                                    self.services["service_offering"]
+                                    )
+            self.cleanup.append(medium_service_off)
+
+        self.debug("Changing service offering for instance: %s" %
+                                                    self.virtual_machine.name)
+        try:
+            self.virtual_machine.change_service_offering(
+                                                     self.apiclient,
+                                                     medium_service_off.id
+                                                     )
+        except Exception as e:
+            self.fail("Change service offering failed: %s" % e)
+
+        self.debug("Starting the instance: %s" % self.virtual_machine.name)
+        self.virtual_machine.start(self.apiclient)
+        self.debug("Instance: %s started" % self.virtual_machine.name)
+
+        self.debug("Detaching the disk: %s" % volume.name)
+        self.virtual_machine.detach_volume(self.apiclient, volume)
+        self.debug("Datadisk %s detached!" % volume.name)
+
+        volumes = Volume.list(
+                              self.apiclient,
+                              virtualmachineid=self.virtual_machine.id,
+                              type='DATADISK',
+                  id=volume.id,
+                              listall=True
+                              )
+        self.assertEqual(
+                         volumes,
+                         None,
+                         "List Volumes should not list any volume for instance"
+                         )
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_06_deploy_startvm_attach_detach(self):
+        """Test Deploy Virtual Machine with startVM=false and
+            attach detach volumes
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=false. Attach volume to the instance
+        # 2. listVM command should return the deployed VM.State of this VM
+        #    should be "Stopped".
+        # 3. Attach volume should be successful
+        # 4. Detach volume from instance. Detach should be successful
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                    diskofferingid=self.disk_offering.id,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Stopped",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+        self.debug("Creating a volume in account: %s" %
+                                                    self.account.account.name)
+        volume = Volume.create(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                diskofferingid=self.disk_offering.id
+                                )
+        self.debug("Created volume in account: %s" % self.account.account.name)
+        self.debug("Attaching volume to instance: %s" %
+                                                self.virtual_machine.name)
+        try:
+            self.virtual_machine.attach_volume(self.apiclient, volume)
+        except Exception as e:
+            self.fail("Attach volume failed!")
+
+        self.debug("Detaching the disk: %s" % volume.name)
+        self.virtual_machine.detach_volume(self.apiclient, volume)
+        self.debug("Datadisk %s detached!" % volume.name)
+
+        volumes = Volume.list(
+                              self.apiclient,
+                              virtualmachineid=self.virtual_machine.id,
+                              type='DATADISK',
+                  id=volume.id,
+                              listall=True
+                              )
+        self.assertEqual(
+                         volumes,
+                         None,
+                         "List Volumes should not list any volume for instance"
+                         )
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_07_deploy_startvm_attach_iso(self):
+        """Test Deploy Virtual Machine with startVM=false and attach ISO
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=false. Attach volume to the instance
+        # 2. listVM command should return the deployed VM.State of this VM
+        #    should be "Stopped".
+        # 3. Attach ISO to the instance. Attach ISO should be successful
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                    diskofferingid=self.disk_offering.id,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Stopped",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+        self.debug("Registering a ISO in account: %s" %
+                                                    self.account.account.name)
+        iso = Iso.create(
+                         self.apiclient,
+                         self.services["iso"],
+                         account=self.account.account.name,
+                         domainid=self.account.account.domainid
+                         )
+
+        self.debug("Successfully created ISO with ID: %s" % iso.id)
+        try:
+            iso.download(self.apiclient)
+            self.cleanup.append(iso)
+        except Exception as e:
+            self.fail("Exception while downloading ISO %s: %s"\
+                      % (iso.id, e))
+
+        self.debug("Attach ISO with ID: %s to VM ID: %s" % (
+                                                    iso.id,
+                                                    self.virtual_machine.id
+                                                    ))
+        try:
+            self.virtual_machine.attach_iso(self.apiclient, iso)
+        except Exception as e:
+            self.fail("Attach ISO failed!")
+
+        vms = VirtualMachine.list(
+                              self.apiclient,
+                              id=self.virtual_machine.id,
+                              listall=True
+                              )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List vms should return a valid list"
+                         )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.isoid,
+                         iso.id,
+                         "The ISO status should be reflected in list Vm call"
+                         )
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_08_deploy_attach_volume(self):
+        """Test Deploy Virtual Machine with startVM=false and
+            attach volume already attached to different machine
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=false. Attach volume to the instance
+        # 2. listVM command should return the deployed VM.State of this VM
+        #    should be "Stopped".
+        # 3. Create an instance with datadisk attached to it. Detach DATADISK
+        # 4. Attach the volume to first virtual machine.
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine_1 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine_1.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Stopped",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine_2 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine_2.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.state,
+            "Running",
+            "VM should be in Stopped state after deployment with startvm=false"
+        )
+
+        self.debug(
+            "Fetching DATADISK details for instance: %s" %
+                                            self.virtual_machine_2.name)
+        volumes = Volume.list(
+                              self.apiclient,
+                              type='DATADISK',
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              listall=True
+                              )
+        self.assertEqual(
+                         isinstance(volumes, list),
+                         True,
+                         "List volumes should return a valid list"
+                         )
+        volume = volumes[0]
+
+        self.debug("Detaching the disk: %s" % volume.name)
+
+        try:
+            self.virtual_machine_2.detach_volume(self.apiclient, volume)
+            self.debug("Datadisk %s detached!" % volume.name)
+        except Exception as e:
+            self.fail("Detach volume failed!")
+
+        self.debug("Attaching volume to instance: %s" %
+                                                self.virtual_machine_1.name)
+        try:
+            self.virtual_machine_1.attach_volume(self.apiclient, volume)
+        except Exception as e:
+            self.fail("Attach volume failed!")
+
+        volumes = Volume.list(
+                              self.apiclient,
+                              virtualmachineid=self.virtual_machine_1.id,
+                              type='DATADISK',
+                              id=volume.id,
+                              listall=True
+                              )
+        self.assertNotEqual(
+                         volumes,
+                         None,
+                         "List Volumes should not list any volume for instance"
+                         )
+        return
+
+
+class TestDeployHaEnabledVM(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestDeployHaEnabledVM,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        # Create service, disk offerings  etc
+        cls.service_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offering"],
+                                    offerha=True
+                                    )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        # Cleanup
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["template"] = self.template.id
+        self.services["iso"]["zoneid"] = self.zone.id
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_01_deploy_ha_vm_startvm_false(self):
+        """Test Deploy HA enabled Virtual Machine with startvm=false
+        """
+
+        # Validate the following:
+        # 1. deployHA enabled  Vm  with the startvm parameter = false
+        # 2. listVM command should return the deployed VM. State of this VM
+        #    should be "Created".
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    startvm=False
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Stopped",
+                            "VM should be in Stopped state after deployment"
+                        )
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_02_deploy_ha_vm_from_iso(self):
+        """Test Deploy HA enabled Virtual Machine from ISO
+        """
+
+        # Validate the following:
+        # 1. deployHA enabled Vm using ISO with the startvm parameter=true
+        # 2. listVM command should return the deployed VM. State of this VM
+        #    should be "Running".
+
+        self.iso = Iso.create(
+                                self.apiclient,
+                                self.services["iso"],
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+        try:
+            # Dowanload the ISO
+            self.iso.download(self.apiclient)
+            self.cleanup.append(self.iso)
+        except Exception as e:
+            raise Exception("Exception while downloading ISO %s: %s"\
+                      % (self.iso.id, e))
+
+        self.debug("Registered ISO: %s" % self.iso.name)
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    templateid=self.iso.id,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    startvm=True
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Running",
+                            "VM should be in Running state after deployment"
+                        )
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_03_deploy_ha_vm_iso_startvm_false(self):
+        """Test Deploy HA enabled Virtual Machine from ISO with startvm=false
+        """
+
+        # Validate the following:
+        # 1. deployHA enabled Vm using ISO with the startvm parameter=false
+        # 2. listVM command should return the deployed VM. State of this VM
+        #    should be "Stopped".
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    startvm=False
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Stopped",
+                            "VM should be in Running state after deployment"
+                        )
+        return
+
+
+class TestRouterStateAfterDeploy(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestRouterStateAfterDeploy,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        # Create service offerings, disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offering"]
+                                    )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        # Cleanup
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["template"] = self.template.id
+        self.services["iso"]["zoneid"] = self.zone.id
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_01_deploy_vm_no_startvm(self):
+        """Test Deploy Virtual Machine with no startVM parameter
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  without specifying the startvm parameter
+        # 2. Should be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Running".
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine_1 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    startvm=False
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine_1.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine_1.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Stopped",
+                            "VM should be in stopped state after deployment"
+                        )
+        self.debug("Checking the router state after VM deployment")
+        routers = Router.list(
+                              self.apiclient,
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              listall=True
+                              )
+        self.assertEqual(
+                         routers,
+                         None,
+                         "List routers should return empty response"
+                         )
+        self.debug(
+            "Deploying another instance (startvm=true) in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine_2 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    startvm=True
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine_2.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine_2.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Running",
+                            "VM should be in Running state after deployment"
+                        )
+        self.debug("Checking the router state after VM deployment")
+        routers = Router.list(
+                              self.apiclient,
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              listall=True
+                              )
+        self.assertEqual(
+                         isinstance(routers, list),
+                         True,
+                         "List routers should not return empty response"
+                         )
+        for router in routers:
+            self.debug("Router state: %s" % router.state)
+            self.assertEqual(
+                router.state,
+                "Running",
+                "Router should be in running state when instance is running in the account"
+                )
+        self.debug("Destroying the running VM:%s" %
+                                        self.virtual_machine_2.name)
+        self.virtual_machine_2.delete(self.apiclient)
+        self.debug("Instance destroyed..waiting till expunge interval")
+
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='expunge.interval'
+                                    )
+        delay = list_configurations(
+                                    self.apiclient,
+                                    name='expunge.delay'
+                                    )
+        # Sleep to ensure that all resources are deleted
+        time.sleep((int(interval[0].value) + int(delay[0].value)) * 2)
+
+        self.debug("Checking the router state after VM deployment")
+        routers = Router.list(
+                              self.apiclient,
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              listall=True
+                              )
+        self.assertNotEqual(
+                         routers,
+                         None,
+                         "Router should get deleted after expunge delay+wait"
+                         )
+        return
+
+
+class TestDeployVMBasicZone(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestDeployVMBasicZone,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+
+        # Create service offerings, disk offerings etc
+        cls.service_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offering"]
+                                    )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        # Cleanup
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.services["iso"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    @attr(tags = ["eip", "basic", "sg"])
+    def test_01_deploy_vm_startvm_true(self):
+        """Test Deploy Virtual Machine with startVM=true parameter
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=true
+        # 2. Should be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Running".
+
+        self.debug("Checking the network type of the zone: %s" %
+                                                self.zone.networktype)
+        self.assertEqual(
+                         self.zone.networktype,
+                         'Basic',
+                         "Zone must be configured in basic networking mode"
+                         )
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=True,
+                                    diskofferingid=self.disk_offering.id,
+                                    mode=self.zone.networktype
+                                )
+
+        self.debug("Deployed instance ion account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Running",
+                            "VM should be in Running state after deployment"
+                        )
+        return
+
+    @attr(tags = ["eip", "basic", "sg"])
+    def test_02_deploy_vm_startvm_false(self):
+        """Test Deploy Virtual Machine with startVM=true parameter
+        """
+
+        # Validate the following:
+        # 1. deploy Vm  with the startvm=true
+        # 2. Should be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Running".
+
+        self.debug("Checking the network type of the zone: %s" %
+                                                self.zone.networktype)
+        self.assertEqual(
+                         self.zone.networktype,
+                         'Basic',
+                         "Zone must be configured in basic networking mode"
+                         )
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    startvm=False,
+                                    mode=self.zone.networktype
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Stopped",
+                            "VM should be in stopped state after deployment"
+                        )
+        self.debug("Starting the instance: %s" % self.virtual_machine.name)
+        self.virtual_machine.start(self.apiclient)
+        self.debug("Started the instance: %s" % self.virtual_machine.name)
+
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Running",
+                            "VM should be in running state after deployment"
+                        )
+        return
+
+
+class TestDeployVMFromTemplate(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestDeployVMFromTemplate,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create service, disk offerings  etc
+        cls.service_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offering"],
+                                    offerha=True
+                                    )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        # Cleanup
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        self.template = Template.register(
+                                        self.apiclient,
+                                        self.services["template"],
+                                        zoneid=self.zone.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        try:
+            self.template.download(self.apiclient)
+        except Exception as e:
+            raise Exception("Template download failed: %s" % e)
+
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_deploy_vm_password_enabled(self):
+        """Test Deploy Virtual Machine with startVM=false & enabledpassword in
+        template
+        """
+
+        # Validate the following:
+        # 1. Create the password enabled template
+        # 2. Deploy Vm with this template and passing startvm=false
+        # 3. Start VM. Deploy VM should be successful and it should be in Up
+        #    and running state
+
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    templateid=self.template.id,
+                                    startvm=False,
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.state,
+                            "Stopped",
+                            "VM should be in stopped state after deployment"
+                        )
+        self.debug("Starting the instance: %s" % self.virtual_machine.name)
+        self.virtual_machine.start(self.apiclient)
+        self.debug("Started the instance: %s" % self.virtual_machine.name)
+
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM should be in running state after deployment"
+                        )
+        return
+
+
+class TestVMAccountLimit(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVMAccountLimit,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_vm_per_account(self):
+        """Test VM limit per account
+        """
+
+        # Validate the following
+        # 1. Set the resource limit for VM per account.
+        # 2. Deploy VMs more than limit in that account.
+        # 3. AIP should error out
+
+        self.debug(
+            "Updating instance resource limit for account: %s" %
+                                                self.account.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              0,    # Instance
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              max=1
+                              )
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account.account.name)
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["virtual_machine"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id,
+                                startvm=False
+                                )
+
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine.state,
+                            'Stopped',
+                            "Check VM state is Running or not"
+                        )
+
+        # Exception should be raised for second instance (account_1)
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                                self.apiclient,
+                                self.services["virtual_machine"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id,
+                                startvm=False
+                                )
+        return
+
+
+class TestUploadAttachVolume(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUploadAttachVolume,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_upload_attach_volume(self):
+        """Test Upload volume and attach to VM in stopped state
+        """
+
+        # Validate the following
+        # 1. Upload the volume using uploadVolume API call
+        # 2. Deploy VM with startvm=false.
+        # 3. Attach the volume to the deployed VM in step 2
+
+        self.debug(
+                "Uploading the volume: %s" %
+                                            self.services["volume"]["diskname"])
+        try:
+            volume = Volume.upload(
+                               self.apiclient,
+                               self.services["volume"],
+                               zoneid=self.zone.id,
+                               account=self.account.account.name,
+                               domainid=self.account.account.domainid
+                               )
+            self.debug("Uploading the volume: %s" % volume.name)
+            volume.wait_for_upload(self.apiclient)
+            self.debug("Volume: %s uploaded successfully")
+        except Exception as e:
+            self.fail("Failed to upload the volume: %s" % e)
+
+        self.debug(
+            "Deploying VM instance in account: %s" %
+                                        self.account.account.name)
+
+        virtual_machine = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["virtual_machine"],
+                                templateid=self.template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id,
+                                startvm=False
+                                )
+        # Verify VM state
+        self.assertEqual(
+                            virtual_machine.state,
+                            'Stopped',
+                            "Check VM state is Running or not"
+                        )
+        with self.assertRaises(Exception):
+            virtual_machine.attach_volume(self.apiclient, volume)
+            self.debug("Failed to attach the volume as expected")
+        return
+
+
+class TestDeployOnSpecificHost(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDeployOnSpecificHost,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) * 2)
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "simulator",
+                "api", "basic", "eip", "sg"])
+    def test_deployVmOnGivenHost(self):
+        """Test deploy VM on specific host
+        """
+
+        # Steps for validation
+        # 1. as admin list available hosts that are Up
+        # 2. deployVM with hostid=above host
+        # 3. listVirtualMachines
+        # 4. destroy VM
+        # Validate the following
+        # 1. listHosts returns at least one host in Up state
+        # 2. VM should be in Running
+        # 3. VM should be on the host that it was deployed on
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          type='Routing',
+                          state='Up',
+                          listall=True
+                          )
+
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "CS should have atleast one host Up and Running"
+                         )
+
+        host = hosts[0]
+        self.debug("Deploting VM on host: %s" % host.name)
+
+        try:
+            vm = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    hostid=host.id
+                                    )
+            self.debug("Deploy VM succeeded")
+        except Exception as e:
+            self.fail("Deploy VM failed with exception: %s" % e)
+
+        self.debug("Cheking the state of deployed VM")
+        vms = VirtualMachine.list(
+                                self.apiclient,
+                                id=vm.id,
+                                listall=True,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List Vm should return a valid response"
+                         )
+
+        vm_response = vms[0]
+        self.assertEqual(
+                         vm_response.state,
+                         "Running",
+                         "VM should be in running state after deployment"
+                         )
+        self.assertEqual(
+                         vm_response.hostid,
+                         host.id,
+                         "Host id where VM is deployed should match"
+                         )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_templates.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_templates.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_templates.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_templates.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,622 @@
+# 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.
+""" P1 tests for Templates
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import urllib
+from random import random
+#Import System modules
+import time
+
+
+class Services:
+    """Test Templates Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "virtual_machine": {
+                                    "displayname": "testVM",
+                                    "hypervisor": 'XenServer',
+                                    "protocol": 'TCP',
+                                    "ssh_port": 22,
+                                    "username": "root",
+                                    "password": "password",
+                                    "privateport": 22,
+                                    "publicport": 22,
+                         },
+                        "volume": {
+                                "diskname": "Test Volume",
+                                 },
+                        "templates": {
+                            # Configs for different Template formats
+                            # For Eg. raw image, zip etc
+                            0: {
+                                "displaytext": "Public Template",
+                                "name": "Public template",
+                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                                "hypervisor": 'XenServer',
+                                "format": 'VHD',
+                                "isfeatured": True,
+                                "ispublic": True,
+                                "isextractable": True,
+                                },
+                        },
+                        "template": {
+                                "displaytext": "Cent OS Template",
+                                "name": "Cent OS Template",
+                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "templatefilter": 'self',
+                        },
+                        "templatefilter": 'self',
+                        "destzoneid": 2,    # For Copy template (Destination zone)
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced',     # Networking mode: Advanced, basic
+                     }
+
+
+@unittest.skip("Open questions")
+class TestCreateTemplate(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_create_template(self):
+        """Test create public & private template
+        """
+        # Validate the following:
+        # 1. Upload a templates in raw img format. Create a Vm instances from
+        #    raw img template.
+        # 2. Upload a templates in  zip file format. Create a Vm instances from
+        #    zip template.
+        # 3. Upload a templates in tar format.Create a Vm instances from tar
+        #    template.
+        # 4. Upload a templates in tar gzip format.Create a Vm instances from
+        #    tar gzip template.
+        # 5. Upload a templates in  tar bzip format. Create a Vm instances from
+        #    tar bzip template.
+        # 6. Verify VMs & Templates is up and in ready state
+
+        for k, v in self.services["templates"].items():
+
+            # Register new template
+            template = Template.register(
+                                        self.apiclient,
+                                        v,
+                                        zoneid=self.zone.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+            self.debug(
+                "Registered a template of format: %s with ID: %s" % (
+                                                                v["format"],
+                                                                template.id
+                                                                ))
+            # Wait for template to download
+            template.download(self.apiclient)
+            self.cleanup.append(template)
+
+            # Wait for template status to be changed across
+            time.sleep(self.services["sleep"])
+            timeout = self.services["timeout"]
+            while True:
+                list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["templatefilter"],
+                                    id=template.id,
+                                    zoneid=self.zone.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+                if isinstance(list_template_response, list):
+                    break
+                elif timeout == 0:
+                    raise Exception("List template failed!")
+
+                time.sleep(5)
+                timeout = timeout - 1
+            #Verify template response to check whether template added successfully
+            self.assertEqual(
+                        isinstance(list_template_response, list),
+                        True,
+                        "Check for list template response return valid data"
+                        )
+
+            self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+
+            template_response = list_template_response[0]
+            self.assertEqual(
+                            template_response.isready,
+                            True,
+                            "Check display text of newly created template"
+                        )
+
+            # Deploy new virtual machine using template
+            virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    mode=self.services["mode"]
+                                    )
+            self.debug("creating an instance with template ID: %s" % template.id)
+            vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=virtual_machine.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+            self.assertEqual(
+                             isinstance(vm_response, list),
+                             True,
+                             "Check for list VMs response after VM deployment"
+                             )
+            #Verify VM response to check whether VM deployment was successful
+            self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+            vm = vm_response[0]
+            self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM created from Template"
+                        )
+        return
+
+
+class TestTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.services = Services().services
+        cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, templates etc
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                        )
+
+        # create virtual machine
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    )
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        timeout = cls.services["timeout"]
+        #Wait before server has be successfully stopped
+        time.sleep(cls.services["sleep"])
+
+        while True:
+            list_volume = list_volumes(
+                                   cls.api_client,
+                                   virtualmachineid=cls.virtual_machine.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+            if isinstance(list_volume, list):
+                break
+            elif timeout == 0:
+                raise Exception("List volumes failed.")
+
+            time.sleep(5)
+            timeout = timeout - 1
+
+        cls.volume = list_volume[0]
+
+        #Create template from volume
+        cls.template = Template.create(
+                                         cls.api_client,
+                                         cls.services["template"],
+                                         cls.volume.id
+                                         )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+            #Cleanup created resources such as templates and VMs
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_create_template_volume(self):
+        """Test Create template from volume
+        """
+
+        # Validate the following:
+        # 1. Deploy new VM using the template created from Volume
+        # 2. VM should be in Up and Running state
+
+        virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=self.template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    )
+
+        self.debug("creating an instance with template ID: %s" % self.template.id)
+        self.cleanup.append(virtual_machine)
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=virtual_machine.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        #Verify VM response to check whether VM deployment was successful
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM created from Template"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "multizone"])
+    def test_02_copy_template(self):
+        """Test for copy template from one zone to another"""
+
+        # Validate the following
+        # 1. copy template should be successful and
+        #    secondary storage should contain new copied template.
+
+        self.debug(
+            "Copying template from zone: %s to %s" % (
+                                                self.template.id,
+                                                self.services["destzoneid"]
+                                                ))
+        cmd = copyTemplate.copyTemplateCmd()
+        cmd.id = self.template.id
+        cmd.destzoneid = self.services["destzoneid"]
+        cmd.sourcezoneid = self.zone.id
+        self.apiclient.copyTemplate(cmd)
+
+        # Verify template is copied to another zone using ListTemplates
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["templatefilter"],
+                                    id=self.template.id,
+                                    zoneid=self.services["destzoneid"]
+                                    )
+        self.assertEqual(
+                        isinstance(list_template_response, list),
+                        True,
+                        "Check for list template response return valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template extracted in List Templates"
+                        )
+
+        template_response = list_template_response[0]
+        self.assertEqual(
+                            template_response.id,
+                            self.template.id,
+                            "Check ID of the downloaded template"
+                        )
+        self.assertEqual(
+                            template_response.zoneid,
+                            self.services["destzoneid"],
+                            "Check zone ID of the copied template"
+                        )
+
+        # Cleanup- Delete the copied template
+        cmd = deleteTemplate.deleteTemplateCmd()
+        cmd.id = self.template.id
+        cmd.zoneid = self.services["destzoneid"]
+        self.apiclient.deleteTemplate(cmd)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_03_delete_template(self):
+        """Test Delete template
+        """
+
+        # Validate the following:
+        # 1. Create a template and verify it is shown in list templates response
+        # 2. Delete the created template and again verify list template response
+
+        # Verify template response for updated attributes
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["template"]["templatefilter"],
+                                    id=self.template.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.assertEqual(
+                        isinstance(list_template_response, list),
+                        True,
+                        "Check for list template response return valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+        template_response = list_template_response[0]
+
+        self.assertEqual(
+                            template_response.id,
+                            self.template.id,
+                            "Check display text of updated template"
+                        )
+
+        self.debug("Deleting template: %s" % self.template)
+        # Delete the template
+        self.template.delete(self.apiclient)
+        self.debug("Delete template: %s successful" % self.template)
+
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["template"]["templatefilter"],
+                                    id=self.template.id,
+                                    zoneid=self.zone.id
+                                    )
+        self.assertEqual(
+                            list_template_response,
+                            None,
+                            "Check template available in List Templates"
+                        )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns"])
+    def test_04_template_from_snapshot(self):
+        """Create Template from snapshot
+        """
+
+        # Validate the following
+        # 2. Snapshot the Root disk
+        # 3. Create Template from snapshot
+        # 4. Deploy Virtual machine using this template
+        # 5. VM should be in running state
+
+        volumes = list_volumes(
+                        self.apiclient,
+                        virtualmachineid=self.virtual_machine.id,
+                        type='ROOT',
+                        listall=True
+                        )
+        volume = volumes[0]
+
+        self.debug("Creating a snapshot from volume: %s" % volume.id)
+        #Create a snapshot of volume
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volume.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.debug("Creating a template from snapshot: %s" % snapshot.id)
+        # Generate template from the snapshot
+        template = Template.create_from_snapshot(
+                                    self.apiclient,
+                                    snapshot,
+                                    self.services["template"]
+                                    )
+        self.cleanup.append(template)
+        # Verify created template
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["template"]["templatefilter"],
+                                id=template.id
+                                )
+        self.assertNotEqual(
+                            templates,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                            templates[0].id,
+                            template.id,
+                            "Check new template id in list resources call"
+                        )
+        self.debug("Deploying a VM from template: %s" % template.id)
+        # Deploy new virtual machine using template
+        virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    )
+        self.cleanup.append(virtual_machine)
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=virtual_machine.id,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                        isinstance(vm_response, list),
+                        True,
+                        "Check for list VM response return valid list"
+                        )
+
+        #Verify VM response to check whether VM deployment was successful
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM created from Template"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_upload_volumes.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_upload_volumes.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_upload_volumes.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_upload_volumes.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,899 @@
+# -*- encoding: utf-8 -*-
+# 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
+
+""" P1 tests for Upload Volumes
+"""
+
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+#Import System modules
+import os
+import urllib
+import time
+import tempfile
+
+
+class Services:
+    """Test Volume Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                "diskname": "UploadedVolume",
+                                "url": "http://192.168.100.21/images/upload_1_gb.vhd",
+                                "format": 'VHD',
+                        },
+                        "volumes": {
+                            # If you are testing for other hypervisor than XenServer,
+                            # Please change this dict according to following
+                            # "HYPERVISOR" : {
+                            #    0: {
+                            #        """Configs for volume type 1
+                            #            supported by HYPERVISOR"""
+                            # Xenserver specific settings for volumes
+                            "xenserver": {
+                                0: {
+                                     "diskname": "Volume_VHD_Format",
+                                     "url": "http://192.168.100.21/images/upload_1_gb.vhd",
+                                     "format": 'VHD',
+                                     },
+                                },
+                        },
+                        "virtual_machine": {
+                                    "displayname": "testVM",
+                                    "hypervisor": 'XenServer',
+                                    "protocol": 'TCP',
+                                    "ssh_port": 22,
+                                    "username": "root",
+                                    "password": "password",
+                                    "privateport": 22,
+                                    "publicport": 22,
+                         },
+                        "sleep": 50,
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "mode": 'basic',
+                    }
+
+
+class TestUploadDataDisk(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUploadDataDisk,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Create account, service offerings etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.services["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created volumes
+            self.debug("Cleanup the resources..")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup succeeded")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_01_upload_data_disk(self):
+        """Test Upload a data disk
+        """
+
+
+        # Validate the following
+        # 1. call upload volume API with following parameters HTTP URL of the
+        #    data disk, Zone ID, Name, Description, Hyper visor
+        # 2. Upload volume is successful
+
+        self.debug("Uploading the volume to account: %s" %
+                                                self.account.account.name)
+        # Upload the volume
+        volume = Volume.upload(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                url=self.services["volume"]["url"]
+                                )
+        self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+        self.debug("Waiting for upload of volume: %s" % volume.name)
+        try:
+            volume.wait_for_upload(self.apiclient)
+            self.debug("Volume: %s uploaded to CS successfully" % volume.name)
+        except Exception as e:
+            self.fail("Upload volume failed: %s" % e)
+
+        # Check List Volume response for newly created volume
+        list_volume_response = Volume.list(
+                                                self.apiclient,
+                                                id=volume.id,
+                                                zoneid=self.zone.id,
+                                                listall=True
+                                                )
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                            )
+        volume_response = list_volume_response[0]
+        self.assertEqual(
+                    volume_response.state,
+                    "Uploaded",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_02_upload_volume_limit(self):
+        """Test upload volume limits
+        """
+
+
+        # Validate the following
+        # 1. Update the volume resource limit for account to 1
+        # 2. Upload volume in that account
+        # 3. Upload volume should fail with appropriate error
+
+        self.debug(
+            "Updating volume resource limit for account: %s" %
+                                                self.account.account.name)
+        # Set usage_vm=1 for Account 1
+        update_resource_limit(
+                              self.apiclient,
+                              2,    # Volume
+                              account=self.account.account.name,
+                              domainid=self.account.account.domainid,
+                              max=1
+                              )
+
+        self.debug("Uploading the volume to account: %s" %
+                                                self.account.account.name)
+        with self.assertRaises(Exception):
+            # Upload the volume
+            volume = Volume.upload(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                url=self.services["volume"]["url"]
+                                )
+            self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+        self.debug("Upload volume failed! Test succeeded..")
+        return
+
+
+class TestUploadDiskDiffFormat(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUploadDiskDiffFormat,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Create account, service offerings etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created volumes
+            self.debug("Cleanup the resources..")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup succeeded")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_upload_disk_diff_format(self):
+        """Test Upload a data disk in different format
+        """
+
+
+        # Validate the following
+        # 1. call upload volume API with following parameters HTTP URL of the
+        #    data disk, Zone ID, Name, Description, Hyper visor
+        #    disk types are: zip file format,tar format,tar gzip format
+        #    tar bzip format
+        # 2. Upload volume is successful
+
+        for hypervisor, settings in self.services["volumes"].items():
+            for k, v in settings.items():
+                self.debug(
+                    "Uploading the volume (type: %s) for Hypervisor: %s to account: %s" % (
+                                                v["format"],
+                                                hypervisor,
+                                                self.account.account.name
+                                                ))
+                # Upload the volume
+                volume = Volume.upload(
+                                self.apiclient,
+                                v,
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                )
+                self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+                self.debug("Waiting for upload of volume: %s" % volume.name)
+                try:
+                    volume.wait_for_upload(self.apiclient)
+                    self.debug("Volume: %s uploaded to CS successfully" %
+                                                                volume.name)
+                except Exception as e:
+                    self.fail("Upload volume failed: %s" % e)
+
+                # Check List Volume response for newly created volume
+                list_volume_response = list_volumes(
+                                                self.apiclient,
+                                                id=volume.id
+                                                )
+                self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                            )
+                volume_response = list_volume_response[0]
+                self.assertEqual(
+                    volume_response.state,
+                    "Uploaded",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        return
+
+
+class TestUploadAttachDisk(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUploadAttachDisk,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Create account, service offerings etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created volumes
+            self.debug("Cleanup the resources..")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup succeeded")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_upload_attach_data_disk(self):
+        """Test Upload and attach a data disk
+        """
+
+
+        # Validate the following
+        # 1. call upload volume API with following parameters HTTP URL of the
+        #    data disk, Zone ID, Name, Description, Hyper visor
+        # 2. Upload volume is successful
+
+        self.debug("Uploading the volume to account: %s" %
+                                                self.account.account.name)
+        # Upload the volume
+        volume = Volume.upload(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                url=self.services["volume"]["url"]
+                                )
+        self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+        self.debug("Waiting for upload of volume: %s" % volume.name)
+        try:
+            volume.wait_for_upload(self.apiclient)
+            self.debug("Volume: %s uploaded to CS successfully" % volume.name)
+        except Exception as e:
+            self.fail("Upload volume failed: %s" % e)
+
+        # Check List Volume response for newly created volume
+        list_volume_response = Volume.list(
+                                                self.apiclient,
+                                                id=volume.id,
+                                                zoneid=self.zone.id,
+                                                listall=True
+                                                )
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                            )
+        volume_response = list_volume_response[0]
+        self.assertEqual(
+                    volume_response.state,
+                    "Uploaded",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        self.debug(
+            "Attaching the disk: %s to VM: %s" % (
+                                                  self.virtual_machine.name,
+                                                  volume.name
+                                                  ))
+        self.virtual_machine.attach_volume(self.apiclient, volume)
+        self.debug(
+                "Volume attached to instance: %s" %
+                                            self.virtual_machine.name)
+        # Check List Volume response for newly created volume
+        list_volume_response = Volume.list(
+                                        self.apiclient,
+                                        id=volume.id,
+                                        virtualmachineid=self.virtual_machine.id,
+                                        listall=True
+                                    )
+        self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+
+        volume_response = list_volume_response[0]
+        self.assertEqual(
+                    volume_response.state,
+                    "Ready",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        return
+
+
+class TestUploadAttachDiskDiffFormat(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUploadAttachDiskDiffFormat,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Create account, service offerings etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created volumes
+            self.debug("Cleanup the resources..")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup succeeded")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg"])
+    def test_upload_disk_diff_format(self):
+        """Test Upload a data disk in different format
+        """
+
+
+        # Validate the following
+        # 1. call upload volume API with following parameters HTTP URL of the
+        #    data disk, Zone ID, Name, Description, Hyper visor
+        #    disk types are: zip file format,tar format,tar gzip format
+        #    tar bzip format
+        # 2. Upload volume is successful
+
+        for hypervisor, settings in self.services["volumes"].items():
+            for k, v in settings.items():
+                self.debug(
+                    "Uploading the volume (type: %s) for Hypervisor: %s to account: %s" % (
+                                                v["format"],
+                                                hypervisor,
+                                                self.account.account.name
+                                                ))
+                # Upload the volume
+                volume = Volume.upload(
+                                self.apiclient,
+                                v,
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                )
+                self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+                self.debug("Waiting for upload of volume: %s" % volume.name)
+                try:
+                    volume.wait_for_upload(self.apiclient)
+                    self.debug("Volume: %s uploaded to CS successfully" %
+                                                                volume.name)
+                except Exception as e:
+                    self.fail("Upload volume failed: %s" % e)
+
+                # Check List Volume response for newly created volume
+                list_volume_response = list_volumes(
+                                                self.apiclient,
+                                                id=volume.id
+                                                )
+                self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                            )
+                volume_response = list_volume_response[0]
+                self.assertEqual(
+                    volume_response.state,
+                    "Uploaded",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+
+                self.debug(
+                    "Attaching the disk: %s to VM: %s" % (
+                                                  self.virtual_machine.name,
+                                                  volume.name
+                                                  ))
+                self.virtual_machine.attach_volume(self.apiclient, volume)
+                self.debug(
+                           "Volume attached to instance: %s" %
+                                            self.virtual_machine.name)
+                # Check List Volume response for newly created volume
+                list_volume_response = Volume.list(
+                                        self.apiclient,
+                                        id=volume.id,
+                                        virtualmachineid=self.virtual_machine.id,
+                                        listall=True
+                                    )
+                self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+
+                volume_response = list_volume_response[0]
+                self.assertEqual(
+                        volume_response.state,
+                        "Ready",
+                        "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        return
+
+
+class TestUploadDiskMultiStorage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestUploadDiskMultiStorage,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.pod = get_pod(cls.api_client, zoneid=cls.zone.id)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Create account, service offerings etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.services["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created volumes
+            self.debug("Cleanup the resources..")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup succeeded")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg", "multistorage"])
+    def test_01_upload_volume_multi_sec_storage(self):
+        """Test Upload a data disk when multiple sec storages are present
+        """
+
+
+        # Validate the following
+        # 1. Assume multiple secondary storages are present in a zone
+        # 2. call upload volume API with following parameters HTTP URL of the
+        #    data disk, Zone ID, Name, Description, Hyper visor
+        # 2. Upload volume is successful
+
+        sec_storages = Host.list(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                                 )
+        self.assertEqual(
+                         isinstance(sec_storages, list),
+                         True,
+                         "List Secondary storage should return a valid list"
+                         )
+        self.assertGreaterEqual(
+                    len(sec_storages),
+                    2,
+                    "Test requires atleast 2 secondary storages added to zone"
+                    )
+        self.debug("Uploading the volume to account: %s" %
+                                                self.account.account.name)
+        # Upload the volume
+        volume = Volume.upload(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                url=self.services["volume"]["url"]
+                                )
+        self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+        self.debug("Waiting for upload of volume: %s" % volume.name)
+        try:
+            volume.wait_for_upload(self.apiclient)
+            self.debug("Volume: %s uploaded to CS successfully" % volume.name)
+        except Exception as e:
+            self.fail("Upload volume failed: %s" % e)
+
+        # Check List Volume response for newly created volume
+        list_volume_response = Volume.list(
+                                                self.apiclient,
+                                                id=volume.id,
+                                                zoneid=self.zone.id,
+                                                listall=True
+                                                )
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                            )
+        volume_response = list_volume_response[0]
+        self.assertEqual(
+                    volume_response.state,
+                    "Uploaded",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "advancedns", "sg", "multistorage"])
+    def test_02_upload_volume_multi_pri_storage(self):
+        """Test Upload a data disk when multiple primary storages are present
+        """
+
+
+        # Validate the following
+        # 1. Assume multiple primary storages are present in a pod
+        # 2. call upload volume API with following parameters HTTP URL of the
+        #    data disk, Zone ID, Name, Description, Hyper visor
+        # 2. Upload volume is successful
+
+        storage_pools = StoragePool.list(
+                                 self.apiclient,
+                                 zoneid=self.zone.id,
+                                 podid=self.pod.id
+                                 )
+        self.assertEqual(
+                         isinstance(storage_pools, list),
+                         True,
+                         "List Primary storage should return a valid list"
+                         )
+        self.assertGreaterEqual(
+                    len(storage_pools),
+                    2,
+                    "Test requires atleast 2 primary storages added to pod"
+                    )
+        self.debug("Uploading the volume to account: %s" %
+                                                self.account.account.name)
+        # Upload the volume
+        volume = Volume.upload(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                url=self.services["volume"]["url"]
+                                )
+        self.debug("Registered volume: %s for account: %s" % (
+                                                volume.name,
+                                                self.account.account.name
+                                                ))
+        self.debug("Waiting for upload of volume: %s" % volume.name)
+        try:
+            volume.wait_for_upload(self.apiclient)
+            self.debug("Volume: %s uploaded to CS successfully" % volume.name)
+        except Exception as e:
+            self.fail("Upload volume failed: %s" % e)
+
+        # Check List Volume response for newly created volume
+        list_volume_response = Volume.list(
+                                                self.apiclient,
+                                                id=volume.id,
+                                                zoneid=self.zone.id,
+                                                listall=True
+                                                )
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                            )
+        volume_response = list_volume_response[0]
+        self.assertEqual(
+                    volume_response.state,
+                    "Uploaded",
+                    "Volume state should be 'Uploaded' after importing to CS"
+                    )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_usage.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_usage.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_usage.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_usage.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1580 @@
+# 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.
+""" P1 tests for Snapshots
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test Snapshots Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                   "diskname": "TestDiskServ",
+                                   },
+                        "server": {
+                                    "displayname": "TestVM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                        "templates": {
+                                    "displaytext": 'Template',
+                                    "name": 'Template',
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                                    "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2"
+                                },
+                        "iso": {
+                                  "displaytext": "Test ISO",
+                                  "name": "Test ISO",
+                                  "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                                  # Source URL where ISO is located
+                                  "isextractable": True,
+                                  "isfeatured": True,
+                                  "ispublic": True,
+                                  "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                },
+                        "lbrule": {
+                                   "name": "SSH",
+                                   "alg": "roundrobin",
+                                   # Algorithm used for load balancing
+                                   "privateport": 22,
+                                   "publicport": 2222,
+                                },
+                        "natrule": {
+                                   "privateport": 22,
+                                   "publicport": 22,
+                                   "protocol": "TCP"
+                                },
+                        "vpn_user": {
+                                   "username": "test",
+                                   "password": "test",
+                                },
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        # Cent OS 5.3 (64 bit)
+                        "sleep": 60,
+                        "timeout": 10,
+                        "mode": 'advanced'
+                    }
+
+
+class TestVmUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestVmUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_vm_usage(self):
+        """Test Create/Destroy VM and verify usage calculation
+        """
+        # Validate the following
+        # 1. Create a VM. Verify usage_events table contains VM .create,
+        #    VM.start , Network.offering.assign , Volume.create events
+        # 2. Stop the VM. Verify usage_events table contains
+        #    network.offerings.remove ,VM .stop Events for the created account.
+        # 3. Destroy the VM after some time. Verify usage_events table contains
+        #    VM.Destroy and volume .delete Event for the created account
+        # 4. Delete the account
+
+        self.debug("Stopping the VM: %s" % self.virtual_machine.id)
+        # Stop the VM
+        self.virtual_machine.stop(self.apiclient)
+
+        time.sleep(self.services["sleep"])
+        # Destroy the VM
+        self.debug("Destroying the VM: %s" % self.virtual_machine.id)
+        self.virtual_machine.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+        # Check if VM.CREATE, VM.DESTROY events present in usage_event table
+        self.assertEqual(
+                            qresult.count('VM.START'),
+                            1,
+                            "Check VM.START event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NETWORK.OFFERING.ASSIGN'),
+                            1,
+                            "Check NETWORK.OFFERING.ASSIGN in events table"
+                        )
+        self.assertEqual(
+                            qresult.count('VM.CREATE'),
+                            1,
+                            "Check VM.CREATE in list events"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VOLUME.CREATE'),
+                            1,
+                            "Check VOLUME.CREATE in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VM.STOP'),
+                            1,
+                            "Check VM.STOP in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NETWORK.OFFERING.REMOVE'),
+                            1,
+                            "Check NETWORK.OFFERING.REMOVE in list events"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VM.DESTROY'),
+                            1,
+                            "Check VM.DESTROY in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VOLUME.DELETE'),
+                            1,
+                            "Check VOLUME.DELETE in events table"
+                        )
+        return
+
+
+class TestPublicIPUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestPublicIPUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, Assign Public IP etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+
+        cls.public_ip = PublicIPAddress.create(
+                                           cls.api_client,
+                                           cls.virtual_machine.account,
+                                           cls.virtual_machine.zoneid,
+                                           cls.virtual_machine.domainid,
+                                           cls.services["server"]
+                                           )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "simulator"])
+    def test_01_public_ip_usage(self):
+        """Test Assign new IP and verify usage calculation
+        """
+        # Validate the following
+        # 1. Aquire a IP for the network of this account. Verify usage_event
+        #    table has  Acquire IP event for  the IP for this account
+        # 2. Release one of the IP of this account. Verify usage_event table
+        #    has IP.Release event for released IP for this account
+        # 3. Delete the newly created account
+
+        self.debug("Deleting public IP: %s" %
+                                self.public_ip.ipaddress.ipaddress)
+
+        # Release one of the IP
+        self.public_ip.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        # Check if NET.IPASSIGN, NET.IPRELEASE events present in usage_event
+        # table
+        self.assertEqual(
+                            qresult.count('NET.IPASSIGN') > 0,
+                            True,
+                            "Check NET.IPASSIGN event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NET.IPRELEASE') > 0,
+                            True,
+                            "Check NET.IPRELEASE in events table"
+                        )
+        return
+
+
+class TestVolumeUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestVolumeUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["server"]["diskoffering"] = cls.disk_offering.id
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_volume_usage(self):
+        """Test Create/delete a volume and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Volume.create event for both root and data disk is there for the
+        #    created account in cloud.usage_event table
+        # 2. Stop the VM
+        # 3. Detach the data disk from this VM
+        # 4. Destroy the Data disk. Volume.delete event is generated for data
+        #    disk of the destroyed VM
+
+        # Stop VM
+        self.debug("Stopping VM with ID: %s" % self.virtual_machine.id)
+        self.virtual_machine.stop(self.apiclient)
+
+        volume_response = list_volumes(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                         isinstance(volume_response, list),
+                         True,
+                         "Check for valid list volumes response"
+                         )
+        data_volume = volume_response[0]
+
+        # Detach data Disk
+        self.debug("Detaching volume ID: %s VM with ID: %s" % (
+                                                 data_volume.id,
+                                                 self.virtual_machine.id
+                                                 ))
+        self.virtual_machine.detach_volume(self.apiclient, data_volume)
+
+        # Delete Data disk
+        self.debug("Delete volume ID: %s" % data_volume.id)
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = data_volume.id
+        self.apiclient.deleteVolume(cmd)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+        # Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('VOLUME.CREATE'),
+                            2,
+                            "Check VOLUME.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VOLUME.DELETE'),
+                            1,
+                            "Check VOLUME.DELETE in events table"
+                        )
+        return
+
+
+class TestTemplateUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestTemplateUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["server"]["zoneid"] = cls.zone.id
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        #create virtual machine
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                    )
+
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        #Wait before server has be successfully stopped
+        time.sleep(30)
+        list_volume = list_volumes(
+                                   cls.api_client,
+                                   virtualmachineid=cls.virtual_machine.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+        if isinstance(list_volume, list):
+            cls.volume = list_volume[0]
+        else:
+            raise Exception("List Volumes failed!")
+        cls._cleanup = [
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, templates
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_01_template_usage(self):
+        """Test Upload/ delete a template and verify correct usage is generated
+            for the template uploaded
+        """
+        # Validate the following
+        # 1. Create a account
+        # 2. Upload a template from this account. template.create event is
+        #    recorded in cloud.usage_event table for this account
+        # 3. Delete the template. template.delete event is recorded in
+        #    cloud.usage_event tables for this account
+        # 4. Destroy the account
+
+        #Create template from Virtual machine and Volume ID
+        self.template = Template.create(
+                                self.apiclient,
+                                self.services["templates"],
+                                self.volume.id
+                                )
+        self.debug("Created template with ID: %s" % self.template.id)
+        # Delete template
+        self.template.delete(self.apiclient)
+        self.debug("Deleted template with ID: %s" % self.template.id)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('TEMPLATE.CREATE'),
+                            1,
+                            "Check TEMPLATE.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('TEMPLATE.DELETE'),
+                            1,
+                            "Check TEMPLATE.DELETE in events table"
+                        )
+        return
+
+
+class TestISOUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestISOUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["iso"]["zoneid"] = cls.zone.id
+        # Create Account, ISO image etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls.iso = Iso.create(
+                                cls.api_client,
+                                cls.services["iso"],
+                                account=cls.account.account.name,
+                                domainid=cls.account.account.domainid
+                            )
+        try:
+            # Wait till ISO gets downloaded
+            cls.iso.download(cls.api_client)
+        except Exception as e:
+            raise Exception("%s: Failed to download ISO: %s" % (
+                                                        e,
+                                                        cls.iso.id
+                                                        ))
+        cls._cleanup = [
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created ISO images
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
+    def test_01_ISO_usage(self):
+        """Test Create/Delete a ISO and verify its usage is generated correctly
+        """
+        # Validate the following
+        # 1. Create a account
+        # 2. Upload a ISO from this account. ISO.create event is recorded in
+        #    cloud.usage_event table for this account
+        # 3. Delete the ISO. ISO.delete event is recorded in cloud.usage_event
+        #    tables for this account
+        # 4. Destroy the account
+
+        # Delete the ISO
+        self.debug("Deleting ISO with ID: %s" % self.iso.id)
+        self.iso.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for ISO.CREATE, ISO.DELETE events in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('ISO.CREATE'),
+                            1,
+                            "Check ISO.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('ISO.DELETE'),
+                            1,
+                            "Check ISO.DELETE in events table"
+                        )
+        return
+
+
+class TestLBRuleUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestLBRuleUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, LB Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls.public_ip_1 = PublicIPAddress.create(
+                                           cls.api_client,
+                                           cls.virtual_machine.account,
+                                           cls.virtual_machine.zoneid,
+                                           cls.virtual_machine.domainid,
+                                           cls.services["server"]
+                                           )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, LB rules
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "eip", "advancedns", "simulator"])
+    def test_01_lb_usage(self):
+        """Test Create/Delete a LB rule and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Acquire a IP for this account. lb.rule.create event is registered
+        #    for this account in cloud.usage_event table
+        # 2. Create a LB rule on the IP associated with this account
+        # 3. Delete the created LB rule from the account. lb.rule.delete event
+        #    is registered for this account in cloud.usage_event table
+        # 4. Delete this account.
+
+        self.debug(
+            "Creating load balancer rule for public IP: %s" %
+                                    self.public_ip_1.ipaddress.id)
+        #Create Load Balancer rule and assign VMs to rule
+        lb_rule = LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          self.public_ip_1.ipaddress.id,
+                                          accountid=self.account.account.name
+                                          )
+        # Delete LB Rule
+        self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
+        lb_rule.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for LB.CREATE, LB.DELETE in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('LB.CREATE'),
+                            1,
+                            "Check LB.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('LB.DELETE'),
+                            1,
+                            "Check LB.DELETE in events table"
+                        )
+        return
+
+
+class TestSnapshotUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshotUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Account, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
+    def test_01_snapshot_usage(self):
+        """Test Create/Delete a manual snap shot and verify
+        correct usage is recorded
+        """
+        # Validate the following
+        # 1. Create snapshot of the root disk  for this account.Snapshot.create
+        #    event is there for the created account in cloud.usage_event table
+        # 2. Destroy the snapshot after some time. Snapshot.delete event is
+        #    generated for the destroyed Snapshot
+        # 3. Delete the account
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=self.virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        self.assertEqual(
+                         isinstance(volumes, list),
+                         True,
+                         "Check if list volumes return a valid data"
+                        )
+
+        volume = volumes[0]
+
+        # Create a snapshot from the ROOTDISK
+        self.debug("Creating snapshot from volume: %s" % volumes[0].id)
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+
+        # Delete snapshot Rule
+        self.debug("Deleting snapshot: %s" % snapshot.id)
+        snapshot.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check if database query returns a valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query Result: %s" % qresult)
+
+        # Check for SNAPSHOT.CREATE, SNAPSHOT.DELETE events in cloud.usage_event
+        # table
+        self.assertEqual(
+                            qresult.count('SNAPSHOT.CREATE'),
+                            1,
+                            "Check SNAPSHOT.CREATE event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('SNAPSHOT.DELETE'),
+                            1,
+                            "Check SNAPSHOT.DELETE in events table"
+                        )
+        return
+
+
+class TestNatRuleUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestNatRuleUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls.public_ip_1 = PublicIPAddress.create(
+                                           cls.api_client,
+                                           cls.virtual_machine.account,
+                                           cls.virtual_machine.zoneid,
+                                           cls.virtual_machine.domainid,
+                                           cls.services["server"]
+                                           )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, NAT rules
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "simulator"])
+    def test_01_nat_usage(self):
+        """Test Create/Delete a PF rule and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Acquire a IP for this account
+        # 2. Create a PF rule on the IP associated with this account.
+        #    NET.RULEADD event is registered for this account in
+        #    cloud.usage_event table
+        # 3. Delete the created PF rule from the account. NET.RULEDelete event
+        #    is registered for this account in cloud.usage_event table
+        # 4. Delete this account.
+
+        self.debug("Creating NAT rule with public IP: %s" %
+                                    self.public_ip_1.ipaddress.id)
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                        self.apiclient,
+                        self.virtual_machine,
+                        self.services["natrule"],
+                        self.public_ip_1.ipaddress.id
+                        )
+
+        # Delete NAT Rule
+        self.debug("Deleting NAT rule: %s" % nat_rule.id)
+        nat_rule.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for NET.RULEADD, NET.RULEDELETE in cloud.usage_event table
+        self.assertEqual(
+                            qresult.count('NET.RULEADD'),
+                            1,
+                            "Check NET.RULEADD event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('NET.RULEDELETE'),
+                            1,
+                            "Check NET.RULEDELETE in events table"
+                        )
+        return
+
+
+class TestVpnUsage(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestVpnUsage, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+
+        # Create Service offerings, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id
+                                )
+        cls.public_ip = PublicIPAddress.create(
+                                           cls.api_client,
+                                           cls.virtual_machine.account,
+                                           cls.virtual_machine.zoneid,
+                                           cls.virtual_machine.domainid,
+                                           cls.services["server"]
+                                           )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, VPN users
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_vpn_usage(self):
+        """Test Create/Delete a VPN and verify correct usage is recorded
+        """
+        # Validate the following
+        # 1. Enable VPN for this IP. vpn.add.user event is registered for this
+        #    account in cloud.usage_event table
+        # 2. Add user to this vpn
+        # 3. Delete user for this VPN. vpn.user.delete event is registered for
+        #    this account in cloud.usage_event table
+        # 4. Delete this account.
+
+        self.debug("Created VPN with public IP: %s" %
+                                    self.public_ip.ipaddress.id)
+        #Assign VPN to Public IP
+        vpn = Vpn.create(
+                        self.apiclient,
+                        self.public_ip.ipaddress.id,
+                        account=self.account.account.name,
+                        domainid=self.account.account.domainid
+                        )
+
+        self.debug("Created VPN user for account: %s" %
+                                    self.account.account.name)
+
+        vpnuser = VpnUser.create(
+                                 self.apiclient,
+                                 self.services["vpn_user"]["username"],
+                                 self.services["vpn_user"]["password"],
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+
+        # Remove VPN user
+        self.debug("Deleting VPN user: %s" % vpnuser.id)
+        vpnuser.delete(self.apiclient)
+
+        # Delete VPN access
+        self.debug("Deleting VPN: %s" % vpn.publicipid)
+        vpn.delete(self.apiclient)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';" \
+                        % self.account.account.id)
+
+        qresultset = self.dbclient.execute(
+                        "select id from account where uuid = '%s';" \
+                        % self.account.account.id
+                        )
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+        qresult = qresultset[0]
+
+        account_id = qresult[0]
+        self.debug("select type from usage_event where account_id = '%s';" \
+                        % account_id)
+
+        qresultset = self.dbclient.execute(
+                        "select type from usage_event where account_id = '%s';" \
+                        % account_id
+                        )
+
+        self.assertEqual(
+                         isinstance(qresultset, list),
+                         True,
+                         "Check DB query result set for valid data"
+                         )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = str(qresultset)
+        self.debug("Query result: %s" % qresult)
+
+        # Check for VPN user related events
+        self.assertEqual(
+                            qresult.count('VPN.USER.ADD'),
+                            1,
+                            "Check VPN.USER.ADD event in events table"
+                        )
+
+        self.assertEqual(
+                            qresult.count('VPN.USER.ADD'),
+                            1,
+                            "Check VPN.USER.ADD in events table"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_vmware_drs.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_vmware_drs.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_vmware_drs.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_vmware_drs.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,607 @@
+# -*- encoding: utf-8 -*-
+# 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
+
+""" P1 for VMware DRS testing
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+#Import System modules
+import time
+
+
+class Services:
+    """Test vmware DRS services
+    """
+
+    def __init__(self):
+        self.services = {
+                "account": {
+                    "email": "test@test.com",
+                    "firstname": "Test",
+                    "lastname": "User",
+                    "username": "test",
+                    # Random characters are appended in create account to
+                    # ensure unique username generated each time
+                    "password": "password",
+                },
+                "virtual_machine":
+                {
+                    "displayname": "testserver",
+                    "username": "root",     # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                },
+                "service_offering":
+                {
+                    "name": "Tiny Instance",
+                    "displaytext": "Tiny Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,    # in MHz
+                    "memory": 128,      # In MBs
+                },
+                "anti_affinity": {
+                    "host_1": "10.147.29.55",
+                    "host_2": "10.147.29.61",
+                "vm_2": '73973255-9354-4b1a-b98f-30a3531fd16d',
+                "vm_1": '11d4e127-7e07-47bb-8ec9-6a9e9ac672ce',
+                # VM IDs created manually on host 1 and anti-affinity rules added
+                },
+                "affinity": {
+                    "host_1": "10.147.29.55",
+                    "host_2": "10.147.29.61",
+                    "vm_2": '73973255-9354-4b1a-b98f-30a3531fd16d',
+                    "vm_1": '11d4e127-7e07-47bb-8ec9-6a9e9ac672ce',
+                    # VM IDs created manually on host 1 and affinity rules added
+                },
+            "sleep": 60,
+            "timeout": 10,
+            "full_host": "10.147.29.53",
+            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            # CentOS 5.3 (64-bit)
+        }
+
+
+class TestVMPlacement(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestVMPlacement,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+                                cls.api_client,
+                                cls.services
+                            )
+        cls.zone = get_zone(
+                            cls.api_client,
+                            cls.services
+                            )
+        cls.pod = get_pod(
+                          cls.api_client,
+                          zoneid=cls.zone.id,
+                          services=cls.services
+                          )
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            offerha=True
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.testClient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "vmware", "multihost"])
+    def test_vm_creation_in_fully_automated_mode(self):
+        """ Test VM Creation in  automation mode = Fully automated
+            This test requires following preconditions:
+                - There should be minimum 2 hosts added to cluster
+                - One of the host should be full of capacity. This host's name
+                  should be specified in "full_host" configuration
+                - Another host should have some capacity remaining
+                - DRS Cluster is configured in "Fully automated" mode
+        """
+        # Validate the following
+        # 1. Create a new VM in a host which is almost fully utilized
+        # 2 Automatically places VM on the other host
+        # 3. VM state is running after deployment
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         2,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug(
+                "Finding the host details of host: %s" %
+                                                self.services["full_host"])
+
+        host = [host for host in hosts if host.name == self.services["full_host"]][0]
+
+        self.debug("Deploying VM in account: %s" % self.account.account.name)
+        # Spawn an instance in that network
+        virtual_machine = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        self.assertNotEqual(
+                    vm.hostid,
+                    host.id,
+                    "Host Ids of two should not match as one host is full"
+                    )
+        return
+
+
+class TestAntiAffinityRules(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestAntiAffinityRules,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+                                cls.api_client,
+                                cls.services
+                            )
+        cls.zone = get_zone(
+                            cls.api_client,
+                            cls.services
+                            )
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostypeid"]
+                            )
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.testClient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+        
+    @attr(tags = ["advanced", "vmware", "multihost"])
+    def test_vmware_anti_affinity(self):
+        """ Test Set up anti-affinity rules
+
+            The test requires following pre-requisites
+            - VMWare cluster configured in fully automated mode
+            - There should be atleast 2 VMs deployed on one of the clusters
+              through cloudstack UI manually
+            - Anti affinity rule should be set on the 2 VMs deployed.
+            - Add host names to host_1,host_2 and IDs of VM 1,2 in the settings
+              class "anti_affinity" above.
+        """
+
+        # Validate the following
+        # 1. Deploy VMs on host 1 and 2
+        # 2. Enable maintenance mode for host 1
+        # 3. VM should be migrated to 3rd host
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         3,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug(
+                "Finding the host details of host_1: %s" %
+                                    self.services["anti_affinity"]["host_1"])
+
+        host_1 = [host for host in hosts if host.name == self.services["anti_affinity"]["host_1"]][0]
+
+        host_2 = [host for host in hosts if host.name == self.services["anti_affinity"]["host_2"]][0]
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.services["anti_affinity"]["vm_1"],
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        virtual_machine_1 = vms[0]
+
+        self.debug("VM State: %s" % virtual_machine_1.state)
+        self.assertEqual(
+                         virtual_machine_1.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.services["anti_affinity"]["vm_2"],
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        virtual_machine_2 = vms[0]
+        self.debug("VM %s  State: %s" % (
+                                         virtual_machine_2.name,
+                                         virtual_machine_2.state
+                                         ))
+        self.assertEqual(
+                         virtual_machine_2.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        self.debug("Enabling maintenance mode on host_1: %s" % host_1.name)
+
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = host_1.id
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        timeout = self.services["timeout"]
+        while True:
+            hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          type='Routing',
+                          id=host_1.id
+                          )
+            if isinstance(hosts, list):
+                host = hosts[0]
+            if host.resourcestate == 'Maintenance':
+                break
+            elif timeout == 0:
+                self.fail("Failed to put host: %s in maintenance mode" % host.name)
+
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_1.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        self.assertNotEqual(
+                         vm.hostid,
+                         host_2.id,
+                         "The host name should not match with second host name"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % host_1.id)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = host_1.id
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % host_1.id)
+        return
+
+
+class TestAffinityRules(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestAffinityRules,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+                                cls.api_client,
+                                cls.services
+                            )
+        cls.zone = get_zone(
+                            cls.api_client,
+                            cls.services
+                            )
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostypeid"]
+                            )
+        cls._cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.testClient.close()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "vmware", "multihost"])
+    def test_vmware_affinity(self):
+        """ Test Set up affinity rules
+
+            The test requires following pre-requisites
+            - VMWare cluster configured in fully automated mode
+            - There should be atleast 2 VMs deployed on one of the clusters
+              through cloudstack UI manually
+            - Anti affinity rule should be set on the 2 VMs deployed.
+            - Add host names to host_1,host_2 and IDs of VM 1,2 in the settings
+              class "affinity" above.
+        """
+
+        # Validate the following
+        # 1. Deploy VMs 2 VMs on same hosts
+        # 2. Migrate one VM from one host to another
+        # 3. The second VM should also get migrated
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         2,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug(
+                "Finding the host details of host_1: %s" %
+                                        self.services["affinity"]["host_1"])
+
+        host_1 = [host for host in hosts if host.name == self.services["affinity"]["host_1"]][0]
+
+        host_2 = [host for host in hosts if host.name == self.services["affinity"]["host_2"]][0]
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.services["affinity"]["vm_1"],
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+
+        virtual_machine_1 = vms[0]
+        self.assertEqual(
+                         virtual_machine_1.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+
+        self.debug("Deploying VM on account: %s" % self.account.account.name)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=self.services["affinity"]["vm_2"],
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        virtual_machine_2 = vms[0]
+        self.assertEqual(
+                         virtual_machine_2.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+
+        self.debug("Migrate VM from host_1 to host_2")
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.virtualmachineid = virtual_machine_2.id
+        cmd.hostid = host_2.id
+        self.apiclient.migrateVirtualMachine(cmd)
+        self.debug("Migrated VM from host_1 to host_2")
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  hostid=host_2.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vmids = [vm.id for vm in vms]
+        self.assertIn(
+                      virtual_machine_1.id,
+                      vmids,
+                      "VM 1 should be successfully migrated to host 2"
+                      )
+        self.assertIn(
+                      virtual_machine_2.id,
+                      vmids,
+                      "VM 2 should be automatically migrated to host 2"
+                      )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_volumes.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_volumes.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/component/test_volumes.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/component/test_volumes.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1169 @@
+# 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.
+""" P1 tests for Volumes
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+#Import System modules
+import os
+import urllib
+import time
+import tempfile
+
+
+class Services:
+    """Test Volume Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume": {
+                                "diskname": "TestDiskServ",
+                                "max": 6,
+                        },
+                         "virtual_machine": {
+                                    "displayname": "testVM",
+                                    "hypervisor": 'XenServer',
+                                    "protocol": 'TCP',
+                                    "ssh_port": 22,
+                                    "username": "root",
+                                    "password": "password",
+                                    "privateport": 22,
+                                    "publicport": 22,
+                         },
+                         "iso":  # ISO settings for Attach/Detach ISO tests
+                         {
+                          "displaytext": "Test ISO",
+                          "name": "testISO",
+                          "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                          # Source URL where ISO is located
+                          "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                          },
+                         "custom_volume": {
+                                           "customdisksize": 2,
+                                           "diskname": "Custom disk",
+                        },
+                        "sleep": 50,
+                        "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
+                        "mode": 'advanced',
+                    }
+
+
+class TestAttachVolume(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestAttachVolume, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_volume_attach(self):
+        """Test Attach volumes (max capacity)
+        """
+        # Validate the following
+        # 1. Deploy a vm and create 5 data disk
+        # 2. Attach all the created Volume to the vm.
+        # 3. Reboot the VM. VM should be successfully rebooted
+        # 4. Stop the VM. Stop VM should be successful
+        # 5. Start The VM. Start VM should be successful
+
+        # Create 5 volumes and attach to VM
+        for i in range(self.services["volume"]["max"]):
+            volume = Volume.create(
+                                   self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+            self.debug("Created volume: %s for account: %s" % (
+                                                volume.id,
+                                                self.account.account.name
+                                                ))
+            # Check List Volume response for newly created volume
+            list_volume_response = list_volumes(
+                                                self.apiclient,
+                                                id=volume.id
+                                                )
+            self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+            # Attach volume to VM
+            self.virtual_machine.attach_volume(
+                                                self.apiclient,
+                                                volume
+                                                )
+            self.debug("Attach volume: %s to VM: %s" % (
+                                                volume.id,
+                                                self.virtual_machine.id
+                                                ))
+        # Check all volumes attached to same VM
+        list_volume_response = list_volumes(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                                isinstance(list_volume_response, list),
+                                True,
+                                "Check list volumes response for valid list"
+                        )
+
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+        self.assertEqual(
+                            len(list_volume_response),
+                            self.services["volume"]["max"],
+                            "Check number of data volumes attached to VM"
+                        )
+        self.debug("Rebooting the VM: %s" % self.virtual_machine.id)
+        # Reboot VM
+        self.virtual_machine.reboot(self.apiclient)
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        #Verify VM response to check whether VM deployment was successful
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM"
+                        )
+
+        self.debug("Stopping the VM: %s" % self.virtual_machine.id)
+        # Stop VM
+        self.virtual_machine.stop(self.apiclient)
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+
+        #Verify VM response to check whether VM deployment was successful
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Stopped',
+                            "Check the state of VM"
+                        )
+
+        self.debug("Starting the VM: %s" % self.virtual_machine.id)
+        # Start VM
+        self.virtual_machine.start(self.apiclient)
+        # Sleep to ensure that VM is in ready state
+        time.sleep(self.services["sleep"])
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+
+        #Verify VM response to check whether VM deployment was successful
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_02_volume_attach_max(self):
+        """Test attach volumes (more than max) to an instance
+        """
+
+        # Validate the following
+        # 1. Attach one more data volume to VM (Already 5 attached)
+        # 2. Attach volume should fail
+
+        # Create a volume and attach to VM
+        volume = Volume.create(
+                                self.apiclient,
+                                self.services["volume"],
+                                zoneid=self.zone.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                diskofferingid=self.disk_offering.id
+                               )
+        self.debug("Created volume: %s for account: %s" % (
+                                                volume.id,
+                                                self.account.account.name
+                                                ))
+        # Check List Volume response for newly created volume
+        list_volume_response = list_volumes(
+                                            self.apiclient,
+                                            id=volume.id
+                                            )
+        self.assertEqual(
+                                isinstance(list_volume_response, list),
+                                True,
+                                "Check list volumes response for valid list"
+                        )
+
+        self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+        # Attach volume to VM
+        with self.assertRaises(Exception):
+            self.debug("Trying to Attach volume: %s to VM: %s" % (
+                                                volume.id,
+                                                self.virtual_machine.id
+                                                ))
+            self.virtual_machine.attach_volume(
+                                                self.apiclient,
+                                                volume
+                                                )
+        return
+
+    def tearDown(self):
+        #Clean up, terminate the created volumes
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestAttachVolume, cls).getClsTestClient().getApiClient()
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+
+class TestAttachDetachVolume(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestAttachDetachVolume, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created volumes
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestAttachDetachVolume, cls).getClsTestClient().getApiClient()
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_volume_attach_detach(self):
+        """Test Volume attach/detach to VM (5 data volumes)
+        """
+
+        # Validate the following
+        # 1. Deploy a vm and create 5 data disk
+        # 2. Attach all the created Volume to the vm.
+        # 3. Detach all the volumes attached.
+        # 4. Reboot the VM. VM should be successfully rebooted
+        # 5. Stop the VM. Stop VM should be successful
+        # 6. Start The VM. Start VM should be successful
+
+        volumes = []
+        # Create 5 volumes and attach to VM
+        for i in range(self.services["volume"]["max"]):
+            volume = Volume.create(
+                                   self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+            self.debug("Created volume: %s for account: %s" % (
+                                                volume.id,
+                                                self.account.account.name
+                                                ))
+            self.cleanup.append(volume)
+            volumes.append(volume)
+
+            # Check List Volume response for newly created volume
+            list_volume_response = list_volumes(
+                                                self.apiclient,
+                                                id=volume.id
+                                                )
+            self.assertEqual(
+                                isinstance(list_volume_response, list),
+                                True,
+                                "Check list volumes response for valid list"
+                        )
+
+            self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+            self.debug("Attach volume: %s to VM: %s" % (
+                                                volume.id,
+                                                self.virtual_machine.id
+                                                ))
+            # Attach volume to VM
+            self.virtual_machine.attach_volume(
+                                                self.apiclient,
+                                                volume
+                                                )
+
+        # Check all volumes attached to same VM
+        list_volume_response = list_volumes(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                                isinstance(list_volume_response, list),
+                                True,
+                                "Check list volumes response for valid list"
+                        )
+
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+        self.assertEqual(
+                            len(list_volume_response),
+                            self.services["volume"]["max"],
+                            "Check number of data volumes attached to VM"
+                        )
+
+        # Detach all volumes from VM
+        for volume in volumes:
+            self.debug("Detach volume: %s to VM: %s" % (
+                                                volume.id,
+                                                self.virtual_machine.id
+                                                ))
+            self.virtual_machine.detach_volume(
+                                                self.apiclient,
+                                                volume
+                                            )
+        # Reboot VM
+        self.debug("Rebooting the VM: %s" % self.virtual_machine.id)
+        self.virtual_machine.reboot(self.apiclient)
+        # Sleep to ensure that VM is in ready state
+        time.sleep(self.services["sleep"])
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        #Verify VM response to check whether VM deployment was successful
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM"
+                        )
+
+        # Stop VM
+        self.debug("Stopping the VM: %s" % self.virtual_machine.id)
+        self.virtual_machine.stop(self.apiclient)
+        # Sleep to ensure that VM is in ready state
+        time.sleep(self.services["sleep"])
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        #Verify VM response to check whether VM deployment was successful
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Stopped',
+                            "Check the state of VM"
+                        )
+
+        # Start VM
+        self.debug("Starting the VM: %s" % self.virtual_machine.id)
+        self.virtual_machine.start(self.apiclient)
+        # Sleep to ensure that VM is in ready state
+        time.sleep(self.services["sleep"])
+
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        #Verify VM response to check whether VM deployment was successful
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "Check the state of VM"
+                        )
+        return
+
+
+class TestAttachVolumeISO(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestAttachVolumeISO, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["iso"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_volume_iso_attach(self):
+        """Test Volumes and ISO attach
+        """
+
+        # Validate the following
+        # 1. Create and attach 5 data volumes to VM
+        # 2. Create an ISO. Attach it to VM instance
+        # 3. Verify that attach ISO is successful
+
+        # Create 5 volumes and attach to VM
+        for i in range(self.services["volume"]["max"]):
+            volume = Volume.create(
+                                   self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+            self.debug("Created volume: %s for account: %s" % (
+                                                volume.id,
+                                                self.account.account.name
+                                                ))
+            # Check List Volume response for newly created volume
+            list_volume_response = list_volumes(
+                                                self.apiclient,
+                                                id=volume.id
+                                                )
+            self.assertEqual(
+                                isinstance(list_volume_response, list),
+                                True,
+                                "Check list volumes response for valid list"
+                        )
+            self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+            # Attach volume to VM
+            self.virtual_machine.attach_volume(
+                                                self.apiclient,
+                                                volume
+                                                )
+
+        # Check all volumes attached to same VM
+        list_volume_response = list_volumes(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                                isinstance(list_volume_response, list),
+                                True,
+                                "Check list volumes response for valid list"
+                        )
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+        self.assertEqual(
+                            len(list_volume_response),
+                            self.services["volume"]["max"],
+                            "Check number of data volumes attached to VM"
+                        )
+        # Create an ISO and attach it to VM
+        iso = Iso.create(
+                         self.apiclient,
+                         self.services["iso"],
+                         account=self.account.account.name,
+                         domainid=self.account.account.domainid,
+                         )
+        self.debug("Created ISO with ID: %s for account: %s" % (
+                                                    iso.id,
+                                                    self.account.account.name
+                                                    ))
+
+        try:
+            self.debug("Downloading ISO with ID: %s" % iso.id)
+            iso.download(self.apiclient)
+        except Exception as e:
+            self.fail("Exception while downloading ISO %s: %s"\
+                      % (iso.id, e))
+
+        #Attach ISO to virtual machine
+        self.debug("Attach ISO ID: %s to VM: %s" % (
+                                                    iso.id,
+                                                    self.virtual_machine.id
+                                                    ))
+        cmd = attachIso.attachIsoCmd()
+        cmd.id = iso.id
+        cmd.virtualmachineid = self.virtual_machine.id
+        self.apiclient.attachIso(cmd)
+
+        # Verify ISO is attached to VM
+        vm_response = list_virtual_machines(
+                                        self.apiclient,
+                                        id=self.virtual_machine.id,
+                                        )
+        #Verify VM response to check whether VM deployment was successful
+        self.assertEqual(
+                                isinstance(vm_response, list),
+                                True,
+                                "Check list VM response for valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check VMs available in List VMs response"
+                        )
+        vm = vm_response[0]
+        self.assertEqual(
+                            vm.isoid,
+                            iso.id,
+                            "Check ISO is attached to VM or not"
+                        )
+        return
+
+
+class TestVolumes(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestVolumes, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+        cls.services["virtual_machine"]["diskofferingid"] = cls.disk_offering.id
+
+        # Create VMs, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                        )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                )
+
+        cls.volume = Volume.create(
+                                   cls.api_client,
+                                   cls.services["volume"],
+                                   zoneid=cls.zone.id,
+                                   account=cls.account.account.name,
+                                   domainid=cls.account.account.domainid,
+                                   diskofferingid=cls.disk_offering.id
+                                   )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created volumes
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_01_attach_volume(self):
+        """Attach a created Volume to a Running VM
+        """
+        # Validate the following
+        # 1. Create a data volume.
+        # 2. List Volumes should not have vmname and virtualmachineid fields in
+        #    response before volume attach (to VM)
+        # 3. Attch volume to VM. Attach volume should be successful.
+        # 4. List Volumes should have vmname and virtualmachineid fields in
+        #    response before volume attach (to VM)
+
+        # Check the list volumes response for vmname and virtualmachineid
+        list_volume_response = list_volumes(
+                                                self.apiclient,
+                                                id=self.volume.id
+                                                )
+        self.assertEqual(
+                         isinstance(list_volume_response, list),
+                         True,
+                         "Check list volumes response for valid list"
+                        )
+        self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+
+        volume = list_volume_response[0]
+
+        self.assertEqual(
+                            volume.type,
+                            'DATADISK',
+                            "Check volume type from list volume response"
+                        )
+
+        self.assertEqual(
+                            hasattr(volume, 'vmname'),
+                            True,
+                            "Check whether volume has vmname field"
+                            )
+        self.assertEqual(
+                            hasattr(volume, 'virtualmachineid'),
+                            True,
+                            "Check whether volume has virtualmachineid field"
+                            )
+
+        # Attach volume to VM
+        self.debug("Attach volume: %s to VM: %s" % (
+                                                    self.volume.id,
+                                                    self.virtual_machine.id
+                                                    ))
+        self.virtual_machine.attach_volume(self.apiclient, self.volume)
+
+        # Check all volumes attached to same VM
+        list_volume_response = list_volumes(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+        self.assertEqual(
+                         isinstance(list_volume_response, list),
+                         True,
+                         "Check list volumes response for valid list"
+                        )
+        self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+        volume = list_volume_response[0]
+        self.assertEqual(
+                        volume.vmname,
+                        self.virtual_machine.name,
+                        "Check virtual machine name in list volumes response"
+                        )
+        self.assertEqual(
+                        volume.virtualmachineid,
+                        self.virtual_machine.id,
+                        "Check VM ID in list Volume response"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_02_detach_volume(self):
+        """Detach a Volume attached to a VM
+        """
+
+        # Validate the following
+        # 1. Data disk should be detached from instance
+        # 2. Listvolumes should not have vmname and virtualmachineid fields for
+        #    that volume.
+
+        self.debug("Detach volume: %s to VM: %s" % (
+                                                    self.volume.id,
+                                                    self.virtual_machine.id
+                                                    ))
+        self.virtual_machine.detach_volume(self.apiclient, self.volume)
+
+        #Sleep to ensure the current state will reflected in other calls
+        time.sleep(self.services["sleep"])
+
+        list_volume_response = list_volumes(
+                                            self.apiclient,
+                                            id=self.volume.id
+                                            )
+        self.assertEqual(
+                         isinstance(list_volume_response, list),
+                         True,
+                         "Check list volumes response for valid list"
+                        )
+
+        self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+        volume = list_volume_response[0]
+        self.assertEqual(
+                         volume.virtualmachineid,
+                         None,
+                         "Check if volume state (detached) is reflected"
+                         )
+
+        self.assertEqual(
+                         volume.vmname,
+                         None,
+                         "Check if volume state (detached) is reflected"
+                         )
+        return
+
+    @attr(tags = ["advanced", "advancedns"])
+    def test_03_delete_detached_volume(self):
+        """Delete a Volume unattached to an VM
+        """
+        # Validate the following
+        # 1. volume should be deleted successfully and listVolume should not
+        #    contain the deleted volume details.
+
+        self.debug("Deleting volume: %s" % self.volume.id)
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = self.volume.id
+        self.apiclient.deleteVolume(cmd)
+
+        #Sleep to ensure the current state will reflected in other calls
+        time.sleep(self.services["sleep"])
+
+        list_volume_response = list_volumes(
+                                            self.apiclient,
+                                            id=self.volume.id,
+                                            type='DATADISK'
+                                            )
+        self.assertEqual(
+                        list_volume_response,
+                        None,
+                        "Check if volume exists in ListVolumes"
+                    )
+        return
+
+
+class TestDeployVmWithCustomDisk(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestDeployVmWithCustomDisk,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"],
+                                    custom=True
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    @attr(tags=["advanced", "configuration", "advancedns", "simulator",
+                "api", "basic", "eip", "sg"])
+    def test_deployVmWithCustomDisk(self):
+        """Test custom disk sizes beyond range
+        """
+        # Steps for validation
+        # 1. listConfigurations - custom.diskoffering.size.min
+        #    and custom.diskoffering.size.max
+        # 2. deployVm with custom disk offering size < min
+        # 3. deployVm with custom disk offering min< size < max
+        # 4. deployVm with custom disk offering size > max
+        # Validate the following
+        # 2. and 4. of deploy VM should fail.
+        #    Only case 3. should succeed.
+        #    cleanup all created data disks from the account
+
+        config = Configurations.list(
+                                    self.apiclient,
+                                    name="custom.diskoffering.size.min"
+                                    )
+        self.assertEqual(
+            isinstance(config, list),
+            True,
+            "custom.diskoffering.size.min should be present in global config"
+            )
+        # minimum size of custom disk (in GBs)
+        min_size = int(config[0].value)
+        self.debug("custom.diskoffering.size.min: %s" % min_size)
+
+        config = Configurations.list(
+                                    self.apiclient,
+                                    name="custom.diskoffering.size.max"
+                                    )
+        self.assertEqual(
+            isinstance(config, list),
+            True,
+            "custom.diskoffering.size.min should be present in global config"
+            )
+        # maximum size of custom disk (in GBs)
+        max_size = int(config[0].value)
+        self.debug("custom.diskoffering.size.max: %s" % max_size)
+
+        self.debug("Creating a volume with size less than min cust disk size")
+        self.services["custom_volume"]["customdisksize"] = (min_size - 1)
+        self.services["custom_volume"]["zoneid"] = self.zone.id
+        with self.assertRaises(Exception):
+            Volume.create_custom_disk(
+                                    self.apiclient,
+                                    self.services["custom_volume"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+        self.debug("Create volume failed!")
+
+        self.debug("Creating a volume with size more than max cust disk size")
+        self.services["custom_volume"]["customdisksize"] = (max_size + 1)
+        with self.assertRaises(Exception):
+            Volume.create_custom_disk(
+                                    self.apiclient,
+                                    self.services["custom_volume"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+        self.debug("Create volume failed!")
+
+        self.debug("Creating a volume with size more than min cust disk " +
+                   "but less than max cust disk size"
+                   )
+        self.services["custom_volume"]["customdisksize"] = (min_size + 1)
+        try:
+            Volume.create_custom_disk(
+                                    self.apiclient,
+                                    self.services["custom_volume"],
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+            self.debug("Create volume of cust disk size succeeded")
+        except Exception as e:
+            self.fail("Create volume failed with exception: %s" % e)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/__init__.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/__init__.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/__init__.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/__init__.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,16 @@
+# 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.
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/base.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/base.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/base.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/base.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2289 @@
+# 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.
+
+""" Base class for all Cloudstack resources
+    -Virtual machine, Volume, Snapshot etc
+"""
+
+import marvin
+from utils import is_server_ssh_ready, random_gen
+from marvin.cloudstackAPI import *
+#Import System modules
+import time
+import hashlib
+import base64
+
+
+class Domain:
+    """ Domain Life Cycle """
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, name=None, networkdomain=None,
+               parentdomainid=None):
+        """Creates an domain"""
+
+        cmd = createDomain.createDomainCmd()
+
+        if name:
+            cmd.name = "-".join([name, random_gen()])
+        elif "name" in services:
+            cmd.name = "-".join([services["name"], random_gen()])
+
+        if networkdomain:
+            cmd.networkdomain = networkdomain
+        elif "networkdomain" in services:
+            cmd.networkdomain = services["networkdomain"]
+
+        if parentdomainid:
+            cmd.parentdomainid = parentdomainid
+        elif "parentdomainid" in services:
+            cmd.parentdomainid = services["parentdomainid"]
+        try:
+            domain = apiclient.createDomain(cmd)
+            if domain is not None:
+                return Domain(domain.__dict__)
+        except Exception as e:
+            raise e
+
+    def delete(self, apiclient, cleanup=None):
+        """Delete an domain"""
+        cmd = deleteDomain.deleteDomainCmd()
+        cmd.id = self.id
+        if cleanup:
+            cmd.cleanup = cleanup
+        apiclient.deleteDomain(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists domains"""
+        cmd = listDomains.listDomainsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listDomains(cmd))
+
+
+class Account:
+    """ Account Life Cycle """
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, admin=False, domainid=None):
+        """Creates an account"""
+        cmd = createAccount.createAccountCmd()
+
+        #0 - User, 1 - Root Admin, 2 - Domain Admin
+        cmd.accounttype = 2 if (admin and domainid) else int(admin)
+
+        cmd.email = services["email"]
+        cmd.firstname = services["firstname"]
+        cmd.lastname = services["lastname"]
+
+        # Password Encoding
+        mdf = hashlib.md5()
+        mdf.update(services["password"])
+        cmd.password = mdf.hexdigest()
+        cmd.username = "-".join([services["username"], random_gen()])
+
+        if domainid:
+            cmd.domainid = domainid
+        account = apiclient.createAccount(cmd)
+
+        return Account(account.__dict__)
+
+    def delete(self, apiclient):
+        """Delete an account"""
+        cmd = deleteAccount.deleteAccountCmd()
+        cmd.id = self.account.id
+        apiclient.deleteAccount(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists accounts and provides detailed account information for
+        listed accounts"""
+
+        cmd = listAccounts.listAccountsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listAccounts(cmd))
+
+
+class User:
+    """ User Life Cycle """
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, account, domainid):
+        cmd = createUser.createUserCmd()
+        """Creates an user"""
+
+        cmd.account = account
+        cmd.domainid = domainid
+        cmd.email = services["email"]
+        cmd.firstname = services["firstname"]
+        cmd.lastname = services["lastname"]
+
+        # Password Encoding
+        mdf = hashlib.md5()
+        mdf.update(services["password"])
+        cmd.password = mdf.hexdigest()
+        cmd.username = "-".join([services["username"], random_gen()])
+        user = apiclient.createUser(cmd)
+
+        return User(user.__dict__)
+
+    def delete(self, apiclient):
+        """Delete an account"""
+        cmd = deleteUser.deleteUserCmd()
+        cmd.id = self.id
+        apiclient.deleteUser(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists users and provides detailed account information for
+        listed users"""
+
+        cmd = listUsers.listUsersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listUsers(cmd))
+
+    @classmethod
+    def registerUserKeys(cls, apiclient, userid):
+        cmd = registerUserKeys.registerUserKeysCmd()
+        cmd.id = userid
+        return apiclient.registerUserKeys(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Updates the user details"""
+
+        cmd = updateUser.updateUserCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return (apiclient.updateUser(cmd))
+
+    @classmethod
+    def update(cls, apiclient, id, **kwargs):
+        """Updates the user details (class method)"""
+
+        cmd = updateUser.updateUserCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return (apiclient.updateUser(cmd))
+
+    @classmethod
+    def login(cls, apiclient, username, password, domain=None, domainid=None):
+        """Logins to the CloudStack"""
+
+        cmd = login.loginCmd()
+        cmd.username = username
+        # MD5 hashcoded password
+        mdf = hashlib.md5()
+        mdf.update(password)
+        cmd.password = mdf.hexdigest()
+        if domain:
+            cmd.domain = domain
+        if domainid:
+            cmd.domainid = domainid
+        return apiclient.login(cmd)
+
+
+class VirtualMachine:
+    """Manage virtual machine lifecycle"""
+
+    def __init__(self, items, services):
+        self.__dict__.update(items)
+        self.username = services["username"]
+        self.password = services["password"]
+        self.ssh_port = services["ssh_port"]
+        self.ssh_client = None
+        #extract out the ipaddress
+        self.ipaddress = self.nic[0].ipaddress
+
+    @classmethod
+    def create(cls, apiclient, services, templateid=None, accountid=None,
+                    domainid=None, networkids=None, serviceofferingid=None,
+                    securitygroupids=None, projectid=None, startvm=None,
+                    diskofferingid=None, hostid=None, mode='basic'):
+        """Create the instance"""
+
+        cmd = deployVirtualMachine.deployVirtualMachineCmd()
+
+        if serviceofferingid:
+            cmd.serviceofferingid = serviceofferingid
+        elif "serviceoffering" in services:
+            cmd.serviceofferingid = services["serviceoffering"]
+
+        cmd.zoneid = services["zoneid"]
+        cmd.hypervisor = services["hypervisor"]
+
+        if accountid:
+            cmd.account = accountid
+        elif "account" in services:
+            cmd.account = services["account"]
+
+        if domainid:
+            cmd.domainid = domainid
+        elif "domainid" in services:
+            cmd.domainid = services["domainid"]
+
+        if networkids:
+            cmd.networkids = networkids
+        elif "networkids" in services:
+            cmd.networkids = services["networkids"]
+
+        if templateid:
+            cmd.templateid = templateid
+        elif "template" in services:
+            cmd.templateid = services["template"]
+
+        if diskofferingid:
+            cmd.diskofferingid = diskofferingid
+        elif "diskoffering" in services:
+            cmd.diskofferingid = services["diskoffering"]
+
+        if securitygroupids:
+            cmd.securitygroupids = [str(sg_id) for sg_id in securitygroupids]
+
+        if "userdata" in services:
+            cmd.userdata = base64.b64encode(services["userdata"])
+
+        if projectid:
+            cmd.projectid = projectid
+
+        if startvm is not None:
+            cmd.startvm = startvm
+
+        if hostid:
+            cmd.hostid = hostid
+
+        virtual_machine = apiclient.deployVirtualMachine(cmd)
+
+        if startvm == False:
+            virtual_machine.ssh_ip = virtual_machine.nic[0].ipaddress
+            virtual_machine.public_ip = virtual_machine.nic[0].ipaddress
+            return VirtualMachine(virtual_machine.__dict__, services)
+
+        # VM should be in Running state after deploy
+        timeout = 10
+        while True:
+            vm_status = VirtualMachine.list(
+                                            apiclient,
+                                            id=virtual_machine.id
+                                            )
+            if isinstance(vm_status, list):
+                if vm_status[0].state == 'Running':
+                    break
+                elif timeout == 0:
+                    raise Exception(
+                            "TimeOutException: Failed to start VM (ID: %s)" %
+                                                        virtual_machine.id)
+
+            time.sleep(10)
+            timeout = timeout - 1
+
+        if mode.lower() == 'advanced':
+            public_ip = PublicIPAddress.create(
+                                           apiclient,
+                                           virtual_machine.account,
+                                           virtual_machine.zoneid,
+                                           virtual_machine.domainid,
+                                           services
+                                           )
+            FireWallRule.create(
+                                          apiclient,
+                                          ipaddressid=public_ip.ipaddress.id,
+                                          protocol='TCP',
+                                          cidrlist=['0.0.0.0/0'],
+                                          startport=22,
+                                          endport=22
+                               )
+            nat_rule = NATRule.create(
+                                    apiclient,
+                                    virtual_machine,
+                                    services,
+                                    ipaddressid=public_ip.ipaddress.id
+                                    )
+            virtual_machine.ssh_ip = nat_rule.ipaddress
+            virtual_machine.public_ip = nat_rule.ipaddress
+        else:
+            virtual_machine.ssh_ip = virtual_machine.nic[0].ipaddress
+            virtual_machine.public_ip = virtual_machine.nic[0].ipaddress
+
+        return VirtualMachine(virtual_machine.__dict__, services)
+
+    def start(self, apiclient):
+        """Start the instance"""
+        cmd = startVirtualMachine.startVirtualMachineCmd()
+        cmd.id = self.id
+        apiclient.startVirtualMachine(cmd)
+
+    def stop(self, apiclient):
+        """Stop the instance"""
+        cmd = stopVirtualMachine.stopVirtualMachineCmd()
+        cmd.id = self.id
+        apiclient.stopVirtualMachine(cmd)
+
+    def reboot(self, apiclient):
+        """Reboot the instance"""
+        cmd = rebootVirtualMachine.rebootVirtualMachineCmd()
+        cmd.id = self.id
+        apiclient.rebootVirtualMachine(cmd)
+
+    def get_ssh_client(self, ipaddress=None, reconnect=False, port=None):
+        """Get SSH object of VM"""
+
+        # If NAT Rules are not created while VM deployment in Advanced mode
+        # then, IP address must be passed
+        if ipaddress != None:
+            self.ssh_ip = ipaddress
+        if port:
+            self.ssh_port = port
+
+        if reconnect:
+            self.ssh_client = is_server_ssh_ready(
+                                                    self.ssh_ip,
+                                                    self.ssh_port,
+                                                    self.username,
+                                                    self.password
+                                                )
+        self.ssh_client = self.ssh_client or is_server_ssh_ready(
+                                                    self.ssh_ip,
+                                                    self.ssh_port,
+                                                    self.username,
+                                                    self.password
+                                                )
+        return self.ssh_client
+
+    def delete(self, apiclient):
+        """Destroy an Instance"""
+        cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
+        cmd.id = self.id
+        apiclient.destroyVirtualMachine(cmd)
+
+    def migrate(self, apiclient, hostid=None):
+        """migrate an Instance"""
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.virtualmachineid = self.id
+        if hostid:
+            cmd.hostid = hostid
+        apiclient.migrateVirtualMachine(cmd)
+
+    def attach_volume(self, apiclient, volume):
+        """Attach volume to instance"""
+        cmd = attachVolume.attachVolumeCmd()
+        cmd.id = volume.id
+        cmd.virtualmachineid = self.id
+        return apiclient.attachVolume(cmd)
+
+    def detach_volume(self, apiclient, volume):
+        """Detach volume to instance"""
+        cmd = detachVolume.detachVolumeCmd()
+        cmd.id = volume.id
+        return apiclient.detachVolume(cmd)
+
+    def attach_iso(self, apiclient, iso):
+        """Attach ISO to instance"""
+        cmd = attachIso.attachIsoCmd()
+        cmd.id = iso.id
+        cmd.virtualmachineid = self.id
+        return apiclient.attachIso(cmd)
+
+    def detach_iso(self, apiclient):
+        """Detach ISO to instance"""
+        cmd = detachIso.detachIsoCmd()
+        cmd.id = self.id
+        return apiclient.detachIso(cmd)
+
+    def change_service_offering(self, apiclient, serviceOfferingId):
+        """Change service offering of the instance"""
+        cmd = changeServiceForVirtualMachine.changeServiceForVirtualMachineCmd()
+        cmd.id = self.id
+        cmd.serviceofferingid = serviceOfferingId
+        return apiclient.changeServiceForVirtualMachine(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all VMs matching criteria"""
+
+        cmd = listVirtualMachines.listVirtualMachinesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVirtualMachines(cmd))
+
+    def resetPassword(self, apiclient):
+        """Resets VM password if VM created using password enabled template"""
+
+        cmd = resetPasswordForVirtualMachine.resetPasswordForVirtualMachineCmd()
+        cmd.id = self.id
+        try:
+            response = apiclient.resetPasswordForVirtualMachine(cmd)
+        except Exception as e:
+            raise Exception("Reset Password failed! - %s" % e)
+        if isinstance(response, list):
+            return response[0].password
+
+
+class Volume:
+    """Manage Volume Lifecycle
+    """
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, zoneid=None, account=None,
+               domainid=None, diskofferingid=None, projectid=None):
+        """Create Volume"""
+        cmd = createVolume.createVolumeCmd()
+        cmd.name = services["diskname"]
+
+        if diskofferingid:
+            cmd.diskofferingid = diskofferingid
+        elif "diskofferingid" in services:
+            cmd.diskofferingid = services["diskofferingid"]
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        elif "zoneid" in services:
+            cmd.zoneid = services["zoneid"]
+
+        if account:
+            cmd.account = account
+        elif "account" in services:
+            cmd.account = services["account"]
+
+        if domainid:
+            cmd.domainid = domainid
+        elif "domainid" in services:
+            cmd.domainid = services["domainid"]
+
+        if projectid:
+            cmd.projectid = projectid
+        return Volume(apiclient.createVolume(cmd).__dict__)
+
+    @classmethod
+    def create_custom_disk(cls, apiclient, services, account=None,
+                                    domainid=None, diskofferingid=None):
+        """Create Volume from Custom disk offering"""
+        cmd = createVolume.createVolumeCmd()
+        cmd.name = services["diskname"]
+
+        if diskofferingid:
+            cmd.diskofferingid = diskofferingid
+        elif "customdiskofferingid" in services:
+            cmd.diskofferingid = services["customdiskofferingid"]
+
+        cmd.size = services["customdisksize"]
+        cmd.zoneid = services["zoneid"]
+
+        if account:
+            cmd.account = account
+        else:
+            cmd.account = services["account"]
+
+        if domainid:
+            cmd.domainid = domainid
+        else:
+            cmd.domainid = services["domainid"]
+
+        return Volume(apiclient.createVolume(cmd).__dict__)
+
+    @classmethod
+    def create_from_snapshot(cls, apiclient, snapshot_id, services,
+                             account=None, domainid=None):
+        """Create Volume from snapshot"""
+        cmd = createVolume.createVolumeCmd()
+        cmd.name = "-".join([services["diskname"], random_gen()])
+        cmd.snapshotid = snapshot_id
+        cmd.zoneid = services["zoneid"]
+        cmd.size = services["size"]
+        if account:
+            cmd.account = account
+        else:
+            cmd.account = services["account"]
+        if domainid:
+            cmd.domainid = domainid
+        else:
+            cmd.domainid = services["domainid"]
+        return Volume(apiclient.createVolume(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Volume"""
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = self.id
+        apiclient.deleteVolume(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all volumes matching criteria"""
+
+        cmd = listVolumes.listVolumesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVolumes(cmd))
+
+    @classmethod
+    def upload(cls, apiclient, services, zoneid=None, account=None, domainid=None, url=None):
+        """Uploads the volume to specified account"""
+
+        cmd = uploadVolume.uploadVolumeCmd()
+        if zoneid:
+            cmd.zoneid = zoneid
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        cmd.format = services["format"]
+        cmd.name = services["diskname"]
+        if url:
+            cmd.url = url
+        else:
+            cmd.url = services["url"]
+        return Volume(apiclient.uploadVolume(cmd).__dict__)
+
+    def wait_for_upload(self, apiclient, timeout=5, interval=60):
+        """Wait for upload"""
+        #Sleep to ensure template is in proper state before download
+        time.sleep(interval)
+
+        while True:
+            volume_response = Volume.list(
+                                    apiclient,
+                                    id=self.id,
+                                    zoneid=self.zoneid,
+                                    )
+            if isinstance(volume_response, list):
+
+                volume = volume_response[0]
+                # If volume is ready,
+                # volume.state = Allocated
+                if volume.state == 'Uploaded':
+                    break
+
+                elif 'Uploading' in volume.state:
+                    time.sleep(interval)
+
+                elif 'Installing' not in volume.state:
+                    raise Exception(
+                        "Error in uploading volume: status - %s" %
+                                                            volume.state)
+            elif timeout == 0:
+                break
+
+            else:
+                time.sleep(interval)
+                timeout = timeout - 1
+        return
+
+
+class Snapshot:
+    """Manage Snapshot Lifecycle
+    """
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, volume_id, account=None,
+                                            domainid=None, projectid=None):
+        """Create Snapshot"""
+        cmd = createSnapshot.createSnapshotCmd()
+        cmd.volumeid = volume_id
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        if projectid:
+            cmd.projectid = projectid
+        return Snapshot(apiclient.createSnapshot(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Snapshot"""
+        cmd = deleteSnapshot.deleteSnapshotCmd()
+        cmd.id = self.id
+        apiclient.deleteSnapshot(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all snapshots matching criteria"""
+
+        cmd = listSnapshots.listSnapshotsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listSnapshots(cmd))
+
+
+class Template:
+    """Manage template life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, volumeid=None,
+               account=None, domainid=None, projectid=None):
+        """Create template from Volume"""
+        #Create template from Virtual machine and Volume ID
+        cmd = createTemplate.createTemplateCmd()
+        cmd.displaytext = services["displaytext"]
+        cmd.name = "-".join([services["name"], random_gen()])
+        cmd.ostypeid = services["ostypeid"]
+
+        cmd.isfeatured = services["isfeatured"] if "isfeatured" in services else False
+        cmd.ispublic = services["ispublic"] if "ispublic" in services else False
+        cmd.isextractable = services["isextractable"] if "isextractable" in services else False
+        cmd.passwordenabled = services["passwordenabled"] if "passwordenabled" in services else False
+
+        if volumeid:
+            cmd.volumeid = volumeid
+
+        if account:
+            cmd.account = account
+
+        if domainid:
+            cmd.domainid = domainid
+
+        if projectid:
+            cmd.projectid = projectid
+        return Template(apiclient.createTemplate(cmd).__dict__)
+
+    @classmethod
+    def register(cls, apiclient, services, zoneid=None,
+                                                account=None, domainid=None):
+        """Create template from URL"""
+
+        #Create template from Virtual machine and Volume ID
+        cmd = registerTemplate.registerTemplateCmd()
+        cmd.displaytext = services["displaytext"]
+        cmd.name = "-".join([services["name"], random_gen()])
+        cmd.format = services["format"]
+        cmd.hypervisor = services["hypervisor"]
+        cmd.ostypeid = services["ostypeid"]
+        cmd.url = services["url"]
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        else:
+            cmd.zoneid = services["zoneid"]
+
+        cmd.isfeatured = services["isfeatured"] if "isfeatured" in services else False
+        cmd.ispublic = services["ispublic"] if "ispublic" in services else False
+        cmd.isextractable = services["isextractable"] if "isextractable" in services else False
+        cmd.passwordenabled = services["passwordenabled"] if "passwordenabled" in services else False
+
+        if account:
+            cmd.account = account
+
+        if domainid:
+            cmd.domainid = domainid
+
+        # Register Template
+        template = apiclient.registerTemplate(cmd)
+
+        if isinstance(template, list):
+            return Template(template[0].__dict__)
+
+    @classmethod
+    def create_from_snapshot(cls, apiclient, snapshot, services,
+                                                        random_name=True):
+        """Create Template from snapshot"""
+        #Create template from Virtual machine and Snapshot ID
+        cmd = createTemplate.createTemplateCmd()
+        cmd.displaytext = services["displaytext"]
+        cmd.name = "-".join([
+                             services["name"],
+                             random_gen()
+                            ]) if random_name else services["name"]
+        cmd.ostypeid = services["ostypeid"]
+        cmd.snapshotid = snapshot.id
+        return Template(apiclient.createTemplate(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Template"""
+
+        cmd = deleteTemplate.deleteTemplateCmd()
+        cmd.id = self.id
+        apiclient.deleteTemplate(cmd)
+
+    def download(self, apiclient, timeout=5, interval=60):
+        """Download Template"""
+        #Sleep to ensure template is in proper state before download
+        time.sleep(interval)
+
+        while True:
+            template_response = Template.list(
+                                    apiclient,
+                                    id=self.id,
+                                    zoneid=self.zoneid,
+                                    templatefilter='self'
+                                    )
+            if isinstance(template_response, list):
+
+                template = template_response[0]
+                # If template is ready,
+                # template.status = Download Complete
+                # Downloading - x% Downloaded
+                # Error - Any other string
+                if template.status == 'Download Complete':
+                    break
+
+                elif 'Downloaded' in template.status:
+                    time.sleep(interval)
+
+                elif 'Installing' not in template.status:
+                    raise Exception(
+                        "Error in downloading template: status - %s" %
+                                                            template.status)
+
+            elif timeout == 0:
+                break
+
+            else:
+                time.sleep(interval)
+                timeout = timeout - 1
+        return
+
+    def updatePermissions(self, apiclient, **kwargs):
+        """Updates the template permissions"""
+
+        cmd = updateTemplatePermissions.updateTemplatePermissionsCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateTemplatePermissions(cmd))
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all templates matching criteria"""
+
+        cmd = listTemplates.listTemplatesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listTemplates(cmd))
+
+
+class Iso:
+    """Manage ISO life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, account=None, domainid=None,
+                                                        projectid=None):
+        """Create an ISO"""
+        #Create ISO from URL
+        cmd = registerIso.registerIsoCmd()
+        cmd.displaytext = services["displaytext"]
+        cmd.name = services["name"]
+        cmd.ostypeid = services["ostypeid"]
+        cmd.url = services["url"]
+        cmd.zoneid = services["zoneid"]
+
+        if "isextractable" in services:
+            cmd.isextractable = services["isextractable"]
+        if "isfeatured" in services:
+            cmd.isfeatured = services["isfeatured"]
+        if "ispublic" in services:
+            cmd.ispublic = services["ispublic"]
+
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        if projectid:
+            cmd.projectid = projectid
+        # Register ISO
+        iso = apiclient.registerIso(cmd)
+
+        if iso:
+            return Iso(iso[0].__dict__)
+
+    def delete(self, apiclient):
+        """Delete an ISO"""
+        cmd = deleteIso.deleteIsoCmd()
+        cmd.id = self.id
+        apiclient.deleteIso(cmd)
+        return
+
+    def download(self, apiclient, timeout=5, interval=60):
+        """Download an ISO"""
+        #Ensuring ISO is successfully downloaded
+        while True:
+            time.sleep(interval)
+
+            cmd = listIsos.listIsosCmd()
+            cmd.id = self.id
+            iso_response = apiclient.listIsos(cmd)
+
+            if isinstance(iso_response, list):
+                response = iso_response[0]
+                # Again initialize timeout to avoid listISO failure
+                timeout = 5
+                # Check whether download is in progress(for Ex:10% Downloaded)
+                # or ISO is 'Successfully Installed'
+                if response.status == 'Successfully Installed':
+                    return
+                elif 'Downloaded' not in response.status and \
+                    'Installing' not in response.status:
+                    raise Exception(
+                        "Error In Downloading ISO: ISO Status - %s" %
+                                                            response.status)
+
+            elif timeout == 0:
+                raise Exception("ISO download Timeout Exception")
+            else:
+                timeout = timeout - 1
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all available ISO files."""
+
+        cmd = listIsos.listIsosCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listIsos(cmd))
+
+
+class PublicIPAddress:
+    """Manage Public IP Addresses"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, accountid=None, zoneid=None, domainid=None,
+               services=None, networkid=None, projectid=None):
+        """Associate Public IP address"""
+        cmd = associateIpAddress.associateIpAddressCmd()
+
+        if accountid:
+            cmd.account = accountid
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        elif "zoneid" in services:
+            cmd.zoneid = services["zoneid"]
+
+        if domainid:
+            cmd.domainid = domainid
+        elif "domainid" in services:
+            cmd.domainid = services["domainid"]
+
+        if networkid:
+            cmd.networkid = networkid
+
+        if projectid:
+            cmd.projectid = projectid
+        return PublicIPAddress(apiclient.associateIpAddress(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Dissociate Public IP address"""
+        cmd = disassociateIpAddress.disassociateIpAddressCmd()
+        cmd.id = self.ipaddress.id
+        apiclient.disassociateIpAddress(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Public IPs matching criteria"""
+
+        cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listPublicIpAddresses(cmd))
+
+
+class NATRule:
+    """Manage port forwarding rule"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, virtual_machine, services, ipaddressid=None,
+                                                            projectid=None):
+        """Create Port forwarding rule"""
+        cmd = createPortForwardingRule.createPortForwardingRuleCmd()
+
+        if ipaddressid:
+            cmd.ipaddressid = ipaddressid
+        elif "ipaddressid" in services:
+            cmd.ipaddressid = services["ipaddressid"]
+
+        cmd.privateport = services["privateport"]
+        cmd.publicport = services["publicport"]
+        cmd.protocol = services["protocol"]
+        cmd.virtualmachineid = virtual_machine.id
+
+        if projectid:
+            cmd.projectid = projectid
+
+        return NATRule(apiclient.createPortForwardingRule(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete port forwarding"""
+        cmd = deletePortForwardingRule.deletePortForwardingRuleCmd()
+        cmd.id = self.id
+        apiclient.deletePortForwardingRule(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all NAT rules matching criteria"""
+
+        cmd = listPortForwardingRules.listPortForwardingRulesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listPortForwardingRules(cmd))
+
+
+class StaticNATRule:
+    """Manage Static NAT rule"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, ipaddressid=None):
+        """Creates static ip forwarding rule"""
+
+        cmd = createFirewallRule.createFirewallRuleCmd()
+        cmd.protocol = services["protocol"]
+        cmd.startport = services["startport"]
+
+        if "endport" in services:
+            cmd.endport = services["endport"]
+
+        if "cidrlist" in services:
+            cmd.cidrlist = services["cidrlist"]
+
+        if ipaddressid:
+            cmd.ipaddressid = ipaddressid
+        elif "ipaddressid" in services:
+            cmd.ipaddressid = services["ipaddressid"]
+
+        return StaticNATRule(apiclient.createFirewallRule(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete IP forwarding rule"""
+        cmd = deleteIpForwardingRule.deleteIpForwardingRuleCmd()
+        cmd.id = self.id
+        apiclient.deleteIpForwardingRule(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all IP forwarding rules matching criteria"""
+
+        cmd = listIpForwardingRules.listIpForwardingRulesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listIpForwardingRules(cmd))
+
+    @classmethod
+    def enable(cls, apiclient, ipaddressid, virtualmachineid):
+        """Enables Static NAT rule"""
+
+        cmd = enableStaticNat.enableStaticNatCmd()
+        cmd.ipaddressid = ipaddressid
+        cmd.virtualmachineid = virtualmachineid
+        apiclient.enableStaticNat(cmd)
+        return
+
+    @classmethod
+    def disable(cls, apiclient, ipaddressid, virtualmachineid):
+        """Disables Static NAT rule"""
+
+        cmd = disableStaticNat.disableStaticNatCmd()
+        cmd.ipaddressid = ipaddressid
+        apiclient.disableStaticNat(cmd)
+        return
+
+
+class FireWallRule:
+    """Manage Firewall rule"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, ipaddressid, protocol, cidrlist=None,
+               startport=None, endport=None, projectid=None):
+        """Create Firewall Rule"""
+        cmd = createFirewallRule.createFirewallRuleCmd()
+        cmd.ipaddressid = ipaddressid
+        cmd.protocol = protocol
+        if cidrlist:
+            cmd.cidrlist = cidrlist
+        if startport:
+            cmd.startport = startport
+        if endport:
+            cmd.endport = endport
+
+        if projectid:
+            cmd.projectid = projectid
+
+        return FireWallRule(apiclient.createFirewallRule(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Firewall rule"""
+        cmd = deleteFirewallRule.deleteFirewallRuleCmd()
+        cmd.id = self.id
+        apiclient.deleteFirewallRule(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Firewall Rules matching criteria"""
+
+        cmd = listFirewallRules.listFirewallRulesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listFirewallRules(cmd))
+
+
+class ServiceOffering:
+    """Manage service offerings cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, domainid=None, **kwargs):
+        """Create Service offering"""
+        cmd = createServiceOffering.createServiceOfferingCmd()
+        cmd.cpunumber = services["cpunumber"]
+        cmd.cpuspeed = services["cpuspeed"]
+        cmd.displaytext = services["displaytext"]
+        cmd.memory = services["memory"]
+        cmd.name = services["name"]
+
+        # Service Offering private to that domain
+        if domainid:
+            cmd.domainid = domainid
+
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return ServiceOffering(apiclient.createServiceOffering(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Service offering"""
+        cmd = deleteServiceOffering.deleteServiceOfferingCmd()
+        cmd.id = self.id
+        apiclient.deleteServiceOffering(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all available service offerings."""
+
+        cmd = listServiceOfferings.listServiceOfferingsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listServiceOfferings(cmd))
+
+
+class DiskOffering:
+    """Manage disk offerings cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, custom=False, domainid=None):
+        """Create Disk offering"""
+        cmd = createDiskOffering.createDiskOfferingCmd()
+        cmd.displaytext = services["displaytext"]
+        cmd.name = services["name"]
+        if custom:
+            cmd.customized = True
+        else:
+            cmd.disksize = services["disksize"]
+
+        if domainid:
+            cmd.domainid = domainid
+
+        return DiskOffering(apiclient.createDiskOffering(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Disk offering"""
+        cmd = deleteDiskOffering.deleteDiskOfferingCmd()
+        cmd.id = self.id
+        apiclient.deleteDiskOffering(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all available disk offerings."""
+
+        cmd = listDiskOfferings.listDiskOfferingsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listDiskOfferings(cmd))
+
+
+class NetworkOffering:
+    """Manage network offerings cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, **kwargs):
+        """Create network offering"""
+
+        cmd = createNetworkOffering.createNetworkOfferingCmd()
+        cmd.displaytext = "-".join([services["displaytext"], random_gen()])
+        cmd.name = "-".join([services["name"], random_gen()])
+        cmd.guestiptype = services["guestiptype"]
+        cmd.supportedservices = services["supportedservices"]
+        cmd.traffictype = services["traffictype"]
+
+        cmd.serviceProviderList = []
+        for service, provider in services["serviceProviderList"].items():
+            cmd.serviceProviderList.append({
+                                            'service': service,
+                                            'provider': provider
+                                           })
+        if "servicecapabilitylist" in services:
+            cmd.serviceCapabilityList = []
+            for service, capability in services["servicecapabilitylist"].items():
+                for ctype, value in capability.items():
+                    cmd.serviceCapabilityList.append({
+                                            'service': service,
+                                            'capabilitytype': ctype,
+                                            'capabilityvalue': value
+                                           })
+        if "specifyVlan" in services:
+            cmd.specifyVlan = services["specifyVlan"]
+        if "specifyIpRanges" in services:
+            cmd.specifyIpRanges = services["specifyIpRanges"]
+        cmd.availability = 'Optional'
+
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+
+        return NetworkOffering(apiclient.createNetworkOffering(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete network offering"""
+        cmd = deleteNetworkOffering.deleteNetworkOfferingCmd()
+        cmd.id = self.id
+        apiclient.deleteNetworkOffering(cmd)
+        return
+
+    def update(self, apiclient, **kwargs):
+        """Lists all available network offerings."""
+
+        cmd = updateNetworkOffering.updateNetworkOfferingCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateNetworkOffering(cmd))
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all available network offerings."""
+
+        cmd = listNetworkOfferings.listNetworkOfferingsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listNetworkOfferings(cmd))
+
+
+class SnapshotPolicy:
+    """Manage snapshot policies"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, volumeid, services):
+        """Create Snapshot policy"""
+        cmd = createSnapshotPolicy.createSnapshotPolicyCmd()
+        cmd.intervaltype = services["intervaltype"]
+        cmd.maxsnaps = services["maxsnaps"]
+        cmd.schedule = services["schedule"]
+        cmd.timezone = services["timezone"]
+        cmd.volumeid = volumeid
+        return SnapshotPolicy(apiclient.createSnapshotPolicy(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Snapshot policy"""
+        cmd = deleteSnapshotPolicies.deleteSnapshotPoliciesCmd()
+        cmd.id = self.id
+        apiclient.deleteSnapshotPolicies(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists snapshot policies."""
+
+        cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listSnapshotPolicies(cmd))
+
+
+class LoadBalancerRule:
+    """Manage Load Balancer rule"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, ipaddressid=None, accountid=None,
+                            networkid=None, projectid=None, domainid=None):
+        """Create Load balancing Rule"""
+
+        cmd = createLoadBalancerRule.createLoadBalancerRuleCmd()
+
+        if ipaddressid:
+            cmd.publicipid = ipaddressid
+        elif "ipaddressid" in services:
+            cmd.publicipid = services["ipaddressid"]
+
+        if accountid:
+            cmd.account = accountid
+        elif "account" in services:
+            cmd.account = services["account"]
+
+        if domainid:
+            cmd.domainid = domainid
+
+        cmd.name = services["name"]
+        cmd.algorithm = services["alg"]
+        cmd.privateport = services["privateport"]
+        cmd.publicport = services["publicport"]
+
+        if "openfirewall" in services:
+            cmd.openfirewall = services["openfirewall"]
+
+        if projectid:
+            cmd.projectid = projectid
+
+        if networkid:
+            cmd.networkid = networkid
+        return LoadBalancerRule(apiclient.createLoadBalancerRule(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete load balancing rule"""
+        cmd = deleteLoadBalancerRule.deleteLoadBalancerRuleCmd()
+        cmd.id = self.id
+        apiclient.deleteLoadBalancerRule(cmd)
+        return
+
+    def assign(self, apiclient, vms):
+        """Assign virtual machines to load balancing rule"""
+        cmd = assignToLoadBalancerRule.assignToLoadBalancerRuleCmd()
+        cmd.id = self.id
+        cmd.virtualmachineids = [str(vm.id) for vm in vms]
+        apiclient.assignToLoadBalancerRule(cmd)
+        return
+
+    def remove(self, apiclient, vms):
+        """Remove virtual machines from load balancing rule"""
+        cmd = removeFromLoadBalancerRule.removeFromLoadBalancerRuleCmd()
+        cmd.id = self.id
+        cmd.virtualmachineids = [str(vm.id) for vm in vms]
+        apiclient.removeFromLoadBalancerRule(cmd)
+        return
+
+    def update(self, apiclient, algorithm=None, description=None, name=None, **kwargs):
+        """Updates the load balancing rule"""
+        cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd()
+        cmd.id = self.id
+        if algorithm:
+            cmd.algorithm = algorithm
+        if description:
+            cmd.description = description
+        if name:
+            cmd.name = name
+
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateLoadBalancerRule(cmd)
+
+    def createSticky(self, apiclient, methodname, name, description=None, param=None):
+        """Creates a sticky policy for the LB rule"""
+
+        cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd()
+        cmd.lbruleid = self.id
+        cmd.methodname = methodname
+        cmd.name = name
+        if description:
+            cmd.description = description
+        if param:
+            cmd.param = []
+            for name, value in param.items():
+                cmd.param.append({'name': name, 'value': value})
+        return apiclient.createLBStickinessPolicy(cmd)
+
+    def deleteSticky(self, apiclient, id):
+        """Deletes stickyness policy"""
+
+        cmd = deleteLBStickinessPolicy.deleteLBStickinessPolicyCmd()
+        cmd.id = id
+        return apiclient.deleteLBStickinessPolicy(cmd)
+
+    @classmethod
+    def listStickyPolicies(cls, apiclient, lbruleid, **kwargs):
+        """Lists stickiness policies for load balancing rule"""
+
+        cmd = listLBStickinessPolicies.listLBStickinessPoliciesCmd()
+        cmd.lbruleid = lbruleid
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.listLBStickinessPolicies(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Load balancing rules matching criteria"""
+
+        cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listLoadBalancerRules(cmd))
+
+
+class Cluster:
+    """Manage Cluster life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, zoneid=None, podid=None):
+        """Create Cluster"""
+        cmd = addCluster.addClusterCmd()
+        cmd.clustertype = services["clustertype"]
+        cmd.hypervisor = services["hypervisor"]
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        else:
+            cmd.zoneid = services["zoneid"]
+
+        if podid:
+            cmd.podid = podid
+        else:
+            cmd.podid = services["podid"]
+
+        if "username" in services:
+            cmd.username = services["username"]
+        if "password" in services:
+            cmd.password = services["password"]
+        if "url" in services:
+            cmd.url = services["url"]
+        if "clustername" in services:
+            cmd.clustername = services["clustername"]
+
+        return Cluster(apiclient.addCluster(cmd)[0].__dict__)
+
+    def delete(self, apiclient):
+        """Delete Cluster"""
+        cmd = deleteCluster.deleteClusterCmd()
+        cmd.id = self.id
+        apiclient.deleteCluster(cmd)
+        return
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Clusters matching criteria"""
+
+        cmd = listClusters.listClustersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listClusters(cmd))
+
+
+class Host:
+    """Manage Host life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, cluster, services, zoneid=None, podid=None):
+        """Create Host in cluster"""
+
+        cmd = addHost.addHostCmd()
+        cmd.hypervisor = services["hypervisor"]
+        cmd.url = services["url"]
+        cmd.clusterid = cluster.id
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        else:
+            cmd.zoneid = services["zoneid"]
+
+        if podid:
+            cmd.podid = podid
+        else:
+            cmd.podid = services["podid"]
+
+        if "clustertype" in services:
+            cmd.clustertype = services["clustertype"]
+        if "username" in services:
+            cmd.username = services["username"]
+        if "password" in services:
+            cmd.password = services["password"]
+
+        # Add host
+        host = apiclient.addHost(cmd)
+
+        if isinstance(host, list):
+            return Host(host[0].__dict__)
+
+    def delete(self, apiclient):
+        """Delete Host"""
+        # Host must be in maintenance mode before deletion
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = self.id
+        apiclient.prepareHostForMaintenance(cmd)
+        time.sleep(30)
+
+        cmd = deleteHost.deleteHostCmd()
+        cmd.id = self.id
+        apiclient.deleteHost(cmd)
+        return
+
+    def enableMaintenance(self, apiclient):
+        """enables maintainance mode Host"""
+
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = self.id
+        return apiclient.prepareHostForMaintenance(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Hosts matching criteria"""
+
+        cmd = listHosts.listHostsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listHosts(cmd))
+
+
+class StoragePool:
+    """Manage Storage pools (Primary Storage)"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, clusterid=None,
+                                        zoneid=None, podid=None):
+        """Create Storage pool (Primary Storage)"""
+
+        cmd = createStoragePool.createStoragePoolCmd()
+        cmd.name = services["name"]
+
+        if podid:
+            cmd.podid = podid
+        else:
+            cmd.podid = services["podid"]
+
+        cmd.url = services["url"]
+        if clusterid:
+            cmd.clusterid = clusterid
+        elif "clusterid" in services:
+            cmd.clusterid = services["clusterid"]
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        else:
+            cmd.zoneid = services["zoneid"]
+
+        return StoragePool(apiclient.createStoragePool(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Storage pool (Primary Storage)"""
+
+        # Storage pool must be in maintenance mode before deletion
+        cmd = enableStorageMaintenance.enableStorageMaintenanceCmd()
+        cmd.id = self.id
+        apiclient.enableStorageMaintenance(cmd)
+        time.sleep(30)
+        cmd = deleteStoragePool.deleteStoragePoolCmd()
+        cmd.id = self.id
+        apiclient.deleteStoragePool(cmd)
+        return
+
+    def enableMaintenance(self, apiclient):
+        """enables maintainance mode Storage pool"""
+
+        cmd = enableStorageMaintenance.enableStorageMaintenanceCmd()
+        cmd.id = self.id
+        return apiclient.enableStorageMaintenance(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all storage pools matching criteria"""
+
+        cmd = listStoragePools.listStoragePoolsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listStoragePools(cmd))
+
+
+class Network:
+    """Manage Network pools"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, accountid=None, domainid=None,
+               networkofferingid=None, projectid=None, zoneid=None):
+        """Create Network for account"""
+        cmd = createNetwork.createNetworkCmd()
+        cmd.name = services["name"]
+        cmd.displaytext = services["displaytext"]
+
+        if networkofferingid:
+            cmd.networkofferingid = networkofferingid
+        elif "networkoffering" in services:
+            cmd.networkofferingid = services["networkoffering"]
+
+        if zoneid:
+            cmd.zoneid = zoneid
+        elif "zoneid" in services:
+            cmd.zoneid = services["zoneid"]
+
+        if "gateway" in services:
+            cmd.gateway = services["gateway"]
+        if "netmask" in services:
+            cmd.netmask = services["netmask"]
+        if "startip" in services:
+            cmd.startip = services["startip"]
+        if "endip" in services:
+            cmd.endip = services["endip"]
+        if "vlan" in services:
+            cmd.vlan = services["vlan"]
+        if "acltype" in services:
+            cmd.acltype = services["acltype"]
+
+        if accountid:
+            cmd.account = accountid
+        if domainid:
+            cmd.domainid = domainid
+        if projectid:
+            cmd.projectid = projectid
+
+        return Network(apiclient.createNetwork(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Account"""
+
+        cmd = deleteNetwork.deleteNetworkCmd()
+        cmd.id = self.id
+        apiclient.deleteNetwork(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Updates network with parameters passed"""
+
+        cmd = updateNetwork.updateNetworkCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateNetwork(cmd))
+
+    def restart(self, apiclient, cleanup=None):
+        """Restarts the network"""
+
+        cmd = restartNetwork.restartNetworkCmd()
+        cmd.id = self.id
+        if cleanup:
+            cmd.cleanup = cleanup
+        return(apiclient.restartNetwork(cmd))
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Networks matching criteria"""
+
+        cmd = listNetworks.listNetworksCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listNetworks(cmd))
+
+
+class Vpn:
+    """Manage VPN life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, publicipid, account=None, domainid=None,
+                                                            projectid=None):
+        """Create VPN for Public IP address"""
+        cmd = createRemoteAccessVpn.createRemoteAccessVpnCmd()
+        cmd.publicipid = publicipid
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        if projectid:
+            cmd.projectid = projectid
+        return Vpn(apiclient.createRemoteAccessVpn(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete remote VPN access"""
+
+        cmd = deleteRemoteAccessVpn.deleteRemoteAccessVpnCmd()
+        cmd.publicipid = self.publicipid
+        apiclient.deleteRemoteAccessVpn(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all VPN matching criteria"""
+
+        cmd = listRemoteAccessVpns.listRemoteAccessVpnsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listRemoteAccessVpns(cmd))
+
+
+class VpnUser:
+    """Manage VPN user"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, username, password, account=None, domainid=None,
+               projectid=None):
+        """Create VPN user"""
+        cmd = addVpnUser.addVpnUserCmd()
+        cmd.username = username
+        cmd.password = password
+
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        if projectid:
+            cmd.projectid = projectid
+        return VpnUser(apiclient.addVpnUser(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Remove VPN user"""
+
+        cmd = removeVpnUser.removeVpnUserCmd()
+        cmd.username = self.username
+        cmd.account = self.account
+        cmd.domainid = self.domainid
+        apiclient.removeVpnUser(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all VPN Users matching criteria"""
+
+        cmd = listVpnUsers.listVpnUsersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVpnUsers(cmd))
+
+
+class Zone:
+    """Manage Zone"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, domainid=None):
+        """Create zone"""
+        cmd = createZone.createZoneCmd()
+        cmd.dns1 = services["dns1"]
+        cmd.internaldns1 = services["internaldns1"]
+        cmd.name = services["name"]
+        cmd.networktype = services["networktype"]
+
+        if "dns2" in services:
+            cmd.dns2 = services["dns2"]
+        if "internaldns2" in services:
+            cmd.internaldns2 = services["internaldns2"]
+        if domainid:
+            cmd.domainid = domainid
+
+        return Zone(apiclient.createZone(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Zone"""
+
+        cmd = deleteZone.deleteZoneCmd()
+        cmd.id = self.id
+        apiclient.deleteZone(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Update the zone"""
+
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateZone(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Zones matching criteria"""
+
+        cmd = listZones.listZonesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listZones(cmd))
+
+
+class Pod:
+    """Manage Pod"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services):
+        """Create Pod"""
+        cmd = createPod.createPodCmd()
+        cmd.gateway = services["gateway"]
+        cmd.netmask = services["netmask"]
+        cmd.name = services["name"]
+        cmd.startip = services["startip"]
+        cmd.endip = services["endip"]
+        cmd.zoneid = services["zoneid"]
+
+        return Pod(apiclient.createPod(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Pod"""
+
+        cmd = deletePod.deletePodCmd()
+        cmd.id = self.id
+        apiclient.deletePod(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        "Returns a default pod for specified zone"
+
+        cmd = listPods.listPodsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.listPods(cmd)
+
+
+class PublicIpRange:
+    """Manage VlanIpRange"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services):
+        """Create VlanIpRange"""
+
+        cmd = createVlanIpRange.createVlanIpRangeCmd()
+        cmd.gateway = services["gateway"]
+        cmd.netmask = services["netmask"]
+        cmd.forvirtualnetwork = services["forvirtualnetwork"]
+        cmd.startip = services["startip"]
+        cmd.endip = services["endip"]
+        cmd.zoneid = services["zoneid"]
+        cmd.podid = services["podid"]
+        cmd.vlan = services["vlan"]
+
+        return PublicIpRange(apiclient.createVlanIpRange(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete VlanIpRange"""
+
+        cmd = deleteVlanIpRange.deleteVlanIpRangeCmd()
+        cmd.id = self.id
+        apiclient.deleteVlanIpRange(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all VLAN IP ranges."""
+
+        cmd = listVlanIpRanges.listVlanIpRangesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVlanIpRanges(cmd))
+
+
+class SecondaryStorage:
+    """Manage Secondary storage"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services):
+        """Create Secondary Storage"""
+        cmd = addSecondaryStorage.addSecondaryStorageCmd()
+
+        cmd.url = services["url"]
+        if "zoneid" in services:
+            cmd.zoneid = services["zoneid"]
+        return SecondaryStorage(apiclient.addSecondaryStorage(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Secondary Storage"""
+
+        cmd = deleteHost.deleteHostCmd()
+        cmd.id = self.id
+        apiclient.deleteHost(cmd)
+
+
+class PhysicalNetwork:
+    """Manage physical network storage"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, zoneid, domainid=None):
+        """Create physical network"""
+        cmd = createPhysicalNetwork.createPhysicalNetworkCmd()
+
+        cmd.name = services["name"]
+        cmd.zoneid = zoneid
+        if domainid:
+            cmd.domainid = domainid
+        return PhysicalNetwork(apiclient.createPhysicalNetwork(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Physical Network"""
+
+        cmd = deletePhysicalNetwork.deletePhysicalNetworkCmd()
+        cmd.id = self.id
+        apiclient.deletePhysicalNetwork(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Update Physical network state"""
+
+        cmd = updatePhysicalNetwork.updatePhysicalNetworkCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updatePhysicalNetwork(cmd)
+
+    def addTrafficType(self, apiclient, type):
+        """Add Traffic type to Physical network"""
+
+        cmd = addTrafficType.addTrafficTypeCmd()
+        cmd.physicalnetworkid = self.id
+        cmd.traffictype = type
+        return apiclient.addTrafficType(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all physical networks"""
+
+        cmd = listPhysicalNetworks.listPhysicalNetworksCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listPhysicalNetworks(cmd))
+
+
+class SecurityGroup:
+    """Manage Security Groups"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, account=None, domainid=None,
+               description=None, projectid=None):
+        """Create security group"""
+        cmd = createSecurityGroup.createSecurityGroupCmd()
+
+        cmd.name = services["name"]
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        if description:
+            cmd.description = description
+        if projectid:
+            cmd.projectid = projectid
+
+        return SecurityGroup(apiclient.createSecurityGroup(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Security Group"""
+
+        cmd = deleteSecurityGroup.deleteSecurityGroupCmd()
+        cmd.id = self.id
+        apiclient.deleteSecurityGroup(cmd)
+
+    def authorize(self, apiclient, services,
+                  account=None, domainid=None, projectid=None):
+        """Authorize Ingress Rule"""
+
+        cmd = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
+
+        if domainid:
+            cmd.domainid = domainid
+        if account:
+            cmd.account = account
+
+        if projectid:
+            cmd.projectid = projectid
+        cmd.securitygroupid = self.id
+        cmd.protocol = services["protocol"]
+
+        if services["protocol"] == 'ICMP':
+            cmd.icmptype = -1
+            cmd.icmpcode = -1
+        else:
+            cmd.startport = services["startport"]
+            cmd.endport = services["endport"]
+
+        cmd.cidrlist = services["cidrlist"]
+        return (apiclient.authorizeSecurityGroupIngress(cmd).__dict__)
+
+    def revoke(self, apiclient, id):
+        """Revoke ingress rule"""
+
+        cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd()
+        cmd.id = id
+        return apiclient.revokeSecurityGroupIngress(cmd)
+
+    def authorizeEgress(self, apiclient, services, account=None, domainid=None,
+                        projectid=None, user_secgrp_list={}):
+        """Authorize Egress Rule"""
+
+        cmd = authorizeSecurityGroupEgress.authorizeSecurityGroupEgressCmd()
+
+        if domainid:
+            cmd.domainid = domainid
+        if account:
+            cmd.account = account
+
+        if projectid:
+            cmd.projectid = projectid
+        cmd.securitygroupid = self.id
+        cmd.protocol = services["protocol"]
+
+        if services["protocol"] == 'ICMP':
+            cmd.icmptype = -1
+            cmd.icmpcode = -1
+        else:
+            cmd.startport = services["startport"]
+            cmd.endport = services["endport"]
+
+        cmd.cidrlist = services["cidrlist"]
+
+        cmd.usersecuritygrouplist = []
+        for account, group in user_secgrp_list.items():
+            cmd.usersecuritygrouplist.append({
+                                            'account': account,
+                                            'group': group
+                                           })
+
+        return (apiclient.authorizeSecurityGroupEgress(cmd).__dict__)
+
+    def revokeEgress(self, apiclient, id):
+        """Revoke Egress rule"""
+
+        cmd = revokeSecurityGroupEgress.revokeSecurityGroupEgressCmd()
+        cmd.id = id
+        return apiclient.revokeSecurityGroupEgress(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all security groups."""
+
+        cmd = listSecurityGroups.listSecurityGroupsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listSecurityGroups(cmd))
+
+
+class Project:
+    """Manage Project life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, account=None, domainid=None):
+        """Create project"""
+
+        cmd = createProject.createProjectCmd()
+        cmd.displaytext = services["displaytext"]
+        cmd.name = "-".join([services["name"], random_gen()])
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+
+        return Project(apiclient.createProject(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Project"""
+
+        cmd = deleteProject.deleteProjectCmd()
+        cmd.id = self.id
+        apiclient.deleteProject(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Updates the project"""
+
+        cmd = updateProject.updateProjectCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateProject(cmd)
+
+    def activate(self, apiclient):
+        """Activates the suspended project"""
+
+        cmd = activateProject.activateProjectCmd()
+        cmd.id = self.id
+        return apiclient.activateProject(cmd)
+
+    def suspend(self, apiclient):
+        """Suspend the active project"""
+
+        cmd = suspendProject.suspendProjectCmd()
+        cmd.id = self.id
+        return apiclient.suspendProject(cmd)
+
+    def addAccount(self, apiclient, account=None, email=None):
+        """Add account to project"""
+
+        cmd = addAccountToProject.addAccountToProjectCmd()
+        cmd.projectid = self.id
+        if account:
+            cmd.account = account
+        if email:
+            cmd.email = email
+        return apiclient.addAccountToProject(cmd)
+
+    def deleteAccount(self, apiclient, account):
+        """Delete account from project"""
+
+        cmd = deleteAccountFromProject.deleteAccountFromProjectCmd()
+        cmd.projectid = self.id
+        cmd.account = account
+        return apiclient.deleteAccountFromProject(cmd)
+
+    @classmethod
+    def listAccounts(cls, apiclient, **kwargs):
+        """Lists all accounts associated with projects."""
+
+        cmd = listProjectAccounts.listProjectAccountsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listProjectAccounts(cmd))
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists all projects."""
+
+        cmd = listProjects.listProjectsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listProjects(cmd))
+
+
+class ProjectInvitation:
+    """Manage project invitations"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def update(cls, apiclient, projectid, accept, account=None, token=None):
+        """Updates the project invitation for that account"""
+
+        cmd = updateProjectInvitation.updateProjectInvitationCmd()
+        cmd.projectid = projectid
+        cmd.accept = accept
+        if account:
+            cmd.account = account
+        if token:
+            cmd.token = token
+
+        return (apiclient.updateProjectInvitation(cmd).__dict__)
+
+    def delete(self, apiclient, id):
+        """Deletes the project invitation"""
+
+        cmd = deleteProjectInvitation.deleteProjectInvitationCmd()
+        cmd.id = id
+        return apiclient.deleteProjectInvitation(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists project invitations"""
+
+        cmd = listProjectInvitations.listProjectInvitationsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listProjectInvitations(cmd))
+
+
+class Configurations:
+    """Manage Configuration"""
+
+    @classmethod
+    def update(cls, apiclient, name, value=None):
+        """Updates the specified configuration"""
+
+        cmd = updateConfiguration.updateConfigurationCmd()
+        cmd.name = name
+        cmd.value = value
+        apiclient.updateConfiguration(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists configurations"""
+
+        cmd = listConfigurations.listConfigurationsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listConfigurations(cmd))
+
+
+class NetScaler:
+    """Manage external netscaler device"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def add(cls, apiclient, services, physicalnetworkid, username=None, password=None):
+        """Add external netscaler device to cloudstack"""
+
+        cmd = addNetscalerLoadBalancer.addNetscalerLoadBalancerCmd()
+        cmd.physicalnetworkid = physicalnetworkid
+        if username:
+            cmd.username = username
+        else:
+            cmd.username = services["username"]
+
+        if password:
+            cmd.password = password
+        else:
+            cmd.password = services["password"]
+
+        cmd.networkdevicetype = services["networkdevicetype"]
+
+        # Generate the URL
+        url = 'https://' + str(services["ipaddress"]) + '?'
+        url = url + 'publicinterface=' + str(services["publicinterface"]) + '&'
+        url = url + 'privateinterface=' + str(services["privateinterface"]) + '&'
+        url = url + 'numretries=' + str(services["numretries"]) + '&'
+
+        if not services["lbdevicededicated"] and "lbdevicecapacity" in services:
+            url = url + 'lbdevicecapacity=' + str(services["lbdevicecapacity"]) + '&'
+
+        url = url + 'lbdevicededicated=' + str(services["lbdevicededicated"])
+
+        cmd.url = url
+        return NetScaler(apiclient.addNetscalerLoadBalancer(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Deletes a netscaler device from CloudStack"""
+
+        cmd = deleteNetscalerLoadBalancer.deleteNetscalerLoadBalancerCmd()
+        cmd.lbdeviceid = self.lbdeviceid
+        apiclient.deleteNetscalerLoadBalancer(cmd)
+        return
+
+    def configure(self, apiclient, **kwargs):
+        """List already registered netscaler devices"""
+
+        cmd = configureNetscalerLoadBalancer.configureNetscalerLoadBalancerCmd()
+        cmd.lbdeviceid = self.lbdeviceid
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.configureNetscalerLoadBalancer(cmd))
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List already registered netscaler devices"""
+
+        cmd = listNetscalerLoadBalancers.listNetscalerLoadBalancersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listNetscalerLoadBalancers(cmd))
+
+
+class NetworkServiceProvider:
+    """Manage network serivce providers for CloudStack"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def add(cls, apiclient, name, physicalnetworkid, servicelist):
+        """Adds network service provider"""
+
+        cmd = addNetworkServiceProvider.addNetworkServiceProviderCmd()
+        cmd.name = name
+        cmd.physicalnetworkid = physicalnetworkid
+        cmd.servicelist = servicelist
+        return NetworkServiceProvider(apiclient.addNetworkServiceProvider(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Deletes network service provider"""
+
+        cmd = deleteNetworkServiceProvider.deleteNetworkServiceProviderCmd()
+        cmd.id = self.id
+        return apiclient.deleteNetworkServiceProvider(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Updates network service provider"""
+
+        cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateNetworkServiceProvider(cmd)
+
+    @classmethod
+    def update(cls, apiclient, id, **kwargs):
+        """Updates network service provider"""
+
+        cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateNetworkServiceProvider(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List network service providers"""
+
+        cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listNetworkServiceProviders(cmd))
+
+
+class Router:
+    """Manage router life cycle"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def start(cls, apiclient, id):
+        """Starts the router"""
+        cmd = startRouter.startRouterCmd()
+        cmd.id = id
+        return apiclient.startRouter(cmd)
+
+    @classmethod
+    def stop(cls, apiclient, id, forced=None):
+        """Stops the router"""
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = id
+        if forced:
+            cmd.forced = forced
+        return apiclient.stopRouter(cmd)
+
+    @classmethod
+    def reboot(cls, apiclient, id):
+        """Reboots the router"""
+        cmd = rebootRouter.rebootRouterCmd()
+        cmd.id = id
+        return apiclient.rebootRouter(cmd)
+
+    @classmethod
+    def destroy(cls, apiclient, id):
+        """Destroy the router"""
+        cmd = destroyRouter.destroyRouterCmd()
+        cmd.id = id
+        return apiclient.destroyRouter(cmd)
+
+    @classmethod
+    def change_service_offering(cls, apiclient, id, serviceofferingid):
+        """Change service offering of the router"""
+        cmd = changeServiceForRouter.changeServiceForRouterCmd()
+        cmd.id = id
+        cmd.serviceofferingid = serviceofferingid
+        return apiclient.changeServiceForRouter(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List routers"""
+
+        cmd = listRouters.listRoutersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listRouters(cmd))
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/common.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/common.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/common.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/common.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,536 @@
+# 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.
+"""Common functions
+"""
+
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from utils import *
+from base import *
+
+#Import System modules
+import time
+
+
+def get_domain(apiclient, services=None):
+    "Returns a default domain"
+
+    cmd = listDomains.listDomainsCmd()
+    if services:
+        if "domainid" in services:
+            cmd.id = services["domainid"]
+
+    domains = apiclient.listDomains(cmd)
+
+    if isinstance(domains, list):
+        return domains[0]
+    else:
+        raise Exception("Failed to find specified domain.")
+
+
+def get_zone(apiclient, services=None):
+    "Returns a default zone"
+
+    cmd = listZones.listZonesCmd()
+    if services:
+        if "zoneid" in services:
+            cmd.id = services["zoneid"]
+
+    zones = apiclient.listZones(cmd)
+
+    if isinstance(zones, list):
+        return zones[0]
+    else:
+        raise Exception("Failed to find specified zone.")
+
+
+def get_pod(apiclient, zoneid, services=None):
+    "Returns a default pod for specified zone"
+
+    cmd = listPods.listPodsCmd()
+    cmd.zoneid = zoneid
+
+    if services:
+        if "podid" in services:
+            cmd.id = services["podid"]
+
+    pods = apiclient.listPods(cmd)
+
+    if isinstance(pods, list):
+        return pods[0]
+    else:
+        raise Exception("Exception: Failed to find specified pod.")
+
+
+def get_template(apiclient, zoneid, ostypeid=12, services=None):
+    "Returns a template"
+
+    cmd = listTemplates.listTemplatesCmd()
+    cmd.templatefilter = 'featured'
+    cmd.zoneid = zoneid
+
+    if services:
+        if "template" in services:
+            cmd.id = services["template"]
+
+    list_templates = apiclient.listTemplates(cmd)
+
+    for template in list_templates:
+        if template.ostypeid == ostypeid:
+            return template
+
+    raise Exception("Exception: Failed to find template with OSTypeID: %s" %
+                                                                    ostypeid)
+    return
+
+
+def download_systemplates_sec_storage(server, services):
+    """Download System templates on sec storage"""
+
+    try:
+        # Login to management server
+        ssh = remoteSSHClient(
+                                          server["ipaddress"],
+                                          server["port"],
+                                          server["username"],
+                                          server["password"]
+                             )
+    except Exception:
+        raise Exception("SSH access failted for server with IP address: %s" %
+                                                            server["ipaddess"])
+    # Mount Secondary Storage on Management Server
+    cmds = [
+            "mkdir -p %s" % services["mnt_dir"],
+            "mount -t nfs %s:/%s %s" % (
+                                        services["sec_storage"],
+                                        services["path"],
+                                        services["mnt_dir"]
+                                        ),
+            "%s -m %s -u %s -h %s -F" % (
+                                         services["command"],
+                                         services["mnt_dir"],
+                                         services["download_url"],
+                                         services["hypervisor"]
+                                        )
+            ]
+    for c in cmds:
+        result = ssh.execute(c)
+
+    res = str(result)
+
+    # Unmount the Secondary storage
+    ssh.execute("umount %s" % (services["mnt_dir"]))
+
+    if res.count("Successfully installed system VM template") == 1:
+        return
+    else:
+        raise Exception("Failed to download System Templates on Sec Storage")
+    return
+
+
+def wait_for_ssvms(apiclient, zoneid, podid, interval=60):
+    """After setup wait for SSVMs to come Up"""
+
+    time.sleep(interval)
+    timeout = 40
+    while True:
+            list_ssvm_response = list_ssvms(
+                                        apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        zoneid=zoneid,
+                                        podid=podid
+                                        )
+            ssvm = list_ssvm_response[0]
+            if ssvm.state != 'Running':
+                # Sleep to ensure SSVMs are Up and Running
+                time.sleep(interval)
+                timeout = timeout - 1
+            elif ssvm.state == 'Running':
+                break
+            elif timeout == 0:
+                raise Exception("SSVM failed to come up")
+                break
+
+    timeout = 40
+    while True:
+            list_ssvm_response = list_ssvms(
+                                        apiclient,
+                                        systemvmtype='consoleproxy',
+                                        zoneid=zoneid,
+                                        podid=podid
+                                        )
+            cpvm = list_ssvm_response[0]
+            if cpvm.state != 'Running':
+                # Sleep to ensure SSVMs are Up and Running
+                time.sleep(interval)
+                timeout = timeout - 1
+            elif cpvm.state == 'Running':
+                break
+            elif timeout == 0:
+                raise Exception("CPVM failed to come up")
+                break
+    return
+
+def wait_for_vm(apiclient, virtualmachineid, interval=60):
+    """After setup wait for VM to come Up"""
+
+    time.sleep(interval)
+    timeout = 40
+    while True:
+            list_vm_response = list_virtual_machines(
+                                        apiclient,
+                                        id=virtualmachineid
+                                        )
+            vm = list_vm_response[0]
+            if vm.state != 'Running':
+                # Sleep to ensure VM is Up and Running
+                time.sleep(interval)
+                timeout = timeout - 1
+            elif vm.state == 'Running':
+                break
+            elif timeout == 0:
+                raise Exception("VM failed to come up")
+                break
+    return
+
+def download_builtin_templates(apiclient, zoneid, hypervisor, host,
+                                                linklocalip, interval=60):
+    """After setup wait till builtin templates are downloaded"""
+
+    # Change IPTABLES Rules
+    get_process_status(
+                        host["ipaddress"],
+                        host["port"],
+                        host["username"],
+                        host["password"],
+                        linklocalip,
+                        "iptables -P INPUT ACCEPT"
+                    )
+    time.sleep(interval)
+    # Find the BUILTIN Templates for given Zone, Hypervisor
+    list_template_response = list_templates(
+                                    apiclient,
+                                    hypervisor=hypervisor,
+                                    zoneid=zoneid,
+                                    templatefilter='self'
+                                    )
+
+    if not isinstance(list_template_response, list):
+        raise Exception("Failed to download BUILTIN templates")
+
+    # Ensure all BUILTIN templates are downloaded
+    templateid = None
+    for template in list_template_response:
+        if template.templatetype == "BUILTIN":
+                templateid = template.id
+
+    # Sleep to ensure that template is in downloading state after adding
+    # Sec storage
+    time.sleep(interval)
+    while True:
+        template_response = list_templates(
+                                    apiclient,
+                                    id=templateid,
+                                    zoneid=zoneid,
+                                    templatefilter='self'
+                                    )
+        template = template_response[0]
+        # If template is ready,
+        # template.status = Download Complete
+        # Downloading - x% Downloaded
+        # Error - Any other string
+        if template.status == 'Download Complete':
+            break
+
+        elif 'Downloaded' in template.status:
+            time.sleep(interval)
+
+        elif 'Installing' not in template.status:
+            raise Exception("ErrorInDownload")
+
+    return
+
+
+def update_resource_limit(apiclient, resourcetype, account=None,
+                                    domainid=None, max=None, projectid=None):
+    """Updates the resource limit to 'max' for given account"""
+
+    cmd = updateResourceLimit.updateResourceLimitCmd()
+    cmd.resourcetype = resourcetype
+    if account:
+        cmd.account = account
+    if domainid:
+        cmd.domainid = domainid
+    if max:
+        cmd.max = max
+    if projectid:
+        cmd.projectid = projectid
+    apiclient.updateResourceLimit(cmd)
+    return
+
+
+def list_routers(apiclient, **kwargs):
+    """List all Routers matching criteria"""
+
+    cmd = listRouters.listRoutersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listRouters(cmd))
+
+
+def list_zones(apiclient, **kwargs):
+    """List all Zones matching criteria"""
+
+    cmd = listZones.listZonesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listZones(cmd))
+
+
+def list_networks(apiclient, **kwargs):
+    """List all Networks matching criteria"""
+
+    cmd = listNetworks.listNetworksCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listNetworks(cmd))
+
+
+def list_clusters(apiclient, **kwargs):
+    """List all Clusters matching criteria"""
+
+    cmd = listClusters.listClustersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listClusters(cmd))
+
+
+def list_ssvms(apiclient, **kwargs):
+    """List all SSVMs matching criteria"""
+
+    cmd = listSystemVms.listSystemVmsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listSystemVms(cmd))
+
+
+def list_storage_pools(apiclient, **kwargs):
+    """List all storage pools matching criteria"""
+
+    cmd = listStoragePools.listStoragePoolsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listStoragePools(cmd))
+
+
+def list_virtual_machines(apiclient, **kwargs):
+    """List all VMs matching criteria"""
+
+    cmd = listVirtualMachines.listVirtualMachinesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVirtualMachines(cmd))
+
+
+def list_hosts(apiclient, **kwargs):
+    """List all Hosts matching criteria"""
+
+    cmd = listHosts.listHostsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listHosts(cmd))
+
+
+def list_configurations(apiclient, **kwargs):
+    """List configuration with specified name"""
+
+    cmd = listConfigurations.listConfigurationsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listConfigurations(cmd))
+
+
+def list_publicIP(apiclient, **kwargs):
+    """List all Public IPs matching criteria"""
+
+    cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listPublicIpAddresses(cmd))
+
+
+def list_nat_rules(apiclient, **kwargs):
+    """List all NAT rules matching criteria"""
+
+    cmd = listPortForwardingRules.listPortForwardingRulesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listPortForwardingRules(cmd))
+
+
+def list_lb_rules(apiclient, **kwargs):
+    """List all Load balancing rules matching criteria"""
+
+    cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listLoadBalancerRules(cmd))
+
+
+def list_lb_instances(apiclient, **kwargs):
+    """List all Load balancing instances matching criteria"""
+
+    cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listLoadBalancerRuleInstances(cmd))
+
+
+def list_firewall_rules(apiclient, **kwargs):
+    """List all Firewall Rules matching criteria"""
+
+    cmd = listFirewallRules.listFirewallRulesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listFirewallRules(cmd))
+
+
+def list_volumes(apiclient, **kwargs):
+    """List all volumes matching criteria"""
+
+    cmd = listVolumes.listVolumesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVolumes(cmd))
+
+
+def list_isos(apiclient, **kwargs):
+    """Lists all available ISO files."""
+
+    cmd = listIsos.listIsosCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listIsos(cmd))
+
+
+def list_snapshots(apiclient, **kwargs):
+    """List all snapshots matching criteria"""
+
+    cmd = listSnapshots.listSnapshotsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listSnapshots(cmd))
+
+
+def list_templates(apiclient, **kwargs):
+    """List all templates matching criteria"""
+
+    cmd = listTemplates.listTemplatesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listTemplates(cmd))
+
+
+def list_domains(apiclient, **kwargs):
+    """Lists domains"""
+
+    cmd = listDomains.listDomainsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listDomains(cmd))
+
+
+def list_accounts(apiclient, **kwargs):
+    """Lists accounts and provides detailed account information for
+    listed accounts"""
+
+    cmd = listAccounts.listAccountsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listAccounts(cmd))
+
+
+def list_users(apiclient, **kwargs):
+    """Lists users and provides detailed account information for
+    listed users"""
+
+    cmd = listUsers.listUsersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listUsers(cmd))
+
+
+def list_snapshot_policy(apiclient, **kwargs):
+    """Lists snapshot policies."""
+
+    cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listSnapshotPolicies(cmd))
+
+
+def list_events(apiclient, **kwargs):
+    """Lists events"""
+
+    cmd = listEvents.listEventsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listEvents(cmd))
+
+
+def list_disk_offering(apiclient, **kwargs):
+    """Lists all available disk offerings."""
+
+    cmd = listDiskOfferings.listDiskOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listDiskOfferings(cmd))
+
+
+def list_service_offering(apiclient, **kwargs):
+    """Lists all available service offerings."""
+
+    cmd = listServiceOfferings.listServiceOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listServiceOfferings(cmd))
+
+
+def list_vlan_ipranges(apiclient, **kwargs):
+    """Lists all VLAN IP ranges."""
+
+    cmd = listVlanIpRanges.listVlanIpRangesCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVlanIpRanges(cmd))
+
+
+def list_usage_records(apiclient, **kwargs):
+    """Lists usage records for accounts"""
+
+    cmd = listUsageRecords.listUsageRecordsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listUsageRecords(cmd))
+
+
+def list_nw_service_prividers(apiclient, **kwargs):
+    """Lists Network service providers"""
+
+    cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listNetworkServiceProviders(cmd))
+
+
+def list_virtual_router_elements(apiclient, **kwargs):
+    """Lists Virtual Router elements"""
+
+    cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listVirtualRouterElements(cmd))
+
+
+def list_network_offerings(apiclient, **kwargs):
+    """Lists network offerings"""
+
+    cmd = listNetworkOfferings.listNetworkOfferingsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listNetworkOfferings(cmd))
+
+
+def list_resource_limits(apiclient, **kwargs):
+    """Lists resource limits"""
+
+    cmd = listResourceLimits.listResourceLimitsCmd()
+    [setattr(cmd, k, v) for k, v in kwargs.items()]
+    return(apiclient.listResourceLimits(cmd))
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/__init__.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/__init__.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/__init__.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/__init__.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,16 @@
+# 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.
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/utils.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/utils.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/lib/utils.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/lib/utils.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,179 @@
+# 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.
+"""Utilities functions
+"""
+
+import marvin
+import time
+from marvin.remoteSSHClient import remoteSSHClient
+from marvin.cloudstackAPI import *
+from marvin import cloudstackConnection
+#from cloudstackConnection import cloudConnection
+from marvin import configGenerator
+import logging
+import string
+import random
+import imaplib
+import email
+import datetime
+
+
+def restart_mgmt_server(server):
+    """Restarts the management server"""
+
+    try:
+        # Get the SSH client
+        ssh = is_server_ssh_ready(
+                                  server["ipaddress"],
+                                  server["port"],
+                                  server["username"],
+                                  server["password"],
+                                )
+        result = ssh.execute("/etc/init.d/cloud-management restart")
+        res = str(result)
+        # Server Stop - OK
+        # Server Start - OK
+        if res.count("OK") != 2:
+            raise ("ErrorInReboot!")
+    except Exception as e:
+        raise e
+    return
+
+
+def fetch_latest_mail(services, from_mail):
+    """Fetch mail"""
+
+    # Login to mail server to verify email
+    mail = imaplib.IMAP4_SSL(services["server"])
+    mail.login(
+                   services["email"],
+                   services["password"]
+                   )
+    mail.list()
+    mail.select(services["folder"])
+    date = (datetime.date.today() - datetime.timedelta(1)).strftime("%d-%b-%Y")
+
+    result, data = mail.uid(
+            'search',
+            None,
+            '(SENTSINCE {date} HEADER FROM "{mail}")'.format(
+                                                             date=date,
+                                                             mail=from_mail
+                                                             )
+            )
+    # Return False if email is not present
+    if data == []:
+        return False
+
+    latest_email_uid = data[0].split()[-1]
+    result, data = mail.uid('fetch', latest_email_uid, '(RFC822)')
+    raw_email = data[0][1]
+    email_message = email.message_from_string(raw_email)
+    result = get_first_text_block(email_message)
+    return result
+
+
+def get_first_text_block(email_message_instance):
+    """fetches first text block from the mail"""
+    maintype = email_message_instance.get_content_maintype()
+    if maintype == 'multipart':
+        for part in email_message_instance.get_payload():
+            if part.get_content_maintype() == 'text':
+                return part.get_payload()
+    elif maintype == 'text':
+        return email_message_instance.get_payload()
+
+
+def random_gen(size=6, chars=string.ascii_uppercase + string.digits):
+    """Generate Random Strings of variable length"""
+    return ''.join(random.choice(chars) for x in range(size))
+
+
+def cleanup_resources(api_client, resources):
+    """Delete resources"""
+    for obj in resources:
+        obj.delete(api_client)
+
+
+def is_server_ssh_ready(ipaddress, port, username, password, retries=50):
+    """Return ssh handle else wait till sshd is running"""
+    loop_cnt = retries
+    while True:
+        try:
+            ssh = remoteSSHClient(ipaddress, port, username, password)
+        except Exception as e:
+            if loop_cnt == 0:
+                raise e
+            loop_cnt = loop_cnt - 1
+            time.sleep(30)
+        else:
+            return ssh
+
+
+def format_volume_to_ext3(ssh_client, device="/dev/sda"):
+    """Format attached storage to ext3 fs"""
+    cmds = [
+            "echo -e 'n\np\n1\n\n\nw' | fdisk %s" % device,
+            "mkfs.ext3 %s1" % device,
+           ]
+    for c in cmds:
+        ssh_client.execute(c)
+
+
+def fetch_api_client(config_file='datacenterCfg'):
+    """Fetch the Cloudstack API Client"""
+    config = configGenerator.get_setup_config(config_file)
+    mgt = config.mgtSvr[0]
+    testClientLogger = logging.getLogger("testClient")
+    asyncTimeout = 3600
+    return cloudstackAPIClient.CloudStackAPIClient(
+            cloudstackConnection.cloudConnection(
+                                                mgt.mgtSvrIp,
+                                                mgt.port,
+                                                mgt.apiKey,
+                                                mgt.securityKey,
+                                                asyncTimeout,
+                                                testClientLogger
+                                                )
+                                            )
+
+
+def get_process_status(hostip, port, username, password, linklocalip, process):
+    """Double hop and returns a process status"""
+
+    #SSH to the machine
+    ssh = remoteSSHClient(hostip, port, username, password)
+    ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no "
+    ssh_command = ssh_command + \
+                    "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (
+                                                                linklocalip,
+                                                                process)
+
+    # Double hop into router
+    timeout = 5
+    # Ensure the SSH login is successful
+    while True:
+        res = ssh.execute(ssh_command)
+
+        if res[0] != "Host key verification failed.":
+            break
+        elif timeout == 0:
+            break
+
+        time.sleep(5)
+        timeout = timeout - 1
+    return res
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/README ./vogxn-asf-marvin-updates-f66caa0/test/integration/README
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/README	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/README	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,14 @@
+To run the tests - you should have marvin installed and correctly importable.
+The tests are long running and are best monitored by external hudson jobs.
+
+Also you will have to point marvin to the right configuration file that has
+details about your cloudstack deployment. For more help on how to write the
+config file check the tutorial at :
+
+
+http://docs.cloudstack.org/test_framework_1.0
+
+http://wiki.cloudstack.org/display/QA/Testing+with+python
+
+To run:
+$ python -m marvin.deployAndRun -c config.cfg -d integration/smoke -t testcase.log -r result.log -l
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/__init__.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/__init__.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/__init__.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/__init__.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,16 @@
+# 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.
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/README ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/README
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/README	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/README	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,41 @@
+Build Verification Testing (BVT) Cases
+--------------------------------------
+These test cases are the core functionality tests that ensure the application is stable and can be tested thoroughly.
+These BVT cases definitions are located at : https://docs.google.com/a/cloud.com/spreadsheet/ccc?key=0Ak8acbfxQG8ndEppOGZSLV9mUF9idjVkTkZkajhTZkE&invite=CPij0K0L
+
+
+Guidelines
+----------
+BVT test cases are being developed using Python's unittests2. Following are certain guidelines being followed
+    1. Tests exercised for the same resource should ideally be present under a single suite or file.
+
+    2. Time-consuming operations that create new cloud resources like server creation, volume creation etc 
+        should not necessarily be exercised per unit test. The resources can be shared by creating them at 
+        the class-level using setUpClass and shared across all instances during a single run.
+
+    3. Certain tests pertaining to NAT, Firewall and Load Balancing warrant fresh resources per test. Hence a call should be
+        taken by the stakeholders regarding sharing resources.
+
+    4. Ensure that the tearDown/tearDownClass functions clean up all the resources created during the test run. 
+
+For more information about unittests: http://docs.python.org/library/unittest.html
+
+
+BVT Tests
+----------
+The following files contain these BVT cases:
+
+1. test_vm_life_cycle.py - VM Life Cycle tests
+2. test_volumes.py - Volumes related tests
+3. test_snapshots.py - Snapshots related tests
+4. test_disk_offerings.py - Disk Offerings related tests
+5. test_service_offerings.py - Service Offerings related tests
+6. test_hosts.py - Hosts and Clusters related tests
+7. test_iso.py - ISO related tests
+8. test_network.py - Network related tests
+9. test_primary_storage.py - Primary storage related tests
+10. test_secondary_storage.py - Secondary storage related tests
+11. test_ssvm.py - SSVM & CPVM related tests
+12. test_templates.py - Templates related tests
+13. test_routers.py - Router related tests
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_disk_offerings.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_disk_offerings.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_disk_offerings.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_disk_offerings.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,220 @@
+# 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.
+""" BVT tests for Disk offerings"""
+
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+
+class Services:
+    """Test Disk offerings Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "off": {
+                                        "name": "Disk offering",
+                                        "displaytext": "Disk offering",
+                                        "disksize": 1   # in GB
+                                },
+                         }
+
+class TestCreateDiskOffering(cloudstackTestCase):
+
+    def setUp(self):
+        self.services = Services().services
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+    def test_01_create_disk_offering(self):
+        """Test to create disk offering"""
+
+        # Validate the following:
+        # 1. createDiskOfferings should return valid info for new offering
+        # 2. The Cloud Database contains the valid information
+
+        disk_offering = DiskOffering.create(
+                                        self.apiclient,
+                                        self.services["off"]
+                                        )
+        self.cleanup.append(disk_offering)
+
+        self.debug("Created Disk offering with ID: %s" % disk_offering.id)
+
+        list_disk_response = list_disk_offering(
+                                                self.apiclient,
+                                                id=disk_offering.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_disk_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_disk_response),
+                            0,
+                            "Check Disk offering is created"
+                        )
+        disk_response = list_disk_response[0]
+
+        self.assertEqual(
+                            disk_response.displaytext,
+                            self.services["off"]["displaytext"],
+                            "Check server id in createServiceOffering"
+                        )
+        self.assertEqual(
+                            disk_response.name,
+                            self.services["off"]["name"],
+                            "Check name in createServiceOffering"
+                        )
+        return
+
+
+class TestDiskOfferings(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
+        cls.disk_offering_1 = DiskOffering.create(
+                                                  cls.api_client,
+                                                  cls.services["off"]
+                                                  )
+        cls.disk_offering_2 = DiskOffering.create(
+                                                  cls.api_client,
+                                                  cls.services["off"]
+                                                  )
+        cls._cleanup = [cls.disk_offering_1]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+    def test_02_edit_disk_offering(self):
+        """Test to update existing disk offering"""
+
+        # Validate the following:
+        # 1. updateDiskOffering should return
+        #    a valid information for newly created offering
+
+        #Generate new name & displaytext from random data
+        random_displaytext = random_gen()
+        random_name = random_gen()
+
+        self.debug("Updating Disk offering with ID: %s" % 
+                                    self.disk_offering_1.id)
+        
+        cmd = updateDiskOffering.updateDiskOfferingCmd()
+        cmd.id = self.disk_offering_1.id
+        cmd.displaytext = random_displaytext
+        cmd.name = random_name
+
+        self.apiclient.updateDiskOffering(cmd)
+
+        list_disk_response = list_disk_offering(
+                                                self.apiclient,
+                                                id=self.disk_offering_1.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_disk_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_disk_response),
+                            0,
+                            "Check disk offering is updated"
+                        )
+
+        disk_response = list_disk_response[0]
+
+        self.assertEqual(
+                        disk_response.displaytext,
+                        random_displaytext,
+                        "Check service displaytext in updateServiceOffering"
+                        )
+        self.assertEqual(
+                        disk_response.name,
+                        random_name,
+                        "Check service name in updateServiceOffering"
+                        )
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+    def test_03_delete_disk_offering(self):
+        """Test to delete disk offering"""
+
+        # Validate the following:
+        # 1. deleteDiskOffering should return
+        #    a valid information for newly created offering
+
+        self.disk_offering_2.delete(self.apiclient)
+
+        self.debug("Deleted Disk offering with ID: %s" % 
+                                    self.disk_offering_2.id)
+        list_disk_response = list_disk_offering(
+                                                self.apiclient,
+                                                id=self.disk_offering_2.id
+                                                )
+
+        self.assertEqual(
+                        list_disk_response,
+                        None,
+                        "Check if disk offering exists in listDiskOfferings"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_hosts.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_hosts.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_hosts.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_hosts.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,229 @@
+# 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.
+""" BVT tests for Hosts and Clusters
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+
+#Import System modules
+import time
+
+class Services:
+    """Test Hosts & Clusters Services
+    """
+
+    def __init__(self):
+        self.services = {
+                       "clusters": {
+                                   0: {
+                                        "clustername": "Xen Cluster",
+                                        "clustertype": "CloudManaged",
+                                        # CloudManaged or ExternalManaged"
+                                        "hypervisor": "XenServer",
+                                        # Hypervisor type
+                                    },
+                                   1: {
+                                        "clustername": "KVM Cluster",
+                                        "clustertype": "CloudManaged",
+                                        # CloudManaged or ExternalManaged"
+                                        "hypervisor": "KVM",
+                                        # Hypervisor type
+                                        },
+                                   2: {
+                                        "hypervisor": 'VMware',
+                                        # Hypervisor type
+                                        "clustertype": 'ExternalManaged',
+                                        # CloudManaged or ExternalManaged"
+                                        "username": 'administrator',
+                                        "password": 'fr3sca',
+                                        "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1',
+                                        # Format:http://vCenter Host/Datacenter/Cluster
+                                        "clustername": 'VMWare Cluster',
+                                        },
+                                    },
+                       "hosts": {
+                                 "xenserver": {
+                                # Must be name of corresponding Hypervisor type
+                                # in cluster in small letters
+                                          "hypervisor": 'XenServer',
+                                          # Hypervisor type
+                                          "clustertype": 'CloudManaged',
+                                          # CloudManaged or ExternalManaged"
+                                          "url": 'http://192.168.100.211',
+                                          "username": "root",
+                                          "password": "fr3sca",
+                                          },
+                                 "kvm": {
+                                          "hypervisor": 'KVM',
+                                          # Hypervisor type
+                                          "clustertype": 'CloudManaged',
+                                          # CloudManaged or ExternalManaged"
+                                          "url": 'http://192.168.100.212',
+                                          "username": "root",
+                                          "password": "fr3sca",
+                                          },
+                                 "vmware": {
+                                          "hypervisor": 'VMware',
+                                          # Hypervisor type
+                                          "clustertype": 'ExternalManaged',
+                                          # CloudManaged or ExternalManaged"
+                                          "url": 'http://192.168.100.203',
+                                          "username": "administrator",
+                                          "password": "fr3sca",
+                                         },
+                                 },
+                       }
+
+class TestHosts(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        self.zone = get_zone(self.apiclient, self.services)
+        self.pod = get_pod(self.apiclient, self.zone.id, self.services)
+        self.cleanup = []
+
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @unittest.skip("skipped - our environments will not add hosts")
+    def test_01_clusters(self):
+        """Test Add clusters & hosts - XEN, KVM, VWARE
+        """
+
+        # Validate the following:
+        # 1. Verify hypervisortype returned by API is Xen/KVM/VWare
+        # 2. Verify that the cluster is in 'Enabled' allocation state
+        # 3. Verify that the host is added successfully and in Up state
+        #    with listHosts API response
+
+        #Create clusters with Hypervisor type XEN/KVM/VWare
+        for k, v in self.services["clusters"].items():
+            cluster = Cluster.create(
+                                     self.apiclient,
+                                     v,
+                                     zoneid=self.zone.id,
+                                     podid=self.pod.id
+                                     )
+            self.debug(
+                "Created Cluster for hypervisor type %s & ID: %s" %(
+                                                                    v["hypervisor"],
+                                                                    cluster.id     
+                                                                    ))
+            self.assertEqual(
+                    cluster.hypervisortype,
+                    v["hypervisor"],
+                    "Check hypervisor type is " + v["hypervisor"] + " or not"
+                    )
+            self.assertEqual(
+                    cluster.allocationstate,
+                    'Enabled',
+                    "Check whether allocation state of cluster is enabled"
+                    )
+
+            #If host is externally managed host is already added with cluster
+            response = list_hosts(
+                           self.apiclient,
+                           clusterid=cluster.id
+                           )
+
+            if not response:
+                hypervisor_type = str(cluster.hypervisortype.lower())
+                host = Host.create(
+                               self.apiclient,
+                               cluster,
+                               self.services["hosts"][hypervisor_type],
+                               zoneid=self.zone.id,
+                               podid=self.pod.id
+                               )
+                self.debug(
+                    "Created host (ID: %s) in cluster ID %s" %(
+                                                                host.id,
+                                                                cluster.id
+                                                                ))
+
+            #Cleanup Host & Cluster
+            self.cleanup.append(host)
+            self.cleanup.append(cluster)
+
+            list_hosts_response = list_hosts(
+                           self.apiclient,
+                           clusterid=cluster.id
+                           )
+            self.assertEqual(
+                            isinstance(list_hosts_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            self.assertNotEqual(
+                            len(list_hosts_response),
+                            0,
+                            "Check list Hosts response"
+                        )
+
+            host_response = list_hosts_response[0]
+            #Check if host is Up and running
+            self.assertEqual(
+                            host_response.state,
+                            'Up',
+                            "Check if state of host is Up or not"
+                        )
+            #Verify List Cluster Response has newly added cluster
+            list_cluster_response = list_clusters(
+                                                  self.apiclient,
+                                                  id=cluster.id
+                                                  )
+            self.assertEqual(
+                            isinstance(list_cluster_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            self.assertNotEqual(
+                            len(list_cluster_response),
+                            0,
+                            "Check list Hosts response"
+                        )
+
+            cluster_response = list_cluster_response[0]
+            self.assertEqual(
+                            cluster_response.id,
+                            cluster.id,
+                            "Check cluster ID with list clusters response"
+                        )
+            self.assertEqual(
+                cluster_response.hypervisortype,
+                cluster.hypervisortype,
+                "Check hypervisor type with is " + v["hypervisor"] + " or not"
+                )
+        return
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_iso.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_iso.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_iso.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_iso.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,510 @@
+# 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.
+""" BVT tests for Templates ISO
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+import urllib
+from random import random
+#Import System modules
+import time
+
+
+class Services:
+    """Test ISO Services
+    """
+
+    def __init__(self):
+        self.services = {
+            "account": {
+                        "email": "test@test.com",
+                        "firstname": "Test",
+                        "lastname": "User",
+                        "username": "test",
+                        # Random characters are appended in create account to 
+                        # ensure unique username generated each time
+                        "password": "password",
+                },
+            "iso_1":
+                    {
+                        "displaytext": "Test ISO 1",
+                        "name": "ISO 1",
+                        "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                        # Source URL where ISO is located
+                        "isextractable": True,
+                        "isfeatured": True,
+                        "ispublic": True,
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                    },
+            "iso_2":
+                    {
+                        "displaytext": "Test ISO 2",
+                        "name": "ISO 2",
+                        "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                        # Source URL where ISO is located
+                        "isextractable": True,
+                        "isfeatured": True,
+                        "ispublic": True,
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "mode": 'HTTP_DOWNLOAD',
+                        # Used in Extract template, value must be HTTP_DOWNLOAD
+                    },
+            "destzoneid": 5,
+            # Copy ISO from one zone to another (Destination Zone)
+            "isfeatured": True,
+            "ispublic": True,
+            "isextractable": True,
+            "bootable": True, # For edit template
+            "passwordenabled": True,
+            "sleep": 60,
+            "timeout": 10,
+            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            # CentOS 5.3 (64 bit)
+            "mode": 'advanced'
+            # Networking mode: Basic or Advanced
+        }
+
+
+class TestCreateIso(cloudstackTestCase):
+
+    def setUp(self):
+        self.services = Services().services
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+        self.services["domainid"] = self.domain.id
+        self.services["iso_2"]["zoneid"] = self.zone.id
+        
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+        
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+
+            self.dbclient.close()
+            #Clean up, terminate the created ISOs
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"])
+    def test_01_create_iso(self):
+        """Test create public & private ISO
+        """
+
+        # Validate the following:
+        # 1. database (vm_template table) should be
+        #    updated with newly created ISO
+        # 2. UI should show the newly added ISO
+        # 3. listIsos API should show the newly added ISO
+
+        iso = Iso.create(
+                         self.apiclient, 
+                         self.services["iso_2"],
+                         account=self.account.account.name,
+                         domainid=self.account.account.domainid
+                         )
+        self.debug("ISO created with ID: %s" % iso.id)
+        
+        try:
+            iso.download(self.apiclient)
+        except Exception as e:
+            self.fail("Exception while downloading ISO %s: %s"\
+                      % (iso.id, e))
+
+        list_iso_response = list_isos(
+                                      self.apiclient,
+                                      id=iso.id
+                                      )
+        self.assertEqual(
+                            isinstance(list_iso_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_iso_response),
+                            0,
+                            "Check template available in List ISOs"
+                        )
+        iso_response = list_iso_response[0]
+        
+        self.assertEqual(
+                            iso_response.displaytext,
+                            self.services["iso_2"]["displaytext"],
+                            "Check display text of newly created ISO"
+                        )
+        self.assertEqual(
+                            iso_response.name,
+                            self.services["iso_2"]["name"],
+                            "Check name of newly created ISO"
+                        )
+        self.assertEqual(
+                            iso_response.zoneid,
+                            self.services["iso_2"]["zoneid"],
+                            "Check zone ID of newly created ISO"
+                        )
+        return
+
+
+class TestISO(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestISO, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        
+        cls.services["domainid"] = cls.domain.id
+        cls.services["iso_1"]["zoneid"] = cls.zone.id
+        cls.services["iso_2"]["zoneid"] = cls.zone.id
+        cls.services["sourcezoneid"] = cls.zone.id
+
+        #Create an account, ISOs etc.
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+        cls.iso_1 = Iso.create(
+                               cls.api_client, 
+                               cls.services["iso_1"],
+                               account=cls.account.account.name,
+                               domainid=cls.account.account.domainid
+                               )
+        try:
+            cls.iso_1.download(cls.api_client)
+        except Exception as e:
+            raise Exception("Exception while downloading ISO %s: %s"\
+                      % (cls.iso_1.id, e))
+            
+        cls.iso_2 = Iso.create(
+                               cls.api_client, 
+                               cls.services["iso_2"],
+                               account=cls.account.account.name,
+                               domainid=cls.account.account.domainid
+                               )
+        try:
+            cls.iso_2.download(cls.api_client)
+        except Exception as e:
+            raise Exception("Exception while downloading ISO %s: %s"\
+                      % (cls.iso_2.id, e))
+            
+        cls._cleanup = [cls.account]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestISO, cls).getClsTestClient().getApiClient()
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created ISOs, VMs
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"])
+    def test_02_edit_iso(self):
+        """Test Edit ISO
+        """
+
+        # Validate the following:
+        # 1. UI should show the edited values for ISO
+        # 2. database (vm_template table) should have updated values
+
+        #Generate random values for updating ISO name and Display text
+        new_displayText = random_gen()
+        new_name = random_gen()
+
+        self.debug("Updating ISO permissions for ISO: %s" % self.iso_1.id)
+        
+        cmd = updateIso.updateIsoCmd()
+        #Assign new values to attributes
+        cmd.id = self.iso_1.id
+        cmd.displaytext = new_displayText
+        cmd.name = new_name
+        cmd.bootable = self.services["bootable"]
+        cmd.passwordenabled = self.services["passwordenabled"]
+
+        self.apiclient.updateIso(cmd)
+
+        #Check whether attributes are updated in ISO using listIsos
+        list_iso_response = list_isos(
+                                      self.apiclient,
+                                      id=self.iso_1.id
+                                      )
+        self.assertEqual(
+                            isinstance(list_iso_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_iso_response),
+                            0,
+                            "Check template available in List ISOs"
+                        )
+
+        iso_response = list_iso_response[0]
+        self.assertEqual(
+                            iso_response.displaytext,
+                            new_displayText,
+                            "Check display text of updated ISO"
+                        )
+        self.assertEqual(
+                            iso_response.name,
+                            new_name,
+                            "Check name of updated ISO"
+                        )
+        self.assertEqual(
+                            iso_response.bootable,
+                            self.services["bootable"],
+                            "Check if image is bootable of updated ISO"
+                        )
+
+        self.assertEqual(
+                            iso_response.ostypeid,
+                            self.services["ostypeid"],
+                            "Check OSTypeID of updated ISO"
+                        )
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"])
+    def test_03_delete_iso(self):
+        """Test delete ISO
+        """
+
+        # Validate the following:
+        # 1. UI should not show the deleted ISP
+        # 2. database (vm_template table) should not contain deleted ISO
+
+        self.debug("Deleting ISO with ID: %s" % self.iso_1.id)
+        self.iso_1.delete(self.apiclient)
+
+        # Sleep to ensure that ISO state is reflected in other calls
+        time.sleep(self.services["sleep"])
+
+        #ListIsos to verify deleted ISO is properly deleted
+        list_iso_response = list_isos(
+                                      self.apiclient,
+                                      id=self.iso_1.id
+                                      )
+
+        self.assertEqual(
+                         list_iso_response,
+                         None,
+                         "Check if ISO exists in ListIsos"
+                         )
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"])
+    def test_04_extract_Iso(self):
+        "Test for extract ISO"
+
+        # Validate the following
+        # 1. Admin should able  extract and download the ISO
+        # 2. ListIsos should display all the public templates
+        #    for all kind of users
+        # 3 .ListIsos should not display the system templates
+
+        self.debug("Extracting ISO with ID: %s" % self.iso_2.id)
+        
+        cmd = extractIso.extractIsoCmd()
+        cmd.id = self.iso_2.id
+        cmd.mode = self.services["iso_2"]["mode"]
+        cmd.zoneid = self.services["iso_2"]["zoneid"]
+        list_extract_response = self.apiclient.extractIso(cmd)
+
+        try:
+            #Format URL to ASCII to retrieve response code
+            formatted_url = urllib.unquote_plus(list_extract_response.url)
+            url_response = urllib.urlopen(formatted_url)
+            response_code = url_response.getcode()
+        except Exception:
+            self.fail(
+                "Extract ISO Failed with invalid URL %s (ISO id: %s)" \
+                % (formatted_url, self.iso_2.id)
+            )
+
+        self.assertEqual(
+                            list_extract_response.id,
+                            self.iso_2.id,
+                            "Check ID of the downloaded ISO"
+                        )
+        self.assertEqual(
+                            list_extract_response.extractMode,
+                            self.services["iso_2"]["mode"],
+                            "Check mode of extraction"
+                        )
+        self.assertEqual(
+                            list_extract_response.zoneid,
+                            self.services["iso_2"]["zoneid"],
+                            "Check zone ID of extraction"
+                        )
+        self.assertEqual(
+                         response_code,
+                         200,
+                         "Check for a valid response of download URL"
+                         )
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"])
+    def test_05_iso_permissions(self):
+        """Update & Test for ISO permissions"""
+
+        # validate the following
+        # 1. listIsos returns valid permissions set for ISO
+        # 2. permission changes should be reflected in vm_template
+        #    table in database
+
+        self.debug("Updating permissions for ISO: %s" % self.iso_2.id)
+        
+        cmd = updateIsoPermissions.updateIsoPermissionsCmd()
+        cmd.id = self.iso_2.id
+        #Update ISO permissions
+        cmd.isfeatured = self.services["isfeatured"]
+        cmd.ispublic = self.services["ispublic"]
+        cmd.isextractable = self.services["isextractable"]
+        self.apiclient.updateIsoPermissions(cmd)
+
+        #Verify ListIsos have updated permissions for the ISO for normal user
+        list_iso_response = list_isos(
+                                      self.apiclient,
+                                      id=self.iso_2.id,
+                                      account=self.account.account.name,
+                                      domainid=self.account.account.domainid
+                                      )
+        self.assertEqual(
+                            isinstance(list_iso_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        
+        iso_response = list_iso_response[0]
+
+        self.assertEqual(
+                            iso_response.id,
+                            self.iso_2.id,
+                            "Check ISO ID"
+                        )
+        self.assertEqual(
+                            iso_response.ispublic,
+                            self.services["ispublic"],
+                            "Check ispublic permission of ISO"
+                        )
+
+        self.assertEqual(
+                            iso_response.isfeatured,
+                            self.services["isfeatured"],
+                            "Check isfeatured permission of ISO"
+                        )
+        return
+
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke", "multizone"])
+    def test_06_copy_iso(self):
+        """Test for copy ISO from one zone to another"""
+
+        #Validate the following
+        #1. copy ISO should be successful and secondary storage
+        #   should contain new copied ISO.
+
+        self.debug("Copy ISO from %s to %s" % (
+                                               self.zone.id,
+                                               self.services["destzoneid"]
+                                               ))
+        
+        cmd = copyIso.copyIsoCmd()
+        cmd.id = self.iso_2.id
+        cmd.destzoneid = self.services["destzoneid"]
+        cmd.sourcezoneid = self.zone.id
+        self.apiclient.copyIso(cmd)
+
+        #Verify ISO is copied to another zone using ListIsos
+        list_iso_response = list_isos(
+                                      self.apiclient,
+                                      id=self.iso_2.id,
+                                      zoneid=self.services["destzoneid"]
+                                      )
+        self.assertEqual(
+                            isinstance(list_iso_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_iso_response),
+                            0,
+                            "Check template extracted in List ISO"
+                        )
+        iso_response = list_iso_response[0]
+        
+        self.assertEqual(
+                            iso_response.id,
+                            self.iso_2.id,
+                            "Check ID of the downloaded ISO"
+                        )
+        self.assertEqual(
+                            iso_response.zoneid,
+                            self.services["destzoneid"],
+                            "Check zone ID of the copied ISO"
+                        )
+
+        self.debug("Cleanup copied ISO: %s" % iso_response.id)
+        # Cleanup- Delete the copied ISO
+        cmd = deleteIso.deleteIsoCmd()
+        cmd.id = iso_response.id
+        cmd.zoneid = self.services["destzoneid"]
+        self.apiclient.deleteIso(cmd)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_network.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_network.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_network.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_network.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1773 @@
+# 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.
+""" BVT tests for Network Life Cycle
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+#Import System modules
+import time
+
+
+class Services:
+    """Test Network Services
+    """
+
+    def __init__(self):
+        self.services = {
+                            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                            # Cent OS 5.3 (64 bit)
+                            "mode": 'advanced',
+                            # Networking mode: Basic or advanced
+                            "lb_switch_wait": 10,
+                            # Time interval after which LB switches the requests
+                            "sleep": 60,
+                            "timeout":10,
+                            "network_offering": {
+                                    "name": 'Test Network offering',
+                                    "displaytext": 'Test Network offering',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "serviceProviderList" : {
+                                            "Dhcp": 'VirtualRouter',
+                                            "Dns": 'VirtualRouter',
+                                            "SourceNat": 'VirtualRouter',
+                                            "PortForwarding": 'VirtualRouter',
+                                        },
+                                },
+                            "network": {
+                                  "name": "Test Network",
+                                  "displaytext": "Test Network",
+                                },
+                            "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    # in MHz
+                                    "memory": 256,
+                                    # In MBs
+                                    },
+                            "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    "password": "password",
+                                    },
+                            "server":
+                                    {
+                                    "displayname": "Small Instance",
+                                    "username": "root",
+                                    "password": "password",
+                                    "hypervisor": 'XenServer',
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "ssh_port": 22,
+                                    "protocol": 'TCP',
+                                },
+                        "natrule":
+                                {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                                },
+                        "lbrule":
+                                {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                                    "protocol": 'TCP'
+                                }
+                        }
+
+
+class TestPublicIP(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestPublicIP, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        # Create Accounts & networks
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["network"]["zoneid"] = cls.zone.id
+
+        cls.network_offering = NetworkOffering.create(
+                                    cls.api_client,
+                                    cls.services["network_offering"],
+                                    )
+        # Enable Network offering
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.services["network"]["networkoffering"] = cls.network_offering.id
+        cls.account_network = Network.create(
+                                             cls.api_client,
+                                             cls.services["network"],
+                                             cls.account.account.name,
+                                             cls.account.account.domainid
+                                             )
+        cls.user_network = Network.create(
+                                             cls.api_client,
+                                             cls.services["network"],
+                                             cls.user.account.name,
+                                             cls.user.account.domainid
+                                             )
+
+        # Create Source NAT IP addresses
+        account_src_nat_ip = PublicIPAddress.create(
+                                            cls.api_client,
+                                            cls.account.account.name,
+                                            cls.zone.id,
+                                            cls.account.account.domainid
+                                            )
+        user_src_nat_ip = PublicIPAddress.create(
+                                            cls.api_client,
+                                            cls.user.account.name,
+                                            cls.zone.id,
+                                            cls.user.account.domainid
+                                            )
+        cls._cleanup = [
+                        cls.account_network,
+                        cls.user_network,
+                        cls.account,
+                        cls.user,
+                        cls.network_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_public_ip_admin_account(self):
+        """Test for Associate/Disassociate
+        public IP address for admin account"""
+
+        # Validate the following:
+        # 1. listPubliIpAddresses API returns the list of acquired addresses
+        # 2. the returned list should contain our acquired IP address
+
+        ip_address = PublicIPAddress.create(
+                                            self.apiclient,
+                                            self.account.account.name,
+                                            self.zone.id,
+                                            self.account.account.domainid
+                                            )
+        list_pub_ip_addr_resp = list_publicIP(
+                                              self.apiclient,
+                                              id=ip_address.ipaddress.id
+                                              )
+        self.assertEqual(
+                            isinstance(list_pub_ip_addr_resp, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #listPublicIpAddresses should return newly created public IP
+        self.assertNotEqual(
+                            len(list_pub_ip_addr_resp),
+                            0,
+                            "Check if new IP Address is associated"
+                            )
+        self.assertEqual(
+                    list_pub_ip_addr_resp[0].id,
+                    ip_address.ipaddress.id,
+                    "Check Correct IP Address is returned in the List Cacls"
+                    )
+
+        ip_address.delete(self.apiclient)
+
+        # Validate the following:
+        # 1.listPublicIpAddresses should no more return the released address
+        list_pub_ip_addr_resp = list_publicIP(
+                                              self.apiclient,
+                                              id=ip_address.ipaddress.id
+                                              )
+        self.assertEqual(
+                    list_pub_ip_addr_resp,
+                    None,
+                    "Check if disassociated IP Address is no longer available"
+                    )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_public_ip_user_account(self):
+        """Test for Associate/Disassociate
+            public IP address for user account"""
+
+        # Validate the following:
+        # 1. listPubliIpAddresses API returns the list of acquired addresses
+        # 2. the returned list should contain our acquired IP address
+
+        ip_address = PublicIPAddress.create(
+                                            self.apiclient,
+                                            self.user.account.name,
+                                            self.zone.id,
+                                            self.user.account.domainid
+                                            )
+
+        #listPublicIpAddresses should return newly created public IP
+        list_pub_ip_addr_resp = list_publicIP(
+                                              self.apiclient,
+                                              id=ip_address.ipaddress.id
+                                              )
+        self.assertEqual(
+                            isinstance(list_pub_ip_addr_resp, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_pub_ip_addr_resp),
+                            0,
+                            "Check if new IP Address is associated"
+                            )
+        self.assertEqual(
+                        list_pub_ip_addr_resp[0].id,
+                        ip_address.ipaddress.id,
+                        "Check Correct IP Address is returned in the List Call"
+                        )
+
+        ip_address.delete(self.apiclient)
+
+        list_pub_ip_addr_resp = list_publicIP(
+                                              self.apiclient,
+                                              id=ip_address.ipaddress.id
+                                              )
+
+        self.assertEqual(
+                    list_pub_ip_addr_resp,
+                    None,
+                    "Check if disassociated IP Address is no longer available"
+                    )
+        return
+
+
+class TestPortForwarding(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestPortForwarding, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                admin=True,
+                                domainid=cls.domain.id
+                                )
+        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.service_offering = ServiceOffering.create(
+                                cls.api_client,
+                                cls.services["service_offering"]
+                                )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                )
+        cls._cleanup = [
+                        cls.virtual_machine,
+                        cls.account,
+                        cls.service_offering
+                        ]
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestPortForwarding, cls).getClsTestClient().getApiClient()
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_01_port_fwd_on_src_nat(self):
+        """Test for port forwarding on source NAT"""
+
+        #Validate the following:
+        #1. listPortForwarding rules API should return the added PF rule
+        #2. attempt to do an ssh into the  user VM through the sourceNAT
+
+        src_nat_ip_addrs = list_publicIP(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                  )
+
+        self.assertEqual(
+                            isinstance(src_nat_ip_addrs, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        src_nat_ip_addr = src_nat_ip_addrs[0]
+
+        # Check if VM is in Running state before creating NAT rule
+        vm_response = VirtualMachine.list(
+                                          self.apiclient,
+                                          id=self.virtual_machine.id
+                                          )
+
+        self.assertEqual(
+                            isinstance(vm_response, list),
+                            True,
+                            "Check list VM returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        self.assertEqual(
+                            vm_response[0].state,
+                            'Running',
+                            "VM state should be Running before creating a NAT rule."
+                        )
+        # Open up firewall port for SSH        
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=src_nat_ip_addr.id,
+                            protocol=self.services["natrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=self.services["natrule"]["publicport"],
+                            endport=self.services["natrule"]["publicport"]
+                            )
+
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                        self.apiclient,
+                        self.virtual_machine,
+                        self.services["natrule"],
+                        src_nat_ip_addr.id
+                        )
+
+        list_nat_rule_response = list_nat_rules(
+                                                self.apiclient,
+                                                id=nat_rule.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_nat_rule_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_nat_rule_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        self.assertEqual(
+                            list_nat_rule_response[0].id,
+                            nat_rule.id,
+                            "Check Correct Port forwarding Rule is returned"
+                        )
+        #SSH virtual machine to test port forwarding
+        try:
+            self.debug("SSHing into VM with IP address %s with NAT IP %s" %
+                                    (
+                                     self.virtual_machine.ipaddress,
+                                     src_nat_ip_addr.ipaddress
+                                    ))
+
+            self.virtual_machine.get_ssh_client(src_nat_ip_addr.ipaddress)
+
+        except Exception as e:
+            self.fail(
+                      "SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        nat_rule.delete(self.apiclient)
+
+        list_nat_rule_response = list_nat_rules(
+                                                self.apiclient,
+                                                id=nat_rule.id
+                                                )
+
+        self.assertEqual(
+                            list_nat_rule_response,
+                            None,
+                            "Check Port Forwarding Rule is deleted"
+                            )
+        # Check if the Public SSH port is inaccessible
+        with self.assertRaises(Exception):
+            self.debug(
+                "SSHing into VM with IP address %s after NAT rule deletion" %
+                                                 self.virtual_machine.ipaddress)
+
+            remoteSSHClient(
+                                            src_nat_ip_addr.ipaddress,
+                                            self.virtual_machine.ssh_port,
+                                            self.virtual_machine.username,
+                                            self.virtual_machine.password
+                                            )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_02_port_fwd_on_non_src_nat(self):
+        """Test for port forwarding on non source NAT"""
+
+        #Validate the following:
+        #1. listPortForwardingRules should not return the deleted rule anymore
+        #2. attempt to do ssh should now fail
+
+        ip_address = PublicIPAddress.create(
+                                            self.apiclient,
+                                            self.account.account.name,
+                                            self.zone.id,
+                                            self.account.account.domainid,
+                                            self.services["server"]
+                                            )
+        self.cleanup.append(ip_address)
+
+        # Check if VM is in Running state before creating NAT rule
+        vm_response = VirtualMachine.list(
+                                          self.apiclient,
+                                          id=self.virtual_machine.id
+                                          )
+
+        self.assertEqual(
+                            isinstance(vm_response, list),
+                            True,
+                            "Check list VM returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        self.assertEqual(
+                            vm_response[0].state,
+                            'Running',
+                            "VM state should be Running before creating a NAT rule."
+                        )
+        # Open up firewall port for SSH        
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=ip_address.ipaddress.id,
+                            protocol=self.services["natrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=self.services["natrule"]["publicport"],
+                            endport=self.services["natrule"]["publicport"]
+                            )
+        #Create NAT rule
+        nat_rule = NATRule.create(
+                                  self.apiclient,
+                                  self.virtual_machine,
+                                  self.services["natrule"],
+                                  ip_address.ipaddress.id
+                                  )
+        #Validate the following:
+        #1. listPortForwardingRules should not return the deleted rule anymore
+        #2. attempt to do ssh should now fail
+
+        list_nat_rule_response = list_nat_rules(
+                                                self.apiclient,
+                                                id=nat_rule.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_nat_rule_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_nat_rule_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        self.assertEqual(
+                            list_nat_rule_response[0].id,
+                            nat_rule.id,
+                            "Check Correct Port forwarding Rule is returned"
+                        )
+
+        try:
+            self.debug("SSHing into VM with IP address %s with NAT IP %s" %
+                                    (
+                                     self.virtual_machine.ipaddress,
+                                     ip_address.ipaddress.ipaddress
+                                    ))
+            self.virtual_machine.get_ssh_client(ip_address.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail(
+                      "SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+
+        nat_rule.delete(self.apiclient)
+
+        list_nat_rule_response = list_nat_rules(
+                                                self.apiclient,
+                                                id=nat_rule.id
+                                                )
+        self.assertEqual(
+                            list_nat_rule_response,
+                            None,
+                            "Check Port Forwarding Rule is deleted"
+                            )
+        # Check if the Public SSH port is inaccessible
+        with self.assertRaises(Exception):
+            self.debug(
+                "SSHing into VM with IP address %s after NAT rule deletion" %
+                                                 self.virtual_machine.ipaddress)
+
+            remoteSSHClient(
+                                            ip_address.ipaddress.ipaddress,
+                                            self.virtual_machine.ssh_port,
+                                            self.virtual_machine.username,
+                                            self.virtual_machine.password
+                                            )
+        return
+
+
+class TestLoadBalancingRule(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(TestLoadBalancingRule, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["server"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+        cls.service_offering = ServiceOffering.create(
+                                        cls.api_client,
+                                        cls.services["service_offering"]
+                                        )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.vm_2 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.non_src_nat_ip = PublicIPAddress.create(
+                                            cls.api_client,
+                                            cls.account.account.name,
+                                            cls.zone.id,
+                                            cls.account.account.domainid,
+                                            cls.services["server"]
+                                            )
+        # Open up firewall port for SSH        
+        cls.fw_rule = FireWallRule.create(
+                            cls.api_client,
+                            ipaddressid=cls.non_src_nat_ip.ipaddress.id,
+                            protocol=cls.services["lbrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=cls.services["lbrule"]["publicport"],
+                            endport=cls.services["lbrule"]["publicport"]
+                            )
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        cleanup_resources(cls.api_client, cls._cleanup)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_01_create_lb_rule_src_nat(self):
+        """Test to create Load balancing rule with source NAT"""
+
+        # Validate the Following:
+        #1. listLoadBalancerRules should return the added rule
+        #2. attempt to ssh twice on the load balanced IP
+        #3. verify using the hostname of the VM
+        #   that round robin is indeed happening as expected
+
+        src_nat_ip_addrs = list_publicIP(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                  )
+        self.assertEqual(
+                            isinstance(src_nat_ip_addrs, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        src_nat_ip_addr = src_nat_ip_addrs[0]
+
+        # Check if VM is in Running state before creating LB rule
+        vm_response = VirtualMachine.list(
+                                          self.apiclient,
+                                          account=self.account.account.name,
+                                          domainid=self.account.account.domainid
+                                          )
+
+        self.assertEqual(
+                            isinstance(vm_response, list),
+                            True,
+                            "Check list VM returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        for vm in vm_response:
+            self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "VM state should be Running before creating a NAT rule."
+                        )
+
+        #Create Load Balancer rule and assign VMs to rule
+        lb_rule = LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          src_nat_ip_addr.id,
+                                          accountid=self.account.account.name
+                                          )
+        self.cleanup.append(lb_rule)
+
+        lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2])
+
+        lb_rules = list_lb_rules(
+                                 self.apiclient,
+                                 id=lb_rule.id
+                                 )
+        self.assertEqual(
+                            isinstance(lb_rules, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #verify listLoadBalancerRules lists the added load balancing rule
+        self.assertNotEqual(
+                            len(lb_rules),
+                            0,
+                            "Check Load Balancer Rule in its List"
+                        )
+        self.assertEqual(
+                            lb_rules[0].id,
+                            lb_rule.id,
+                            "Check List Load Balancer Rules returns valid Rule"
+                        )
+
+        # listLoadBalancerRuleInstances should list all
+        # instances associated with that LB rule
+        lb_instance_rules = list_lb_instances(
+                                              self.apiclient,
+                                              id=lb_rule.id
+                                              )
+        self.assertEqual(
+                            isinstance(lb_instance_rules, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(lb_instance_rules),
+                            0,
+                            "Check Load Balancer instances Rule in its List"
+                        )
+        self.debug("lb_instance_rules Ids: %s, %s" % (
+                                                    lb_instance_rules[0].id,
+                                                    lb_instance_rules[1].id
+                                                    ))
+        self.debug("VM ids: %s, %s" % (self.vm_1.id, self.vm_2.id))
+
+        self.assertIn(
+                lb_instance_rules[0].id,
+                [self.vm_1.id, self.vm_2.id],
+                "Check List Load Balancer instances Rules returns valid VM ID"
+            )
+
+        self.assertIn(
+            lb_instance_rules[1].id,
+            [self.vm_1.id, self.vm_2.id],
+            "Check List Load Balancer instances Rules returns valid VM ID"
+            )
+        try:
+            self.debug(
+                "SSH into VM (IPaddress: %s) & NAT Rule (Public IP: %s)" %
+                (self.vm_1.ipaddress, src_nat_ip_addr.ipaddress)
+                )
+
+            ssh_1 = remoteSSHClient(
+                                        src_nat_ip_addr.ipaddress,
+                                        self.services['lbrule']["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+
+            # If Round Robin Algorithm is chosen,
+            # each ssh command should alternate between VMs
+            hostnames = [ssh_1.execute("hostname")[0]]
+
+        except Exception as e:
+            self.fail("%s: SSH failed for VM with IP Address: %s" %
+                                        (e, src_nat_ip_addr.ipaddress))
+
+        time.sleep(self.services["lb_switch_wait"])
+
+        try:
+            self.debug("SSHing into IP address: %s after adding VMs (ID: %s , %s)" %
+                                            (
+                                             src_nat_ip_addr.ipaddress,
+                                             self.vm_1.id,
+                                             self.vm_2.id
+                                             ))
+
+            ssh_2 = remoteSSHClient(
+                                        src_nat_ip_addr.ipaddress,
+                                        self.services['lbrule']["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+            hostnames.append(ssh_2.execute("hostname")[0])
+
+        except Exception as e:
+            self.fail("%s: SSH failed for VM with IP Address: %s" %
+                                        (e, src_nat_ip_addr.ipaddress))
+
+        self.debug("Hostnames: %s" % str(hostnames))
+        self.assertIn(
+                      self.vm_1.name,
+                      hostnames,
+                      "Check if ssh succeeded for server1"
+                    )
+        self.assertIn(
+                      self.vm_2.name,
+                      hostnames,
+                      "Check if ssh succeeded for server2"
+                      )
+
+        #SSH should pass till there is a last VM associated with LB rule
+        lb_rule.remove(self.apiclient, [self.vm_2])
+        try:
+            self.debug("SSHing into IP address: %s after removing VM (ID: %s)" %
+                                            (
+                                             src_nat_ip_addr.ipaddress,
+                                             self.vm_2.id
+                                             ))
+
+            ssh_1 = remoteSSHClient(
+                                        src_nat_ip_addr.ipaddress,
+                                        self.services['lbrule']["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+
+            hostnames.append(ssh_1.execute("hostname")[0])
+
+        except Exception as e:
+            self.fail("%s: SSH failed for VM with IP Address: %s" %
+                                        (e, src_nat_ip_addr.ipaddress))
+
+        self.assertIn(
+                      self.vm_1.name,
+                      hostnames,
+                      "Check if ssh succeeded for server1"
+                      )
+
+        lb_rule.remove(self.apiclient, [self.vm_1])
+
+        with self.assertRaises(Exception):
+            self.debug("Removed all VMs, trying to SSH")
+            ssh_1 = remoteSSHClient(
+                                        src_nat_ip_addr.ipaddress,
+                                        self.services['lbrule']["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+            ssh_1.execute("hostname")[0]
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_02_create_lb_rule_non_nat(self):
+        """Test to create Load balancing rule with source NAT"""
+
+        # Validate the Following:
+        #1. listLoadBalancerRules should return the added rule
+        #2. attempt to ssh twice on the load balanced IP
+        #3. verify using the hostname of the VM that
+        #   round robin is indeed happening as expected
+
+        # Check if VM is in Running state before creating LB rule
+        vm_response = VirtualMachine.list(
+                                          self.apiclient,
+                                          account=self.account.account.name,
+                                          domainid=self.account.account.domainid
+                                          )
+
+        self.assertEqual(
+                            isinstance(vm_response, list),
+                            True,
+                            "Check list VM returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        for vm in vm_response:
+            self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "VM state should be Running before creating a NAT rule."
+                        )
+
+        #Create Load Balancer rule and assign VMs to rule
+        lb_rule = LoadBalancerRule.create(
+                                          self.apiclient,
+                                          self.services["lbrule"],
+                                          self.non_src_nat_ip.ipaddress.id,
+                                          accountid=self.account.account.name
+                                          )
+        self.cleanup.append(lb_rule)
+
+        lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2])
+
+        lb_rules = list_lb_rules(
+                                 self.apiclient,
+                                 id=lb_rule.id
+                                 )
+
+        self.assertEqual(
+                            isinstance(lb_rules, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #verify listLoadBalancerRules lists the added load balancing rule
+        self.assertNotEqual(
+                            len(lb_rules),
+                            0,
+                            "Check Load Balancer Rule in its List"
+                        )
+        self.assertEqual(
+                            lb_rules[0].id,
+                            lb_rule.id,
+                            "Check List Load Balancer Rules returns valid Rule"
+                        )
+        # listLoadBalancerRuleInstances should list
+        # all instances associated with that LB rule
+        lb_instance_rules = list_lb_instances(
+                                              self.apiclient,
+                                              id=lb_rule.id
+                                              )
+        self.assertEqual(
+                            isinstance(lb_instance_rules, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(lb_instance_rules),
+                            0,
+                            "Check Load Balancer instances Rule in its List"
+                        )
+
+        self.assertIn(
+                lb_instance_rules[0].id,
+                [self.vm_1.id, self.vm_2.id],
+                "Check List Load Balancer instances Rules returns valid VM ID"
+                            )
+
+        self.assertIn(
+                lb_instance_rules[1].id,
+                [self.vm_1.id, self.vm_2.id],
+                "Check List Load Balancer instances Rules returns valid VM ID"
+                )
+        try:
+            self.debug("SSHing into IP address: %s after adding VMs (ID: %s , %s)" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress.ipaddress,
+                                             self.vm_1.id,
+                                             self.vm_2.id
+                                             ))
+            ssh_1 = remoteSSHClient(
+                                    self.non_src_nat_ip.ipaddress.ipaddress,
+                                    self.services['lbrule']["publicport"],
+                                    self.vm_1.username,
+                                    self.vm_1.password
+                                    )
+
+            # If Round Robin Algorithm is chosen,
+            # each ssh command should alternate between VMs
+            hostnames = [ssh_1.execute("hostname")[0]]
+
+            time.sleep(self.services["lb_switch_wait"])
+
+            self.debug("SSHing again into IP address: %s with VMs (ID: %s , %s) added to LB rule" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress.ipaddress,
+                                             self.vm_1.id,
+                                             self.vm_2.id
+                                             ))
+            ssh_2 = remoteSSHClient(
+                                    self.non_src_nat_ip.ipaddress.ipaddress,
+                                    self.services['lbrule']["publicport"],
+                                    self.vm_1.username,
+                                    self.vm_1.password
+                                    )
+
+            hostnames.append(ssh_2.execute("hostname")[0])
+            self.debug("Hostnames after adding 2 VMs to LB rule: %s" % str(hostnames))
+            self.assertIn(
+                      self.vm_1.name,
+                      hostnames,
+                      "Check if ssh succeeded for server1"
+                      )
+            self.assertIn(
+                      self.vm_2.name,
+                      hostnames,
+                      "Check if ssh succeeded for server2"
+                      )
+
+            #SSH should pass till there is a last VM associated with LB rule
+            lb_rule.remove(self.apiclient, [self.vm_2])
+
+            self.debug("SSHing into IP address: %s after removing VM (ID: %s) from LB rule" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress.ipaddress,
+                                             self.vm_2.id
+                                             ))
+            ssh_1 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress.ipaddress,
+                                        self.services['lbrule']["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+
+            hostnames.append(ssh_1.execute("hostname")[0])
+            self.debug("Hostnames after removing VM2: %s" % str(hostnames))
+        except Exception as e:
+            self.fail("%s: SSH failed for VM with IP Address: %s" %
+                                        (e, self.non_src_nat_ip.ipaddress.ipaddress))
+
+        self.assertIn(
+                      self.vm_1.name,
+                      hostnames,
+                      "Check if ssh succeeded for server1"
+                      )
+
+        lb_rule.remove(self.apiclient, [self.vm_1])
+        with self.assertRaises(Exception):
+            self.fail("SSHing into IP address: %s after removing VM (ID: %s) from LB rule" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress.ipaddress,
+                                             self.vm_1.id
+                                             ))
+            ssh_1 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress.ipaddress,
+                                        self.services['lbrule']["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+            ssh_1.execute("hostname")[0]
+        return
+
+
+class TestRebootRouter(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+        template = get_template(
+                            self.apiclient,
+                            self.zone.id,
+                            self.services["ostypeid"]
+                            )
+        self.services["server"]["zoneid"] = self.zone.id
+
+        #Create an account, network, VM and IP addresses
+        self.account = Account.create(
+                                      self.apiclient,
+                                      self.services["account"],
+                                      admin=True,
+                                      domainid=self.domain.id
+                                      )
+        self.service_offering = ServiceOffering.create(
+                                            self.apiclient,
+                                            self.services["service_offering"]
+                                            )
+        self.vm_1 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        src_nat_ip_addrs = list_publicIP(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                  )
+        try:
+            src_nat_ip_addr = src_nat_ip_addrs[0]
+        except Exception as e:
+            raise Exception("Warning: Exception during fetching source NAT: %s" % e)
+
+        self.public_ip = PublicIPAddress.create(
+                                           self.apiclient,
+                                           self.vm_1.account,
+                                           self.vm_1.zoneid,
+                                           self.vm_1.domainid,
+                                           self.services["server"]
+                                           )
+        # Open up firewall port for SSH        
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=self.public_ip.ipaddress.id,
+                            protocol=self.services["lbrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=self.services["lbrule"]["publicport"],
+                            endport=self.services["lbrule"]["publicport"]
+                            )
+
+        lb_rule = LoadBalancerRule.create(
+                                            self.apiclient,
+                                            self.services["lbrule"],
+                                            src_nat_ip_addr.id,
+                                            self.account.account.name
+                                        )
+        lb_rule.assign(self.apiclient, [self.vm_1])
+        self.nat_rule = NATRule.create(
+                                    self.apiclient,
+                                    self.vm_1,
+                                    self.services["natrule"],
+                                    ipaddressid=self.public_ip.ipaddress.id
+                                    )
+        self.cleanup = [
+                        self.vm_1,
+                        lb_rule,
+                        self.service_offering,
+                        self.nat_rule,
+                        self.account,
+                        ]
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_reboot_router(self):
+        """Test for reboot router"""
+
+        #Validate the Following
+        #1. Post restart PF and LB rules should still function
+        #2. verify if the ssh into the virtual machine
+        #   still works through the sourceNAT Ip
+
+        #Retrieve router for the user account
+        routers = list_routers(
+                                self.apiclient,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                               )
+        self.assertEqual(
+                            isinstance(routers, list),
+                            True,
+                            "Check list routers returns a valid list"
+                        )
+
+        router = routers[0]
+
+        self.debug("Rebooting the router (ID: %s)" % router.id)
+
+        cmd = rebootRouter.rebootRouterCmd()
+        cmd.id = router.id
+        self.apiclient.rebootRouter(cmd)
+
+        # Poll listVM to ensure VM is stopped properly
+        timeout = self.services["timeout"]
+
+        while True:
+            time.sleep(self.services["sleep"])
+
+            # Ensure that VM is in stopped state
+            list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.vm_1.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Running':
+                    self.debug("VM state: %s" % vm.state)
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to start VM (ID: %s) in change service offering" % vm.id)
+
+            timeout = timeout - 1
+
+        #we should be able to SSH after successful reboot
+        try:
+            self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id)
+
+            remoteSSHClient(
+                                    self.nat_rule.ipaddress,
+                                    self.services["natrule"]["publicport"],
+                                    self.vm_1.username,
+                                    self.vm_1.password
+                                    )
+        except Exception as e:
+            self.fail(
+                      "SSH Access failed for %s: %s" % \
+                      (self.vm_1.ipaddress, e)
+                      )
+        return
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+
+class TestAssignRemoveLB(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+        template = get_template(
+                            self.apiclient,
+                            self.zone.id,
+                            self.services["ostypeid"]
+                            )
+        self.services["server"]["zoneid"] = self.zone.id
+
+        #Create VMs, accounts
+        self.account = Account.create(
+                                      self.apiclient,
+                                      self.services["account"],
+                                      admin=True,
+                                      domainid=self.domain.id
+                                      )
+        self.service_offering = ServiceOffering.create(
+                                            self.apiclient,
+                                            self.services["service_offering"]
+                                        )
+
+        self.vm_1 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["server"],
+                                  templateid=template.id,
+                                  accountid=self.account.account.name,
+                                  domainid=self.account.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+
+        self.vm_2 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                              )
+
+        self.vm_3 = VirtualMachine.create(
+                                self.apiclient,
+                                self.services["server"],
+                                templateid=template.id,
+                                accountid=self.account.account.name,
+                                domainid=self.account.account.domainid,
+                                serviceofferingid=self.service_offering.id
+                              )
+
+        self.cleanup = [
+                        self.account,
+                        self.service_offering
+                        ]
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_assign_and_removal_lb(self):
+        """Test for assign & removing load balancing rule"""
+
+        # Validate:
+        #1. Verify list API - listLoadBalancerRules lists
+        #   all the rules with the relevant ports
+        #2. listLoadBalancerInstances will list
+        #   the instances associated with the corresponding rule.
+        #3. verify ssh attempts should pass as long as there
+        #   is at least one instance associated with the rule
+
+        src_nat_ip_addrs = list_publicIP(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                  )
+        self.assertEqual(
+                            isinstance(src_nat_ip_addrs, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.non_src_nat_ip = src_nat_ip_addrs[0]
+
+        # Open up firewall port for SSH        
+        fw_rule = FireWallRule.create(
+                            self.apiclient,
+                            ipaddressid=self.non_src_nat_ip.id,
+                            protocol=self.services["lbrule"]["protocol"],
+                            cidrlist=['0.0.0.0/0'],
+                            startport=self.services["lbrule"]["publicport"],
+                            endport=self.services["lbrule"]["publicport"]
+                            )
+
+        # Check if VM is in Running state before creating LB rule
+        vm_response = VirtualMachine.list(
+                                          self.apiclient,
+                                          account=self.account.account.name,
+                                          domainid=self.account.account.domainid
+                                          )
+
+        self.assertEqual(
+                            isinstance(vm_response, list),
+                            True,
+                            "Check list VM returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(vm_response),
+                            0,
+                            "Check Port Forwarding Rule is created"
+                            )
+        for vm in vm_response:
+            self.assertEqual(
+                            vm.state,
+                            'Running',
+                            "VM state should be Running before creating a NAT rule."
+                        )
+
+        lb_rule = LoadBalancerRule.create(
+                                self.apiclient,
+                                self.services["lbrule"],
+                                self.non_src_nat_ip.id,
+                                self.account.account.name
+                              )
+        lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2])
+
+        try:
+            self.debug("SSHing into IP address: %s with VMs (ID: %s , %s) added to LB rule" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress,
+                                             self.vm_1.id,
+                                             self.vm_2.id
+                                             ))
+            #Create SSH client for each VM
+            ssh_1 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress,
+                                        self.services["lbrule"]["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                    self.non_src_nat_ip.ipaddress)
+
+        try:
+            self.debug("SSHing again into IP address: %s with VMs (ID: %s , %s) added to LB rule" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress,
+                                             self.vm_1.id,
+                                             self.vm_2.id
+                                             ))
+            ssh_2 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress,
+                                        self.services["lbrule"]["publicport"],
+                                        self.vm_2.username,
+                                        self.vm_2.password
+                                        )
+
+            # If Round Robin Algorithm is chosen,
+            # each ssh command should alternate between VMs
+            res_1 = ssh_1.execute("hostname")[0]
+            self.debug(res_1)
+
+            time.sleep(self.services["lb_switch_wait"])
+
+            res_2 = ssh_2.execute("hostname")[0]
+            self.debug(res_2)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                    self.non_src_nat_ip.ipaddress)
+
+        self.assertIn(
+                      self.vm_1.name,
+                      res_1,
+                      "Check if ssh succeeded for server1"
+                      )
+        self.assertIn(
+                      self.vm_2.name,
+                      res_2,
+                      "Check if ssh succeeded for server2"
+                      )
+
+        #Removing VM and assigning another VM to LB rule
+        lb_rule.remove(self.apiclient, [self.vm_2])
+
+        try:
+            self.debug("SSHing again into IP address: %s with VM (ID: %s) added to LB rule" %
+                                            (
+                                             self.non_src_nat_ip.ipaddress,
+                                             self.vm_1.id,
+                                             ))
+            # Again make a SSH connection, as previous is not used after LB remove
+            ssh_1 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress,
+                                        self.services["lbrule"]["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+            res_1 = ssh_1.execute("hostname")[0]
+            self.debug(res_1)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                    self.non_src_nat_ip.ipaddress)
+
+        self.assertIn(
+                      self.vm_1.name,
+                      res_1,
+                      "Check if ssh succeeded for server1"
+                      )
+
+        lb_rule.assign(self.apiclient, [self.vm_3])
+
+        try:
+            ssh_1 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress,
+                                        self.services["lbrule"]["publicport"],
+                                        self.vm_1.username,
+                                        self.vm_1.password
+                                        )
+            ssh_3 = remoteSSHClient(
+                                        self.non_src_nat_ip.ipaddress,
+                                        self.services["lbrule"]["publicport"],
+                                        self.vm_3.username,
+                                        self.vm_3.password
+                                        )
+
+            res_1 = ssh_1.execute("hostname")[0]
+            self.debug(res_1)
+
+            time.sleep(self.services["lb_switch_wait"])
+
+            res_3 = ssh_3.execute("hostname")[0]
+            self.debug(res_3)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                    self.non_src_nat_ip.ipaddress)
+
+        self.assertIn(
+                      self.vm_1.name,
+                      res_1,
+                      "Check if ssh succeeded for server1"
+                      )
+        self.assertIn(
+                      self.vm_3.name,
+                      res_3,
+                      "Check if ssh succeeded for server3"
+                      )
+        return
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+
+class TestReleaseIP(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+        template = get_template(
+                            self.apiclient,
+                            self.zone.id,
+                            self.services["ostypeid"]
+                            )
+        self.services["server"]["zoneid"] = self.zone.id
+
+        #Create an account, network, VM, Port forwarding rule, LB rules
+        self.account = Account.create(
+                                      self.apiclient,
+                                      self.services["account"],
+                                      admin=True,
+                                      domainid=self.domain.id
+                                      )
+
+        self.service_offering = ServiceOffering.create(
+                                           self.apiclient,
+                                           self.services["service_offering"]
+                                         )
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        self.ip_address = PublicIPAddress.create(
+                                            self.apiclient,
+                                            self.account.account.name,
+                                            self.zone.id,
+                                            self.account.account.domainid
+                                            )
+
+        ip_addrs = list_publicIP(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                  )
+        try:
+            self.ip_addr = ip_addrs[0]
+        except Exception as e:
+            raise Exception("Failed: During acquiring source NAT for account: %s" %
+                                self.account.account.name)
+
+        self.nat_rule = NATRule.create(
+                                       self.apiclient,
+                                       self.virtual_machine,
+                                       self.services["natrule"],
+                                       self.ip_addr.id
+                                       )
+        self.lb_rule = LoadBalancerRule.create(
+                                        self.apiclient,
+                                        self.services["lbrule"],
+                                        self.ip_addr.id,
+                                        accountid=self.account.account.name
+                                        )
+        self.cleanup = [
+                        self.virtual_machine,
+                        self.account
+                        ]
+        return
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_releaseIP(self):
+        """Test for Associate/Disassociate public IP address"""
+
+        self.debug("Deleting Public IP : %s" % self.ip_addr.id)
+
+        self.ip_address.delete(self.apiclient)
+
+        # Sleep to ensure that deleted state is reflected in other calls 
+        time.sleep(self.services["sleep"])
+
+        # ListPublicIpAddresses should not list deleted Public IP address
+        list_pub_ip_addr_resp = list_publicIP(
+                                    self.apiclient,
+                                    id=self.ip_addr.id
+                                  )
+        self.debug("List Public IP response" + str(list_pub_ip_addr_resp))
+
+        self.assertEqual(
+                     list_pub_ip_addr_resp,
+                     None,
+                    "Check if disassociated IP Address is no longer available"
+                   )
+
+        # ListPortForwardingRules should not list
+        # associated rules with Public IP address
+        list_nat_rule = list_nat_rules(
+                                        self.apiclient,
+                                        id=self.nat_rule.id
+                                        )
+        self.debug("List NAT Rule response" + str(list_nat_rule))
+        self.assertEqual(
+                list_nat_rule,
+                None,
+                "Check if PF rules are no longer available for IP address"
+            )
+
+        # listLoadBalancerRules should not list
+        # associated rules with Public IP address
+        list_lb_rule = list_lb_rules(
+                                     self.apiclient,
+                                     id=self.lb_rule.id
+                                     )
+        self.debug("List LB Rule response" + str(list_lb_rule))
+
+        self.assertEqual(
+                list_lb_rule,
+                None,
+                "Check if LB rules for IP Address are no longer available"
+            )
+
+        # SSH Attempt though public IP should fail
+        with self.assertRaises(Exception):
+            ssh_2 = remoteSSHClient(
+                                    self.ip_addr.ipaddress,
+                                    self.services["natrule"]["publicport"],
+                                    self.virtual_machine.username,
+                                    self.virtual_machine.password
+                                    )
+        return
+
+
+class TestDeleteAccount(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+
+        # Get Zone, Domain and templates
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+        template = get_template(
+                            self.apiclient,
+                            self.zone.id,
+                            self.services["ostypeid"]
+                            )
+        self.services["server"]["zoneid"] = self.zone.id
+
+        #Create an account, network, VM and IP addresses
+        self.account = Account.create(
+                                self.apiclient,
+                                self.services["account"],
+                                admin=True,
+                                domainid=self.domain.id
+                                )
+        self.service_offering = ServiceOffering.create(
+                                    self.apiclient,
+                                    self.services["service_offering"]
+                                    )
+        self.vm_1 = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                    )
+
+        src_nat_ip_addrs = list_publicIP(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                  )
+
+        try:
+            src_nat_ip_addr = src_nat_ip_addrs[0]
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                    src_nat_ip_addr.ipaddress)
+
+        self.lb_rule = LoadBalancerRule.create(
+                                            self.apiclient,
+                                            self.services["lbrule"],
+                                            src_nat_ip_addr.id,
+                                            self.account.account.name
+                                        )
+        self.lb_rule.assign(self.apiclient, [self.vm_1])
+
+        self.nat_rule = NATRule.create(
+                                       self.apiclient,
+                                       self.vm_1,
+                                       self.services["natrule"],
+                                       src_nat_ip_addr.id
+                                       )
+        self.cleanup = []
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_delete_account(self):
+        """Test for delete account"""
+
+        #Validate the Following
+        # 1. after account.cleanup.interval (global setting)
+        #    time all the PF/LB rules should be deleted
+        # 2. verify that list(LoadBalancer/PortForwarding)Rules
+        #    API does not return any rules for the account
+        # 3. The domR should have been expunged for this account
+
+        self.account.delete(self.apiclient)
+        interval = list_configurations(
+                                    self.apiclient,
+                                    name='account.cleanup.interval'
+                                    )
+        self.assertEqual(
+                            isinstance(interval, list),
+                            True,
+                            "Check if account.cleanup.interval config present"
+                        )
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value))
+
+        # ListLoadBalancerRules should not list
+        # associated rules with deleted account
+        # Unable to find account testuser1 in domain 1 : Exception
+        try:
+            list_lb_reponse = list_lb_rules(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+            self.assertEqual(
+                     list_lb_reponse,
+                     None,
+                    "Check load balancing rule is properly deleted."
+                   )
+        except Exception as e:
+
+            raise Exception(
+                "Exception raised while fetching LB rules for account: %s" %
+                                                    self.account.account.name)
+        # ListPortForwardingRules should not
+        # list associated rules with deleted account
+        try:
+            list_nat_reponse = list_nat_rules(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                        )
+            self.assertEqual(
+                             list_nat_reponse,
+                             None,
+                             "Check load balancing rule is properly deleted."
+                   )
+        except Exception as e:
+
+            raise Exception(
+                "Exception raised while fetching NAT rules for account: %s" %
+                                                    self.account.account.name)
+        #Retrieve router for the user account
+        try:
+            routers = list_routers(
+                          self.apiclient,
+                          account=self.account.account.name,
+                          domainid=self.account.account.domainid
+                        )
+            self.assertEqual(
+                             routers,
+                             None,
+                             "Check routers are properly deleted."
+                   )
+        except Exception as e:
+
+            raise Exception(
+                "Exception raised while fetching routers for account: %s" %
+                                                    self.account.account.name)
+        return
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_primary_storage.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_primary_storage.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_primary_storage.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_primary_storage.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,243 @@
+# 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.
+""" BVT tests for Primary Storage
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from nose.plugins.attrib import attr
+from integration.lib.common import *
+
+#Import System modules
+import time
+
+class Services:
+    """Test Primary storage Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "nfs": {
+                            0: {
+                                "url": "nfs://192.168.100.131/testprimary",
+                                # Format: File_System_Type/Location/Path
+                                "name": "Primary XEN",
+                                "hypervisor": 'XEN',
+                            },
+                            1: {
+                                "url": "nfs://192.168.100.131/Primary",
+                                "name": "Primary KVM",
+                                "hypervisor": 'KVM',
+                            },
+                            2: {
+                                "url": "nfs://192.168.100.131/Primary",
+                                "name": "Primary VMWare",
+                                "hypervisor": 'VMWare',
+                            },
+                        },
+                        "iscsi": {
+                            0: {
+                                "url": "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1",
+                                # Format : iscsi://IP Address/IQN number/LUN#
+                                "name": "Primary iSCSI",
+                                "hypervisor": 'XEN',
+                            },
+                        },
+                 }
+
+class TestPrimaryStorageServices(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+        self.cleanup = []
+        # Get Zone and pod
+        self.zone = get_zone(self.apiclient, self.services)
+        self.pod = get_pod(self.apiclient, self.zone.id)
+
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @unittest.skip("skipped - will not be adding storage in our environments")
+    def test_01_primary_storage(self):
+        """Test primary storage pools - XEN, KVM, VMWare
+        """
+
+        # Validate the following:
+        # 1. verify hypervisortype returned by api is Xen/KVM/VMWare
+        # 2. verify that the cluster is in 'Enabled' allocation state
+        # 3. verify that the host is added successfully and
+        #    in Up state with listHosts api response
+
+        #Create NFS storage pools with on XEN/KVM/VMWare clusters
+        for k, v in self.services["nfs"].items():
+
+            clusters = list_clusters(
+                                     self.apiclient,
+                                     zoneid=self.zone.id,
+                                     hypervisortype=v["hypervisor"]
+                                     )
+            self.assertEqual(
+                            isinstance(clusters, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            cluster = clusters[0]
+            #Host should be present before adding primary storage
+            list_hosts_response = list_hosts(
+                                             self.apiclient,
+                                             clusterid=cluster.id
+                                             )
+            self.assertEqual(
+                            isinstance(list_hosts_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+            self.assertNotEqual(
+                        len(list_hosts_response),
+                        0,
+                        "Check list Hosts for hypervisor: " + v["hypervisor"]
+                        )
+
+            storage = StoragePool.create(self.apiclient,
+                                         v,
+                                         clusterid=cluster.id,
+                                         zoneid=self.zone.id,
+                                         podid=self.pod.id
+                                         )
+            self.cleanup.append(storage)
+
+            self.debug("Created storage pool in cluster: %s" % cluster.id)
+
+            self.assertEqual(
+                storage.state,
+                'Up',
+                "Check primary storage state for hypervisor: " + v["hypervisor"]
+                )
+
+            self.assertEqual(
+                storage.type,
+                'NetworkFilesystem',
+                "Check storage pool type for hypervisor : " + v["hypervisor"]
+                )
+
+            #Verify List Storage pool Response has newly added storage pool
+            storage_pools_response = list_storage_pools(
+                                                        self.apiclient,
+                                                        id=storage.id,
+                                                        )
+            self.assertEqual(
+                            isinstance(storage_pools_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            self.assertNotEqual(
+                            len(storage_pools_response),
+                            0,
+                            "Check list Hosts response"
+                        )
+
+            storage_response = storage_pools_response[0]
+            self.assertEqual(
+                    storage_response.id,
+                    storage.id,
+                    "Check storage pool ID for hypervisor: " + v["hypervisor"]
+                    )
+            self.assertEqual(
+                    storage.type,
+                    storage_response.type,
+                    "Check storage pool type for hypervisor: " + v["hypervisor"]
+                )
+            # Call cleanup for reusing primary storage
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.cleanup = []
+
+        # Create iSCSI storage pools with on XEN/KVM clusters
+        for k, v in self.services["iscsi"].items():
+            clusters = list_clusters(
+                                     self.apiclient,
+                                     zoneid=self.zone.id,
+                                     hypervisortype=v["hypervisor"]
+                                     )
+            self.assertEqual(
+                            isinstance(clusters, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            cluster = clusters[0]
+
+            storage = StoragePool.create(self.apiclient,
+                                         v,
+                                         clusterid=cluster.id,
+                                         zoneid=self.zone.id,
+                                         podid=self.pod.id
+                                         )
+            self.cleanup.append(storage)
+
+            self.debug("Created iSCSI storage pool in cluster: %s" % cluster.id)
+            
+            self.assertEqual(
+                storage.state,
+                'Up',
+                "Check primary storage state for hypervisor: " + v["hypervisor"]
+                )
+
+            #Verify List Storage pool Response has newly added storage pool
+            storage_pools_response = list_storage_pools(
+                                                        self.apiclient,
+                                                        id=storage.id,
+                                                        )
+            self.assertEqual(
+                            isinstance(storage_pools_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            self.assertNotEqual(
+                len(storage_pools_response),
+                0,
+                "Check Hosts response for hypervisor: " + v["hypervisor"]
+                        )
+
+            storage_response = storage_pools_response[0]
+            self.assertEqual(
+                    storage_response.id,
+                    storage.id,
+                    "Check storage pool ID for hypervisor: " + v["hypervisor"]
+                )
+            self.assertEqual(
+                    storage.type,
+                    storage_response.type,
+                    "Check storage pool type hypervisor: " + v["hypervisor"]
+                )
+
+            # Call cleanup for reusing primary storage
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.cleanup = []
+        return
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_routers.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_routers.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_routers.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_routers.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,834 @@
+# 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.
+""" BVT tests for routers
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+#Import System modules
+import time
+
+
+class Services:
+    """Test router Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100, # in MHz
+                                    "memory": 64, # In MBs
+                                    },
+                        "virtual_machine":
+                                    {
+                                        "displayname": "Test VM",
+                                        "username": "root",
+                                        "password": "password",
+                                        "ssh_port": 22,
+                                        "hypervisor": 'XenServer',
+                                        "privateport": 22,
+                                        "publicport": 22,
+                                        "protocol": 'TCP',
+                                },
+                        "account": {
+                                        "email": "test@test.com",
+                                        "firstname": "Test",
+                                        "lastname": "User",
+                                        "username": "testuser",
+                                        "password": "password",
+                                        },
+                         "ostypeid":'01853327-513e-4508-9628-f1f55db1946f',
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'advanced', #Networking mode: Basic, Advanced
+                        }
+
+
+class TestRouterServices(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestRouterServices,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        #Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     domainid=cls.domain.id
+                                     )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.vm_1 = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id
+                                    )
+        cls.cleanup = [
+                       cls.vm_1,
+                       cls.account,
+                       cls.service_offering
+                       ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(
+                                   TestRouterServices,
+                                   cls
+                                   ).getClsTestClient().getApiClient()
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        return
+
+    @attr(tags = ["advanced", "basic", "sg", "smoke"])
+    def test_01_router_internal_basic(self):
+        """Test router internal basic zone
+        """
+        # Validate the following
+        # 1. Router only does dhcp
+        # 2. Verify that ports 67 (DHCP) and 53 (DNS) are open on UDP
+        #    by checking status of dnsmasq process
+
+        # Find router associated with user account
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           zoneid=router.zoneid,
+                           type='Routing',
+                           state='Up',
+                           id=router.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list host returns a valid list"
+                        )
+        host = hosts[0]
+        
+        self.debug("Router ID: %s, state: %s" % (router.id, router.state))
+
+        self.assertEqual(
+                            router.state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['virtual_machine']["publicport"],
+                                self.vm_1.username,
+                                self.vm_1.password,
+                                router.linklocalip,
+                                "service dnsmasq status"
+                                )
+        res = str(result)
+        self.debug("Dnsmasq process status: %s" % res)
+
+        self.assertEqual(
+                            res.count("running"),
+                            1,
+                            "Check dnsmasq service is running or not"
+                        )
+        return
+
+    @attr(tags = ["advanced", "smoke"])
+    def test_02_router_internal_adv(self):
+        """Test router internal advanced zone
+        """
+        # Validate the following
+        # 1. Router does dhcp, dns, gateway, LB, PF, FW
+        # 2. verify that dhcp, dns ports are open on UDP
+        # 3. dnsmasq, haproxy processes should be running
+
+        # Find router associated with user account
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        
+        router = list_router_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           zoneid=router.zoneid,
+                           type='Routing',
+                           state='Up',
+                           id=router.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        self.debug("Router ID: %s, state: %s" % (router.id, router.state))
+        self.assertEqual(
+                            router.state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['virtual_machine']["publicport"],
+                                self.vm_1.username,
+                                self.vm_1.password,
+                                router.linklocalip,
+                                "service dnsmasq status"
+                                )
+        res = str(result)
+        self.debug("Dnsmasq process status: %s" % res)
+        
+        self.assertEqual(
+                            res.count("running"),
+                            1,
+                            "Check dnsmasq service is running or not"
+                        )
+
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['virtual_machine']["publicport"],
+                                self.vm_1.username,
+                                self.vm_1.password,
+                                router.linklocalip,
+                                "service haproxy status"
+                                )
+        res = str(result)
+        self.assertEqual(
+                            res.count("running"),
+                            1,
+                            "Check haproxy service is running or not"
+                        )
+        self.debug("Haproxy process status: %s" % res)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_03_restart_network_cleanup(self):
+        """Test restart network
+        """
+
+        # Validate the following
+        # 1. When cleanup = true, router is destroyed and a new one created
+        # 2. New router will have new publicIp and linkLocalIp and
+        #    all it's services should resume
+
+        # Find router associated with user account
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        #Store old values before restart
+        old_linklocalip = router.linklocalip
+
+        timeout = 10
+        # Network should be in Implemented or Setup stage before restart
+        while True:
+            networks = list_networks(
+                                 self.apiclient,
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+            self.assertEqual(
+                            isinstance(networks, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            network = networks[0]
+            if network.state in ["Implemented", "Setup"]:
+                break
+            elif timeout == 0:
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                timeout = timeout - 1
+
+        self.debug(
+            "Restarting network with ID: %s, Network state: %s" % (
+                                                                network.id,
+                                                                network.state
+                                                                ))
+        cmd = restartNetwork.restartNetworkCmd()
+        cmd.id = network.id
+        cmd.cleanup = True
+        self.apiclient.restartNetwork(cmd)
+
+        # Get router details after restart
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        self.assertNotEqual(
+                            router.linklocalip,
+                            old_linklocalip,
+                            "Check link-local IP after restart"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_04_restart_network_wo_cleanup(self):
+        """Test restart network without cleanup
+        """
+
+        # Validate the following
+        # 1. When cleanup = false, router is restarted and
+        #    all services inside the router are restarted
+        # 2. check 'uptime' to see if the actual restart happened
+
+        timeout = 10
+        # Network should be in Implemented or Setup stage before restart
+        while True:
+            networks = list_networks(
+                                 self.apiclient,
+                                 account=self.account.account.name,
+                                 domainid=self.account.account.domainid
+                                 )
+            self.assertEqual(
+                            isinstance(networks, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            network = networks[0]
+            if network.state in ["Implemented", "Setup"]:
+                break
+            elif timeout == 0:
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                timeout = timeout - 1
+
+        self.debug(
+            "Restarting network with ID: %s, Network state: %s" % (
+                                                                network.id,
+                                                                network.state
+                                                                ))
+        cmd = restartNetwork.restartNetworkCmd()
+        cmd.id = network.id
+        cmd.cleanup = False
+        self.apiclient.restartNetwork(cmd)
+
+        # Get router details after restart
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           zoneid=router.zoneid,
+                           type='Routing',
+                           state='Up',
+                           id=router.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        res = get_process_status(
+                                host.ipaddress,
+                                self.services['virtual_machine']["publicport"],
+                                self.vm_1.username,
+                                self.vm_1.password,
+                                router.linklocalip,
+                                "uptime"
+                                )
+        
+        # res = 12:37:14 up 1 min,  0 users,  load average: 0.61, 0.22, 0.08
+        # Split result to check the uptime
+        result = res[0].split()
+        self.debug("Router Uptime: %s" % result)
+        self.assertEqual(
+                            str(result[1]),
+                            'up',
+                            "Check router is running or not"
+                        )
+        if str(result[3]) == "min,":
+               self.assertEqual(
+                                (int(result[2]) < 3),
+                                True,
+                                "Check uptime is less than 3 mins or not"
+                                )
+        else:
+            self.assertEqual(
+                                str(result[3]),
+                                'sec,',
+                                "Check uptime is in seconds"
+                                )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_05_router_basic(self):
+        """Test router basic setup
+        """
+
+        # Validate the following:
+        # 1. verify that listRouters returned a 'Running' router
+        # 2. router will have dns same as that seen in listZones
+        # 3. router will have a guestIP and a linkLocalIp"
+
+        list_router_response = list_routers(
+                                        self.apiclient,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                             len(list_router_response),
+                             0,
+                             "Check list router response"
+                             )
+        for router in list_router_response:
+            self.assertEqual(
+                            router.state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+
+            zones = list_zones(
+                               self.apiclient,
+                               id=router.zoneid
+                               )
+            self.assertEqual(
+                            isinstance(zones, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            zone = zones[0]
+
+            self.assertEqual(
+                            router.dns1,
+                            zone.dns1,
+                            "Compare DNS1 of router and zone"
+                        )
+            self.assertEqual(
+                            router.dns2,
+                            zone.dns2,
+                            "Compare DNS2 of router and zone"
+                        )
+            self.assertEqual(
+                            hasattr(router, 'guestipaddress'),
+                            True,
+                            "Check whether router has guest IP field"
+                            )
+
+            self.assertEqual(
+                            hasattr(router, 'linklocalip'),
+                            True,
+                            "Check whether router has link local IP field"
+                            )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_06_router_advanced(self):
+        """Test router advanced setup
+        """
+
+        # Validate the following
+        # 1. verify that listRouters returned a 'Running' router
+        # 2. router will have dns and gateway as in listZones, listVlanIpRanges
+        # 3. router will have guest,public and linklocal IPs
+
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                             len(list_router_response),
+                             0,
+                             "Check list router response"
+                             )
+        for router in list_router_response:
+            self.assertEqual(
+                            router.state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+
+            zones = list_zones(
+                               self.apiclient,
+                               id=router.zoneid
+                               )
+            self.assertEqual(
+                            isinstance(zones, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            zone = zones[0]
+
+            self.assertEqual(
+                            router.dns1,
+                            zone.dns1,
+                            "Compare DNS1 of router and zone"
+                        )
+            self.assertEqual(
+                            router.dns2,
+                            zone.dns2,
+                            "Compare DNS2 of router and zone"
+                        )
+            self.assertEqual(
+                            hasattr(router, 'guestipaddress'),
+                            True,
+                            "Check whether router has guest IP field"
+                            )
+
+            self.assertEqual(
+                            hasattr(router, 'linklocalip'),
+                            True,
+                            "Check whether router has link local IP field"
+                            )
+
+            #Fetch corresponding ip ranges information from listVlanIpRanges
+            ipranges_response = list_vlan_ipranges(
+                                                   self.apiclient,
+                                                   zoneid=router.zoneid
+                                                   )
+            self.assertEqual(
+                            isinstance(ipranges_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            iprange = ipranges_response[0]
+            self.assertEqual(
+                            router.gateway,
+                            iprange.gateway,
+                            "Check gateway with that of corresponding IP range"
+                            )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_07_stop_router(self):
+        """Test stop router
+        """
+
+        # Validate the following
+        # 1. listRouter should report the router for the account as stopped
+
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+        
+        self.debug("Stopping the router with ID: %s" % router.id)
+        #Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        #List routers to check state of router
+        router_response = list_routers(
+                                    self.apiclient,
+                                    id=router.id
+                                    )
+        self.assertEqual(
+                            isinstance(router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #List router should have router in stopped state
+        self.assertEqual(
+                            router_response[0].state,
+                            'Stopped',
+                            "Check list router response for router state"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_08_start_router(self):
+        """Test start router
+        """
+
+        # Validate the following
+        # 1. listRouter should report the router for the account as stopped
+
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        self.debug("Starting the router with ID: %s" % router.id)
+
+        #Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        #List routers to check state of router
+        router_response = list_routers(
+                                    self.apiclient,
+                                    id=router.id
+                                    )
+        self.assertEqual(
+                            isinstance(router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #List router should have router in running state
+        self.assertEqual(
+                            router_response[0].state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_09_reboot_router(self):
+        """Test reboot router
+        """
+
+        # Validate the following
+        # 1. listRouter should report the router for the account as stopped
+
+        list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+
+        public_ip = router.publicip
+
+        self.debug("Rebooting the router with ID: %s" % router.id)
+        
+        #Reboot the router
+        cmd = rebootRouter.rebootRouterCmd()
+        cmd.id = router.id
+        self.apiclient.rebootRouter(cmd)
+
+        #List routers to check state of router
+        router_response = list_routers(
+                                    self.apiclient,
+                                    id=router.id
+                                    )
+        self.assertEqual(
+                            isinstance(router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #List router should have router in running state and same public IP
+        self.assertEqual(
+                            router_response[0].state,
+                            'Running',
+                            "Check list router response for router state"
+                        )
+
+        self.assertEqual(
+                            router_response[0].publicip,
+                            public_ip,
+                            "Check list router response for router public IP"
+                        )
+        return
+
+    @attr(configuration = "network.gc")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_10_network_gc(self):
+        """Test network GC
+        """
+
+        # Validate the following
+        # 1. stop All User VMs in the account
+        # 2. wait for network.gc.interval time"
+        # 3. After network.gc.interval, router should be stopped
+        # 4. ListRouters should return the router in Stopped state
+
+        list_vms = list_virtual_machines(
+                                         self.apiclient,
+                                         account=self.account.account.name,
+                                         domainid=self.account.account.domainid
+                                         )
+        self.assertEqual(
+                            isinstance(list_vms, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_vms),
+                            0,
+                            "Check length of list VM response"
+                        )
+
+        for vm in list_vms:
+            self.debug("Stopping the VM with ID: %s" % vm.id)
+            # Stop all virtual machines associated with that account
+            cmd = stopVirtualMachine.stopVirtualMachineCmd()
+            cmd.id = vm.id
+            self.apiclient.stopVirtualMachine(cmd)
+
+        # Get network.gc.interval config value
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='network.gc.interval'
+                                     )
+        self.assertEqual(
+                            isinstance(config, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        gcinterval = config[0]
+
+        # Get network.gc.wait config value
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='network.gc.wait'
+                                     )
+        self.assertEqual(
+                            isinstance(config, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        gcwait = config[0]
+
+        total_wait = int(gcinterval.value) + int(gcwait.value)
+        # Wait for wait_time * 2 time to cleanup all the resources
+        time.sleep(total_wait * 2)
+        
+        timeout = self.services["timeout"]
+        while True:
+            #Check status of network router
+            list_router_response = list_routers(
+                                    self.apiclient,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+            if isinstance(list_router_response, list):
+                break
+            elif timeout == 0:
+                raise Exception("List router call failed!")
+            time.sleep(5)
+            timeout = timeout -1
+            
+        self.assertEqual(
+                            isinstance(list_router_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        router = list_router_response[0]
+        
+        self.debug("Router state after network.gc.interval: %s" % router.state)
+        self.assertEqual(
+            router.state,
+            'Stopped',
+            "Check state of the router after stopping all VMs associated"
+            )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_secondary_storage.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_secondary_storage.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_secondary_storage.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_secondary_storage.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,379 @@
+# 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.
+""" BVT tests for Secondary Storage
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+
+#Import System modules
+import time
+
+class Services:
+    """Test secondary storage Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "storage": {
+                                "url": "nfs://192.168.100.131/SecStorage"
+                                # Format: File_System_Type/Location/Path
+                            },
+                        "hypervisors": {
+                            0: {
+                                    "hypervisor": "XenServer",
+                                    "templatefilter": "self",
+                                },
+                            },
+                         "sleep": 60,
+                         "timeout": 5,
+                        }
+
+class TestSecStorageServices(cloudstackTestCase):
+    
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSecStorageServices, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        cls._cleanup = []
+        return
+    
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+    
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        self.services = Services().services
+        # Get Zone and pod
+        self.domain = get_domain(self.apiclient, self.services)
+        self.zone = get_zone(self.apiclient, self.services)
+        self.pod = get_pod(self.apiclient, self.zone.id)
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @unittest.skip("skipped - do not add secondary storage")
+    def test_01_add_sec_storage(self):
+        """Test secondary storage
+        """
+
+        # Validate the following:
+        # 1. secondary storage should be added to the zone.
+        # 2. Verify with listHosts and type secondarystorage
+
+        cmd = addSecondaryStorage.addSecondaryStorageCmd()
+        cmd.zoneid = self.zone.id
+        cmd.url = self.services["storage"]["url"]
+        sec_storage = self.apiclient.addSecondaryStorage(cmd)
+        
+        self.debug("Added secondary storage to zone: %s" % self.zone.id)
+        # Cleanup at the end
+        self._cleanup.append(sec_storage)
+        
+        self.assertEqual(
+                            sec_storage.zoneid,
+                            self.zone.id,
+                            "Check zoneid where sec storage is added"
+                        )
+
+        list_hosts_response = list_hosts(
+                                         self.apiclient,
+                                         type='SecondaryStorage',
+                                         id=sec_storage.id
+                           )
+        self.assertEqual(
+                            isinstance(list_hosts_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                        len(list_hosts_response),
+                        0,
+                        "Check list Hosts response"
+                        )
+
+        host_response = list_hosts_response[0]
+        #Check if host is Up and running
+        self.assertEqual(
+                        host_response.id,
+                        sec_storage.id,
+                        "Check ID of secondary storage"
+                        )
+        self.assertEqual(
+                        sec_storage.type,
+                        host_response.type,
+                        "Check type of host from list hosts response"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
+    def test_02_sys_vm_start(self):
+        """Test system VM start
+        """
+
+        # 1. verify listHosts has all 'routing' hosts in UP state
+        # 2. verify listStoragePools shows all primary storage pools
+        #    in UP state
+        # 3. verify that secondary storage was added successfully
+
+        list_hosts_response = list_hosts(
+                           self.apiclient,
+                           type='Routing',
+                           zoneid=self.zone.id,
+                           podid=self.pod.id
+                           )
+        self.assertEqual(
+                            isinstance(list_hosts_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        # ListHosts has all 'routing' hosts in UP state
+        self.assertNotEqual(
+                                len(list_hosts_response),
+                                0,
+                                "Check list host response"
+                            )
+        for host in list_hosts_response:
+            self.assertEqual(
+                        host.state,
+                        'Up',
+                        "Check state of routing hosts is Up or not"
+                        )
+
+        # ListStoragePools shows all primary storage pools in UP state
+        list_storage_response = list_storage_pools(
+                                                   self.apiclient,
+                                                   zoneid=self.zone.id,
+                                                   podid=self.pod.id
+                                                   )
+        self.assertEqual(
+                            isinstance(list_storage_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                                len(list_storage_response),
+                                0,
+                                "Check list storage pools response"
+                            )
+
+        for primary_storage in list_hosts_response:
+            self.assertEqual(
+                        primary_storage.state,
+                        'Up',
+                        "Check state of primary storage pools is Up or not"
+                        )
+
+        # Secondary storage is added successfully
+        timeout = self.services["timeout"]
+        while True:
+            list_hosts_response = list_hosts(
+                           self.apiclient,
+                           type='SecondaryStorageVM',
+                           zoneid=self.zone.id,
+                           )
+
+            if not isinstance(list_hosts_response, list):
+                # Sleep to ensure Secondary storage is Up
+                time.sleep(int(self.services["sleep"]))
+                timeout = timeout - 1
+            elif timeout == 0 or isinstance(list_hosts_response, list):
+                break
+        
+        self.assertEqual(
+                            isinstance(list_hosts_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        
+        self.assertNotEqual(
+                        len(list_hosts_response),
+                        0,
+                        "Check list Hosts response"
+                        )
+
+        host_response = list_hosts_response[0]
+        #Check if host is Up and running
+        self.assertEqual(
+                        host_response.state,
+                        'Up',
+                        "Check state of secondary storage"
+                        )
+        self.debug("Checking SSVM status in zone: %s" % self.zone.id)
+
+        timeout = self.services["timeout"]
+
+        while True:
+            list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        zoneid=self.zone.id,
+                                        podid=self.pod.id
+                                        )
+            if not isinstance(list_ssvm_response, list):
+                # Sleep to ensure SSVMs are Up and Running
+                time.sleep(int(self.services["sleep"]))
+                timeout = timeout - 1
+            elif timeout == 0 or isinstance(list_ssvm_response, list):
+                break
+            
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #Verify SSVM response
+        self.assertNotEqual(
+                            len(list_ssvm_response),
+                            0,
+                            "Check list System VMs response"
+                        )
+
+        for ssvm in list_ssvm_response:
+            self.assertEqual(
+                            ssvm.state,
+                            'Running',
+                            "Check whether state of SSVM is running"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
+    def test_03_sys_template_ready(self):
+        """Test system templates are ready
+        """
+
+        # Validate the following
+        # If SSVM is in UP state and running
+        # 1. wait for listTemplates to show all builtin templates
+        #    downloaded for all added hypervisors and in “Ready” state"
+
+        for k, v in self.services["hypervisors"].items():
+
+            self.debug("Downloading BUILTIN templates in zone: %s" % 
+                                                                self.zone.id)
+            
+            list_template_response = list_templates(
+                                    self.apiclient,
+                                    hypervisor=v["hypervisor"],
+                                    zoneid=self.zone.id,
+                                    templatefilter=v["templatefilter"],
+                                    listall=True,
+                                    account='system',
+                                    domainid=self.domain.id
+                                    )
+
+            # Ensure all BUILTIN templates are downloaded
+            templateid = None
+            for template in list_template_response:
+                if template.templatetype == "BUILTIN":
+                    templateid = template.id
+
+            # Wait to start a downloading of template
+            time.sleep(self.services["sleep"])
+            
+            while True and (templateid != None):
+                
+                timeout = self.services["timeout"]
+                while True: 
+                    template_response = list_templates(
+                                    self.apiclient,
+                                    id=templateid,
+                                    zoneid=self.zone.id,
+                                    templatefilter=v["templatefilter"],
+                                    listall=True,
+                                    account='system',
+                                    domainid=self.domain.id
+                                    )
+                
+                    if isinstance(template_response, list):
+                        template = template_response[0]
+                        break
+                    
+                    elif timeout == 0:
+                        raise Exception("List template API call failed.")
+                    
+                    time.sleep(1)
+                    timeout = timeout - 1
+                     
+                # If template is ready,
+                # template.status = Download Complete
+                # Downloading - x% Downloaded
+                # Error - Any other string 
+                if template.status == 'Download Complete'  :
+                    break
+                elif 'Downloaded' not in template.status.split():
+                    raise Exception
+                elif 'Downloaded' in template.status.split():
+                    time.sleep(self.services["sleep"])
+
+            #Ensuring the template is in ready state
+            time.sleep(self.services["sleep"])
+            
+            timeout = self.services["timeout"]
+            while True: 
+                template_response = list_templates(
+                                    self.apiclient,
+                                    id=templateid,
+                                    zoneid=self.zone.id,
+                                    templatefilter=v["templatefilter"],
+                                    listall=True,
+                                    account='system',
+                                    domainid=self.domain.id
+                                    )
+                
+                if isinstance(template_response, list):
+                    template = template_response[0]
+                    break
+                    
+                elif timeout == 0:
+                    raise Exception("List template API call failed.")
+                
+                time.sleep(1)
+                timeout = timeout - 1
+            
+            self.assertEqual(
+                            isinstance(template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            template = template_response[0]
+
+            self.assertEqual(
+                            template.isready,
+                            True,
+                            "Check whether state of template is ready or not"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_service_offerings.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_service_offerings.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_service_offerings.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_service_offerings.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,245 @@
+# 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.
+""" BVT tests for Service offerings"""
+
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+
+
+class Services:
+    """Test Service offerings Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "off":
+                            {
+                                "name": "Service Offering",
+                                "displaytext": "Service Offering",
+                                "cpunumber": 1,
+                                "cpuspeed": 100, # MHz
+                                "memory": 64, # in MBs
+                            },
+                     }
+
+class TestCreateServiceOffering(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        self.services = Services().services
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+    
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
+    def test_01_create_service_offering(self):
+        """Test to create service offering"""
+
+        # Validate the following:
+        # 1. createServiceOfferings should return a valid information for newly created offering
+        # 2. The Cloud Database contains the valid information
+
+        service_offering = ServiceOffering.create(
+                                            self.apiclient,
+                                            self.services["off"]
+                                            )
+        self.cleanup.append(service_offering)
+
+        self.debug("Created service offering with ID: %s" % service_offering.id)
+
+        list_service_response = list_service_offering(
+                                                      self.apiclient,
+                                                      id=service_offering.id
+                                                      )
+        self.assertEqual(
+                            isinstance(list_service_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+         
+        self.assertNotEqual(
+                        len(list_service_response),
+                        0,
+                        "Check Service offering is created"
+                        )
+        service_response = list_service_response[0]
+
+        self.assertEqual(
+                        list_service_response[0].cpunumber,
+                        self.services["off"]["cpunumber"],
+                        "Check server id in createServiceOffering"
+                        )
+        self.assertEqual(
+                        list_service_response[0].cpuspeed,
+                        self.services["off"]["cpuspeed"],
+                        "Check cpuspeed in createServiceOffering"
+                        )
+        self.assertEqual(
+                        list_service_response[0].displaytext,
+                        self.services["off"]["displaytext"],
+                        "Check server displaytext in createServiceOfferings"
+                        )
+        self.assertEqual(
+                        list_service_response[0].memory,
+                        self.services["off"]["memory"],
+                        "Check memory in createServiceOffering"
+                        )
+        self.assertEqual(
+                            list_service_response[0].name,
+                            self.services["off"]["name"],
+                            "Check name in createServiceOffering"
+                        )
+        return
+
+
+class TestServiceOfferings(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
+        cls.service_offering_1 = ServiceOffering.create(
+                                                cls.api_client,
+                                                cls.services["off"]
+                                            )
+        cls.service_offering_2 = ServiceOffering.create(
+                                                cls.api_client,
+                                                cls.services["off"]
+                                            )
+        cls._cleanup = [cls.service_offering_1]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
+            #Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
+    def test_02_edit_service_offering(self):
+        """Test to update existing service offering"""
+
+        # Validate the following:
+        # 1. updateServiceOffering should return
+        #    a valid information for newly created offering
+
+        #Generate new name & displaytext from random data
+        random_displaytext = random_gen()
+        random_name = random_gen()
+
+        self.debug("Updating service offering with ID: %s" % 
+                                        self.service_offering_1.id)
+
+        cmd = updateServiceOffering.updateServiceOfferingCmd()
+        #Add parameters for API call
+        cmd.id = self.service_offering_1.id
+        cmd.displaytext = random_displaytext
+        cmd.name = random_name
+        self.apiclient.updateServiceOffering(cmd)
+
+        list_service_response = list_service_offering(
+                                            self.apiclient,
+                                            id=self.service_offering_1.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_service_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        
+        self.assertNotEqual(
+                            len(list_service_response),
+                            0,
+                            "Check Service offering is updated"
+                        )
+
+        self.assertEqual(
+                            list_service_response[0].displaytext,
+                            random_displaytext,
+                            "Check server displaytext in updateServiceOffering"
+                        )
+        self.assertEqual(
+                            list_service_response[0].name,
+                            random_name,
+                            "Check server name in updateServiceOffering"
+                        )
+
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
+    def test_03_delete_service_offering(self):
+        """Test to delete service offering"""
+
+        # Validate the following:
+        # 1. deleteServiceOffering should return
+        #    a valid information for newly created offering
+
+        self.debug("Deleting service offering with ID: %s" % 
+                                        self.service_offering_2.id)
+
+        self.service_offering_2.delete(self.apiclient)
+
+        list_service_response = list_service_offering(
+                                            self.apiclient,
+                                            id=self.service_offering_2.id
+                                            )
+
+        self.assertEqual(
+                        list_service_response,
+                        None,
+                        "Check if service offering exists in listDiskOfferings"
+                    )
+
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_snapshots.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_snapshots.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_snapshots.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_snapshots.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1177 @@
+# 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.
+""" BVT tests for Snapshots
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+
+
+class Services:
+    """Test Snapshots Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "server_with_disk":
+                                    {
+                                        "displayname": "Test VM -With Disk",
+                                        "username": "root",
+                                        "password": "password",
+                                        "ssh_port": 22,
+                                        "hypervisor": 'XenServer',
+                                        "privateport": 22,
+                                        "publicport": 22,
+                                        "protocol": 'TCP',
+                                },
+
+                        "server_without_disk":
+                                    {
+                                        "displayname": "Test VM-No Disk",
+                                        "username": "root",
+                                        "password": "password",
+                                        "ssh_port": 22,
+                                        "hypervisor": 'XenServer',
+                                        "privateport": 22,
+                                        # For NAT rule creation
+                                        "publicport": 22,
+                                        "protocol": 'TCP',
+                                },
+
+                            "recurring_snapshot":
+                                    {
+                                     "intervaltype": 'HOURLY',
+                                     # Frequency of snapshots
+                                     "maxsnaps": 1,     # Should be min 2
+                                     "schedule": 1,
+                                     "timezone": 'US/Arizona',
+                                     # Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack 
+                                },
+
+                            "templates":
+                                {
+                                    "displaytext": 'Template from snapshot',
+                                    "name": 'Template from snapshot',
+                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "templatefilter": 'self',
+                                },
+                            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                            # Cent OS 5.3 (64 bit)
+                            "diskdevice": "/dev/xvdb",      # Data Disk
+                            "rootdisk": "/dev/xvda",        # Root Disk
+
+                            "diskname": "Test Disk",
+                            "size": 1,          # GBs
+
+                            "mount_dir": "/mnt/tmp",
+                            "sub_dir": "test",
+                            "sub_lvl_dir1": "test1",
+                            "sub_lvl_dir2": "test2",
+                            "random_data": "random.data",
+
+                            "username": "root",
+                            "password": "password",
+                            "ssh_port": 22,
+                            "sleep": 60,
+                            "timeout": 10,
+                            "mode": 'advanced',
+                            # Networking mode, Advanced, Basic
+                         }
+
+
+class TestSnapshotRootDisk(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshotRootDisk, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["server_without_disk"]["zoneid"] = cls.zone.id
+        cls.services["template"] = template.id
+        cls.services["zoneid"] = cls.zone.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = cls.virtual_machine_with_disk = \
+                    VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server_without_disk"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_01_snapshot_root_disk(self):
+        """Test Snapshot Root Disk
+        """
+
+        # Validate the following
+        # 1. listSnapshots should list the snapshot that was created.
+        # 2. verify that secondary storage NFS share contains
+        #    the reqd volume under
+        #    /secondary/snapshots//$account_id/$volumeid/$snapshot_uuid
+        # 3. verify backup_snap_id was non null in the `snapshots` table
+
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=self.virtual_machine_with_disk.id,
+                            type='ROOT',
+                            listall=True
+                            )
+
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volumes[0].id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.debug("Snapshot created: ID - %s" % snapshot.id)
+
+        snapshots = list_snapshots(
+                                  self.apiclient,
+                                  id=snapshot.id
+                                  )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check resource id in list resources call"
+                        )
+        self.debug(
+            "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+            % str(snapshot.id)
+            )
+        qresultset = self.dbclient.execute(
+                        "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % str(snapshot.id)
+                        )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = qresultset[0]
+
+        snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
+        account_id = qresult[1]
+        volume_id = qresult[2]
+
+        self.assertNotEqual(
+                            str(snapshot_uuid),
+                            'NULL',
+                            "Check if backup_snap_id is not null"
+                        )
+        
+        # Get the Secondary Storage details from  list Hosts
+        hosts = list_hosts(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                                 )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export/test"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
+
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export/test
+
+            try:
+                # Login to VM to check snapshot present on sec disk
+                ssh_client = self.virtual_machine_with_disk.get_ssh_client()
+
+                cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s/%s %s" % (
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                    "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                    ]
+
+                for c in cmds:
+                    self.debug(c)
+                    result = ssh_client.execute(c)
+                    self.debug(result)
+
+            except Exception:
+                self.fail("SSH failed for Virtual machine: %s" %
+                                self.virtual_machine_with_disk.ipaddress)
+
+            uuids.append(result)
+            # Unmount the Sec Storage
+            cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                    ]
+            try:
+                for c in cmds:
+                    self.debug(c)
+                    result = ssh_client.execute(c)
+                    self.debug(result)
+
+            except Exception as e:
+                self.fail("SSH failed for Virtual machine: %s" %
+                                self.virtual_machine_with_disk.ipaddress)
+        
+        res = str(uuids)
+        # Check snapshot UUID in secondary storage and database
+        self.assertEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+        return
+
+
+class TestSnapshots(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestSnapshots, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        
+        cls.services["domainid"] = cls.domain.id
+        cls.services["server_with_disk"]["zoneid"] = cls.zone.id
+        cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id
+
+        cls.services["server_without_disk"]["zoneid"] = cls.zone.id
+
+        cls.services["template"] = template.id
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["diskoffering"] = cls.disk_offering.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = cls.virtual_machine_with_disk = \
+                    VirtualMachine.create(
+                                cls.api_client,
+                                cls.services["server_with_disk"],
+                                templateid=template.id,
+                                accountid=cls.account.account.name,
+                                domainid=cls.account.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+        cls.virtual_machine_without_disk = \
+                    VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["server_without_disk"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                    )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_02_snapshot_data_disk(self):
+        """Test Snapshot Data Disk
+        """
+
+        volume = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=self.virtual_machine_with_disk.id,
+                            type='DATADISK',
+                            listall=True
+                            )
+        self.assertEqual(
+                            isinstance(volume, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.debug("Creating a Snapshot from data volume: %s" % volume[0].id)
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volume[0].id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        snapshots = list_snapshots(
+                                  self.apiclient,
+                                  id=snapshot.id
+                                  )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check resource id in list resources call"
+                        )
+        self.debug(
+            "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+            % str(snapshot.id)
+            )
+        qresultset = self.dbclient.execute(
+                        "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
+                        % str(snapshot.id)
+                        )
+        self.assertNotEqual(
+                            len(qresultset),
+                            0,
+                            "Check DB Query result set"
+                            )
+
+        qresult = qresultset[0]
+        snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
+        account_id = qresult[1]
+        volume_id = qresult[2]
+
+        self.assertNotEqual(
+                            str(snapshot_uuid),
+                            'NULL',
+                            "Check if backup_snap_id is not null"
+                        )
+
+        # Get the Secondary Storage details from  list Hosts
+        hosts = list_hosts(
+                                 self.apiclient,
+                                 type='SecondaryStorage',
+                                 zoneid=self.zone.id
+                                 )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        uuids = []
+        for host in hosts:
+            # hosts[0].name = "nfs://192.168.100.21/export"
+            parse_url = (host.name).split('/')
+            # parse_url = ['nfs:', '', '192.168.100.21', 'export']
+
+            # Split IP address and export path from name
+            sec_storage_ip = parse_url[2]
+            # Sec Storage IP: 192.168.100.21
+
+            export_path = '/'.join(parse_url[3:])
+            # Export path: export
+
+            try:
+                # Login to VM to check snapshot present on sec disk
+                ssh_client = self.virtual_machine_with_disk.get_ssh_client()
+
+                cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s/%s %s" % (
+                                         sec_storage_ip,
+                                         export_path,
+                                         self.services["mount_dir"]
+                                         ),
+                    "ls %s/snapshots/%s/%s" % (
+                                               self.services["mount_dir"],
+                                               account_id,
+                                               volume_id
+                                               ),
+                ]
+                for c in cmds:
+                    self.debug(c)
+                    result = ssh_client.execute(c)
+                    self.debug(result)
+
+            except Exception as e:
+                self.fail("SSH failed for VM with IP: %s" %
+                                self.virtual_machine_with_disk.ipaddress)
+
+            uuids.append(result)
+            # Unmount the Sec Storage
+            cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                    ]
+            try:
+                for c in cmds:
+                    self.debug(c)
+                    ssh_client.execute(c)
+
+            except Exception as e:
+                self.fail("SSH failed for VM with IP: %s" %
+                                self.virtual_machine_with_disk.ipaddress)
+
+        res = str(uuids)
+        # Check snapshot UUID in secondary storage and database
+        self.assertEqual(
+                        res.count(snapshot_uuid),
+                        1,
+                        "Check snapshot UUID in secondary storage and database"
+                        )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_03_volume_from_snapshot(self):
+        """Create volumes from snapshots
+        """
+        #1. Login to machine; create temp/test directories on data volume
+        #2. Snapshot the Volume
+        #3. Create another Volume from snapshot
+        #4. Mount/Attach volume to another server
+        #5. Compare data
+        random_data_0 = random_gen(100)
+        random_data_1 = random_gen(100)
+
+        try:
+            ssh_client = self.virtual_machine.get_ssh_client()
+
+            #Format partition using ext3
+            format_volume_to_ext3(
+                              ssh_client,
+                              self.services["diskdevice"]
+                              )
+            cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["diskdevice"],
+                                      self.services["mount_dir"]
+                                      ),
+                    "mkdir -p %s/%s/{%s,%s} " % (
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["sub_lvl_dir2"]
+                                            ),
+                    "echo %s > %s/%s/%s/%s" % (
+                                                random_data_0,
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["random_data"]
+                                            ),
+                    "echo %s > %s/%s/%s/%s" % (
+                                                random_data_1,
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir2"],
+                                                self.services["random_data"]
+                                            ),
+                ]
+            for c in cmds:
+                self.debug(c)
+                ssh_client.execute(c)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                self.virtual_machine.ipaddress)
+        # Unmount the Sec Storage
+        cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                ]
+
+        try:
+            for c in cmds:
+                self.debug(c)
+                ssh_client.execute(c)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                self.virtual_machine.ipaddress)
+
+        list_volume_response = list_volumes(
+                                    self.apiclient,
+                                    virtualmachineid=self.virtual_machine.id,
+                                    type='DATADISK',
+                                    listall=True
+                                    )
+
+        volume_response = list_volume_response[0]
+        #Create snapshot from attached volume
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volume_response.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        self.debug("Created Snapshot from volume: %s" % volume_response.id)
+
+        #Create volume from snapshot
+        self.debug("Creating volume from snapshot: %s" % snapshot.id)
+        volume = Volume.create_from_snapshot(
+                                        self.apiclient,
+                                        snapshot.id,
+                                        self.services,
+                                        account=self.account.account.name,
+                                        domainid=self.account.account.domainid
+                                        )
+
+        volumes = list_volumes(
+                                self.apiclient,
+                                id=volume.id
+                                )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(volumes),
+                            None,
+                            "Check Volume list Length"
+                      )
+
+        self.assertEqual(
+                        volumes[0].id,
+                        volume.id,
+                        "Check Volume in the List Volumes"
+                    )
+        #Attaching volume to new VM
+        new_virtual_machine = self.virtual_machine_without_disk
+        self.cleanup.append(new_virtual_machine)
+
+        cmd = attachVolume.attachVolumeCmd()
+        cmd.id = volume.id
+        cmd.virtualmachineid = new_virtual_machine.id
+        self.apiclient.attachVolume(cmd)
+
+        try:
+            #Login to VM to verify test directories and files
+            ssh = new_virtual_machine.get_ssh_client()
+
+            cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["diskdevice"],
+                                      self.services["mount_dir"]
+                                      ),
+               ]
+
+            for c in cmds:
+                self.debug(c)
+                result = ssh.execute(c)
+                self.debug(result)
+
+            returned_data_0 = ssh.execute("cat %s/%s/%s/%s" % (
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["random_data"]
+                                    ))
+            returned_data_1 = ssh.execute("cat %s/%s/%s/%s" % (
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir2"],
+                                                self.services["random_data"]
+                                    ))
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                self.new_virtual_machine.ipaddress)
+
+        #Verify returned data
+        self.assertEqual(
+                random_data_0,
+                returned_data_0[0],
+                "Verify newly attached volume contents with existing one"
+                )
+        self.assertEqual(
+                random_data_1,
+                returned_data_1[0],
+                "Verify newly attached volume contents with existing one"
+                )
+        # Unmount the Sec Storage
+        cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                ]
+        try:
+            for c in cmds:
+                ssh_client.execute(c)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP: %s" %
+                                self.new_virtual_machine.ipaddress)
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_04_delete_snapshot(self):
+        """Test Delete Snapshot
+        """
+
+        #1. Snapshot the Volume
+        #2. Delete the snapshot
+        #3. Verify snapshot is removed by calling List Snapshots API
+
+        volumes = list_volumes(
+                               self.apiclient,
+                               virtualmachineid=self.virtual_machine.id,
+                               type='DATADISK',
+                               listall=True
+                               )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volumes[0].id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+        snapshot.delete(self.apiclient)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id
+                                   )
+
+        self.assertEqual(
+                         snapshots,
+                         None,
+                         "Check if result exists in list item call"
+                         )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_05_recurring_snapshot_root_disk(self):
+        """Test Recurring Snapshot Root Disk
+        """
+        #1. Create snapshot policy for root disk
+        #2. ListSnapshot policy should return newly created policy
+        #3. Verify only most recent number (maxsnaps) snapshots retailed
+
+        volume = list_volumes(
+                        self.apiclient,
+                        virtualmachineid=self.virtual_machine_with_disk.id,
+                        type='ROOT',
+                        listall=True
+                        )
+        self.assertEqual(
+                            isinstance(volume, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        recurring_snapshot = SnapshotPolicy.create(
+                                           self.apiclient,
+                                           volume[0].id,
+                                           self.services["recurring_snapshot"]
+                                        )
+        self.cleanup.append(recurring_snapshot)
+
+        #ListSnapshotPolicy should return newly created policy
+        list_snapshots_policy = list_snapshot_policy(
+                                                     self.apiclient,
+                                                     id=recurring_snapshot.id,
+                                                     volumeid=volume[0].id
+                                                     )
+        self.assertEqual(
+                            isinstance(list_snapshots_policy, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            list_snapshots_policy,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+        snapshots_policy = list_snapshots_policy[0]
+        self.assertEqual(
+                        snapshots_policy.id,
+                        recurring_snapshot.id,
+                        "Check recurring snapshot id in list resources call"
+                        )
+        self.assertEqual(
+                        snapshots_policy.maxsnaps,
+                        self.services["recurring_snapshot"]["maxsnaps"],
+                        "Check interval type in list resources call"
+                        )
+        # Sleep for (maxsnaps+1) hours to verify
+        # only maxsnaps snapshots are retained
+        time.sleep(
+            (self.services["recurring_snapshot"]["maxsnaps"]) * 3600
+            )
+
+        timeout = self.services["timeout"]
+        while True: 
+            snapshots = list_snapshots(
+                        self.apiclient,
+                        volumeid=volume[0].id,
+                        intervaltype=\
+                        self.services["recurring_snapshot"]["intervaltype"],
+                        snapshottype='RECURRING',
+                        listall=True
+                        )
+                
+            if isinstance(snapshots, list):
+                break
+                    
+            elif timeout == 0:
+                raise Exception("List snapshots API call failed.")
+
+            time.sleep(1)
+            timeout = timeout - 1
+
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertEqual(
+                         len(snapshots),
+                         self.services["recurring_snapshot"]["maxsnaps"],
+                         "Check maximum number of recurring snapshots retained"
+                        )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_06_recurring_snapshot_data_disk(self):
+        """Test Recurring Snapshot data Disk
+        """
+        #1. Create snapshot policy for data disk
+        #2. ListSnapshot policy should return newly created policy
+        #3. Verify only most recent number (maxsnaps) snapshots retailed
+
+        volume = list_volumes(
+                        self.apiclient,
+                        virtualmachineid=self.virtual_machine_with_disk.id,
+                        type='DATADISK',
+                        listall=True
+                        )
+
+        self.assertEqual(
+                            isinstance(volume, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        recurring_snapshot = SnapshotPolicy.create(
+                                    self.apiclient,
+                                    volume[0].id,
+                                    self.services["recurring_snapshot"]
+                                )
+        self.cleanup.append(recurring_snapshot)
+        #ListSnapshotPolicy should return newly created policy
+        list_snapshots_policy = list_snapshot_policy(
+                                                     self.apiclient,
+                                                     id=recurring_snapshot.id,
+                                                     volumeid=volume[0].id
+                                                     )
+
+        self.assertEqual(
+                            isinstance(list_snapshots_policy, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            list_snapshots_policy,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+        snapshots_policy = list_snapshots_policy[0]
+        self.assertEqual(
+                        snapshots_policy.id,
+                        recurring_snapshot.id,
+                        "Check recurring snapshot id in list resources call"
+                        )
+        self.assertEqual(
+                            snapshots_policy.maxsnaps,
+                            self.services["recurring_snapshot"]["maxsnaps"],
+                            "Check interval type in list resources call"
+                        )
+
+        # Sleep for (maxsnaps) hours to verify only maxsnaps snapshots are
+        # retained
+        time.sleep(
+            (self.services["recurring_snapshot"]["maxsnaps"]) * 3600
+            )
+        
+        timeout = self.services["timeout"]
+        while True: 
+            snapshots = list_snapshots(
+                            self.apiclient,
+                            volumeid=volume[0].id,
+                            intervaltype=\
+                            self.services["recurring_snapshot"]["intervaltype"],
+                            snapshottype='RECURRING',
+                            listall=True
+                            )
+                
+            if isinstance(snapshots, list):
+                break
+                    
+            elif timeout == 0:
+                raise Exception("List snapshots API call failed.")
+
+            time.sleep(1)
+            timeout = timeout - 1
+
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertEqual(
+                         len(snapshots),
+                         self.services["recurring_snapshot"]["maxsnaps"],
+                         "Check maximum number of recurring snapshots retained"
+                         )
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_07_template_from_snapshot(self):
+        """Create Template from snapshot
+        """
+
+        #1. Login to machine; create temp/test directories on data volume
+        #2. Snapshot the Volume
+        #3. Create Template from snapshot
+        #4. Deploy Virtual machine using this template
+        #5. Login to newly created virtual machine
+        #6. Compare data
+
+        random_data_0 = random_gen(100)
+        random_data_1 = random_gen(100)
+
+        try:
+            #Login to virtual machine
+            ssh_client = self.virtual_machine.get_ssh_client()
+
+            cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["rootdisk"],
+                                      self.services["mount_dir"]
+                                      ),
+                    "mkdir -p %s/%s/{%s,%s} " % (
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["sub_lvl_dir2"]
+                                            ),
+                    "echo %s > %s/%s/%s/%s" % (
+                                                random_data_0,
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["random_data"]
+                                            ),
+                    "echo %s > %s/%s/%s/%s" % (
+                                                random_data_1,
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir2"],
+                                                self.services["random_data"]
+                                        ),
+		             "sync",
+                ]
+
+            for c in cmds:
+                self.debug(c)
+                result = ssh_client.execute(c)
+                self.debug(result)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP address: %s" %
+                                    self.virtual_machine.ipaddress)
+
+        # Unmount the Volume
+        cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                ]
+        for c in cmds:
+            self.debug(c)
+            ssh_client.execute(c)
+
+        volumes = list_volumes(
+                        self.apiclient,
+                        virtualmachineid=self.virtual_machine.id,
+                        type='ROOT',
+                        listall=True
+                        )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        volume = volumes[0]
+
+        #Create a snapshot of volume
+        snapshot = Snapshot.create(
+                                   self.apiclient,
+                                   volume.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid
+                                   )
+
+        self.debug("Snapshot created from volume ID: %s" % volume.id)
+        # Generate template from the snapshot
+        template = Template.create_from_snapshot(
+                                    self.apiclient,
+                                    snapshot,
+                                    self.services["templates"]
+                                    )
+        self.cleanup.append(template)
+        self.debug("Template created from snapshot ID: %s" % snapshot.id)
+
+        # Verify created template
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+        self.assertNotEqual(
+                            templates,
+                            None,
+                            "Check if result exists in list item call"
+                            )
+
+        self.assertEqual(
+                            templates[0].id,
+                            template.id,
+                            "Check new template id in list resources call"
+                        )
+        self.debug("Deploying new VM from template: %s" % template.id)
+
+        # Deploy new virtual machine using template
+        new_virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["server_without_disk"],
+                                    templateid=template.id,
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    mode=self.services["mode"]
+                                    )
+        self.cleanup.append(new_virtual_machine)
+
+        try:
+            #Login to VM & mount directory
+            ssh = new_virtual_machine.get_ssh_client()
+
+            cmds = [
+                    "mkdir -p %s" % self.services["mount_dir"],
+                    "mount %s1 %s" % (
+                                      self.services["rootdisk"],
+                                      self.services["mount_dir"]
+                                      )
+               ]
+
+            for c in cmds:
+                ssh.execute(c)
+
+            returned_data_0 = ssh.execute("cat %s/%s/%s/%s" % (
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir1"],
+                                                self.services["random_data"]
+                                    ))
+            self.debug(returned_data_0)
+            returned_data_1 = ssh.execute("cat %s/%s/%s/%s" % (
+                                                self.services["mount_dir"],
+                                                self.services["sub_dir"],
+                                                self.services["sub_lvl_dir2"],
+                                                self.services["random_data"]
+                                    ))
+            self.debug(returned_data_1)
+        except Exception as e:
+            self.fail("SSH failed for VM with IP address: %s" %
+                                    new_virtual_machine.ipaddress)
+        #Verify returned data
+        self.assertEqual(
+                random_data_0,
+                returned_data_0[0],
+                "Verify newly attached volume contents with existing one"
+                )
+        self.assertEqual(
+                random_data_1,
+                returned_data_1[0],
+                "Verify newly attached volume contents with existing one"
+                )
+        # Unmount the volume
+        cmds = [
+                    "umount %s" % (self.services["mount_dir"]),
+                ]
+        try:
+            for c in cmds:
+                self.debug(c)
+                ssh_client.execute(c)
+
+        except Exception as e:
+            self.fail("SSH failed for VM with IP address: %s" %
+                                    new_virtual_machine.ipaddress)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_ssvm.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_ssvm.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_ssvm.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_ssvm.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,928 @@
+# 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.
+""" BVT tests for SSVM
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+import telnetlib
+
+#Import System modules
+import time
+
+class Services:
+    """Test SSVM Services
+    """
+
+    def __init__(self):
+        self.services = {
+                      "host": {
+                               "username": 'root', # Credentials for SSH
+                               "password": 'password',
+                               "publicport": 22,
+                               },
+                       "sleep": 60,
+                       "timeout": 10,
+                      }
+
+class TestSSVMs(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        self.services = Services().services
+        self.zone = get_zone(self.apiclient, self.services)
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_01_list_sec_storage_vm(self):
+        """Test List secondary storage VMs
+        """
+
+        # Validate the following:
+        # 1. listSystemVM (systemvmtype=secondarystoragevm)
+        #    should return only ONE SSVM per zone
+        # 2. The returned SSVM should be in Running state
+        # 3. listSystemVM for secondarystoragevm should list publicip,
+        #    privateip and link-localip
+        # 4. The gateway programmed on the ssvm by listSystemVm should be
+        #    the same as the gateway returned by listVlanIpRanges
+        # 5. DNS entries must match those given for the zone
+
+        list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        state='Running',
+                                        )
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #Verify SSVM response
+        self.assertNotEqual(
+                            len(list_ssvm_response),
+                            0,
+                            "Check list System VMs response"
+                        )
+
+        list_zones_response = list_zones(self.apiclient)
+        
+        self.assertEqual(
+                            isinstance(list_zones_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.debug("Number of zones: %s" % len(list_zones_response))
+        self.debug("Number of SSVMs: %s" % len(list_ssvm_response))
+        # Number of Sec storage VMs = No of Zones
+        self.assertEqual(
+                            len(list_ssvm_response),
+                            len(list_zones_response),
+                            "Check number of SSVMs with number of zones"
+                        )
+        #For each secondary storage VM check private IP,
+        #public IP, link local IP and DNS
+        for ssvm in list_ssvm_response:
+
+            self.debug("SSVM state: %s" % ssvm.state)
+            self.assertEqual(
+                            ssvm.state,
+                            'Running',
+                            "Check whether state of SSVM is running"
+                        )
+
+            self.assertEqual(
+                            hasattr(ssvm, 'privateip'),
+                            True,
+                            "Check whether SSVM has private IP field"
+                            )
+
+            self.assertEqual(
+                            hasattr(ssvm, 'linklocalip'),
+                            True,
+                            "Check whether SSVM has link local IP field"
+                            )
+
+            self.assertEqual(
+                            hasattr(ssvm, 'publicip'),
+                            True,
+                            "Check whether SSVM has public IP field"
+                            )
+
+            #Fetch corresponding ip ranges information from listVlanIpRanges
+            ipranges_response = list_vlan_ipranges(
+                                                   self.apiclient,
+                                                   zoneid=ssvm.zoneid
+                                                   )
+            self.assertEqual(
+                            isinstance(ipranges_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            iprange = ipranges_response[0]
+
+            self.assertEqual(
+                            ssvm.gateway,
+                            iprange.gateway,
+                            "Check gateway with that of corresponding ip range"
+                            )
+
+            #Fetch corresponding zone information from listZones
+            zone_response = list_zones(
+                                       self.apiclient,
+                                       id=ssvm.zoneid
+                                       )
+            self.assertEqual(
+                            isinstance(zone_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            self.assertEqual(
+                            ssvm.dns1,
+                            zone_response[0].dns1,
+                            "Check DNS1 with that of corresponding zone"
+                            )
+
+            self.assertEqual(
+                            ssvm.dns2,
+                            zone_response[0].dns2,
+                            "Check DNS2 with that of corresponding zone"
+                            )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_02_list_cpvm_vm(self):
+        """Test List console proxy VMs
+        """
+
+        # Validate the following:
+        # 1. listSystemVM (systemvmtype=consoleproxy) should return
+        #    at least ONE CPVM per zone
+        # 2. The returned ConsoleProxyVM should be in Running state
+        # 3. listSystemVM for console proxy should list publicip, privateip
+        #    and link-localip
+        # 4. The gateway programmed on the console proxy should be the same
+        #    as the gateway returned by listZones
+        # 5. DNS entries must match those given for the zone
+
+        list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='consoleproxy',
+                                        state='Running',
+                                        )
+        self.assertEqual(
+                            isinstance(list_cpvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #Verify CPVM response
+        self.assertNotEqual(
+                            len(list_cpvm_response),
+                            0,
+                            "Check list System VMs response"
+                        )
+        list_zones_response = list_zones(self.apiclient)
+        # Number of Console Proxy VMs = No of Zones
+        
+        self.assertEqual(
+                            isinstance(list_zones_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        
+        self.debug("Number of zones: %s" % len(list_zones_response))
+        self.debug("Number of CPVMs: %s" % len(list_cpvm_response))
+
+        self.assertEqual(
+                            len(list_cpvm_response),
+                            len(list_zones_response),
+                            "Check number of CPVMs with number of zones"
+                        )
+        #For each CPVM check private IP, public IP, link local IP and DNS
+        for cpvm in list_cpvm_response:
+
+            self.debug("CPVM state: %s" % cpvm.state)
+            self.assertEqual(
+                            cpvm.state,
+                            'Running',
+                            "Check whether state of CPVM is running"
+                        )
+
+            self.assertEqual(
+                            hasattr(cpvm, 'privateip'),
+                            True,
+                            "Check whether CPVM has private IP field"
+                            )
+
+            self.assertEqual(
+                            hasattr(cpvm, 'linklocalip'),
+                            True,
+                            "Check whether CPVM has link local IP field"
+                            )
+
+            self.assertEqual(
+                            hasattr(cpvm, 'publicip'),
+                            True,
+                            "Check whether CPVM has public IP field"
+                            )
+            #Fetch corresponding ip ranges information from listVlanIpRanges
+            ipranges_response = list_vlan_ipranges(
+                                                   self.apiclient,
+                                                   zoneid=cpvm.zoneid
+                                                   )
+            self.assertEqual(
+                            isinstance(ipranges_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            iprange = ipranges_response[0]
+
+            self.assertEqual(
+                            cpvm.gateway,
+                            iprange.gateway,
+                            "Check gateway with that of corresponding ip range"
+                            )
+
+            #Fetch corresponding zone information from listZones
+            zone_response = list_zones(
+                                       self.apiclient,
+                                       id=cpvm.zoneid
+                                       )
+
+            self.assertEqual(
+                            cpvm.dns1,
+                            zone_response[0].dns1,
+                            "Check DNS1 with that of corresponding zone"
+                            )
+
+            self.assertEqual(
+                            cpvm.dns2,
+                            zone_response[0].dns2,
+                            "Check DNS2 with that of corresponding zone"
+                            )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_03_ssvm_internals(self):
+        """Test SSVM Internals"""
+
+        # Validate the following
+        # 1. The SSVM check script should not return any
+        #    WARN|ERROR|FAIL messages
+        # 2. If you are unable to login to the SSVM with the signed key
+        #    then test is deemed a failure
+        # 3. There should be only one ""cloud"" process running within the SSVM
+        # 4. If no process is running/multiple process are running
+        #    then the test is a failure
+
+        list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        ssvm = list_ssvm_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=ssvm.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        self.debug("Running SSVM check script")
+
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['host']["publicport"],
+                                self.services['host']["username"],
+                                self.services['host']["password"],
+                                ssvm.linklocalip,
+                                "/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL"
+                                )
+        res = str(result)
+        self.debug("SSVM script output: %s" % res)
+
+        self.assertEqual(
+                            res.count("ERROR"),
+                            1,
+                            "Check for Errors in tests"
+                        )
+
+        self.assertEqual(
+                            res.count("WARNING"),
+                            1,
+                            "Check for warnings in tests"
+                        )
+
+        #Check status of cloud service
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['host']["publicport"],
+                                self.services['host']["username"],
+                                self.services['host']["password"],
+                                ssvm.linklocalip,
+                                "service cloud status"
+                                )
+        res = str(result)
+        self.debug("Cloud Process status: %s" % res)
+        # cloud.com service (type=secstorage) is running: process id: 2346
+        self.assertEqual(
+                            res.count("is running"),
+                            1,
+                            "Check cloud service is running or not"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_04_cpvm_internals(self):
+        """Test CPVM Internals"""
+
+        # Validate the following
+        # 1. test that telnet access on 8250 is available to
+        #    the management server for the CPVM
+        # 2. No telnet access, test FAIL
+        # 3. Service cloud status should report cloud agent status to be
+        #    running
+
+        list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='consoleproxy',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_cpvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        cpvm = list_cpvm_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=cpvm.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        try:
+            telnet = telnetlib.Telnet(
+                                      str(self.apiclient.connection.mgtSvr),
+                                      '8250'
+                                      )
+            self.debug("Telnet management server (IP: %s)" % 
+                                            self.apiclient.connection.mgtSvr)
+        except Exception as e:
+            self.fail(
+                    "Telnet Access failed for %s: %s" % \
+                    (self.apiclient.connection.mgtSvr, e)
+                    )
+
+        self.debug("Checking cloud process status")
+
+        result = get_process_status(
+                                host.ipaddress,
+                                self.services['host']["publicport"],
+                                self.services['host']["username"],
+                                self.services['host']["password"],
+                                cpvm.linklocalip,
+                                "service cloud status"
+                                )
+        res = str(result)
+        self.debug("Cloud Process status: %s" % res)
+        self.assertEqual(
+                            res.count("is running"),
+                            1,
+                            "Check cloud service is running or not"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_05_stop_ssvm(self):
+        """Test stop SSVM
+        """
+
+        # Validate the following
+        # 1. The SSVM should go to stop state
+        # 2. After a brief delay of say one minute, the SSVM should be
+        #    restarted once again and return to Running state with previous two
+        #    test cases still passing
+        # 3. If either of the two above steps fail the test is a failure
+
+        list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        ssvm = list_ssvm_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=ssvm.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        self.debug("Stopping SSVM: %s" % ssvm.id)
+        cmd = stopSystemVm.stopSystemVmCmd()
+        cmd.id = ssvm.id
+        self.apiclient.stopSystemVm(cmd)
+        
+        # Sleep to ensure that VM is in proper state
+        time.sleep(self.services["sleep"])
+        
+        timeout = self.services["timeout"]
+        while True:
+            list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        id=ssvm.id
+                                        )
+            if isinstance(list_ssvm_response, list):
+                if list_ssvm_response[0].state == 'Running':
+                    break
+            elif timeout == 0:
+                raise Exception("List SSVM call failed!")
+            
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+        
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        ssvm_response = list_ssvm_response[0]
+        self.debug("SSVM state after debug: %s" % ssvm_response.state)
+        self.assertEqual(
+                        ssvm_response.state,
+                        'Running',
+                        "Check whether SSVM is running or not"
+                        )
+        # Call above tests to ensure SSVM is properly running
+        self.test_01_list_sec_storage_vm()
+        self.test_03_ssvm_internals()
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_06_stop_cpvm(self):
+        """Test stop CPVM
+        """
+
+        # Validate the following
+        # 1. The CPVM should go to stop state
+        # 2. After a brief delay of say one minute, the SSVM should be
+        #    restarted once again and return to Running state with previous
+        #    two test cases still passing
+        # 3. If either of the two above steps fail the test is a failure
+
+        list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='consoleproxy',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_cpvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        cpvm = list_cpvm_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=cpvm.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        self.debug("Stopping CPVM: %s" % cpvm.id)
+        cmd = stopSystemVm.stopSystemVmCmd()
+        cmd.id = cpvm.id
+        self.apiclient.stopSystemVm(cmd)
+
+        # Sleep to ensure that VM is in proper state
+        time.sleep(self.services["sleep"])
+        
+        timeout = self.services["timeout"]
+        while True:
+            list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        id=cpvm.id
+                                        )
+            if isinstance(list_cpvm_response, list):
+                if list_cpvm_response[0].state == 'Running':
+                    break
+            elif timeout == 0:
+                raise Exception("List CPVM call failed!")
+            
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+
+        cpvm_response = list_cpvm_response[0]
+
+        self.debug("CPVM state after debug: %s" % cpvm_response.state)
+
+        self.assertEqual(
+                        cpvm_response.state,
+                        'Running',
+                        "Check whether CPVM is running or not"
+                        )
+        # Call above tests to ensure CPVM is properly running
+        self.test_02_list_cpvm_vm()
+        self.test_04_cpvm_internals()
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_07_reboot_ssvm(self):
+        """Test reboot SSVM
+        """
+        # Validate the following
+        # 1. The SSVM should go to stop and return to Running state
+        # 2. SSVM's public-ip and private-ip must remain the same
+        #    before and after reboot
+        # 3. The cloud process should still be running within the SSVM
+
+        list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+    
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        
+        ssvm_response = list_ssvm_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=ssvm_response.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        #Store the public & private IP values before reboot
+        old_public_ip = ssvm_response.publicip
+        old_private_ip = ssvm_response.privateip
+
+        self.debug("Rebooting SSVM: %s" % ssvm_response.id)
+        cmd = rebootSystemVm.rebootSystemVmCmd()
+        cmd.id = ssvm_response.id
+        self.apiclient.rebootSystemVm(cmd)
+
+        # Sleep to ensure that VM is in proper state
+        time.sleep(self.services["sleep"])
+        
+        timeout = self.services["timeout"]
+        while True:
+            list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        id=ssvm_response.id
+                                        )
+            if isinstance(list_ssvm_response, list):
+                if list_ssvm_response[0].state == 'Running':
+                    break
+            elif timeout == 0:
+                raise Exception("List SSVM call failed!")
+            
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+
+        ssvm_response = list_ssvm_response[0]
+        self.debug("SSVM State: %s" % ssvm_response.state)
+        self.assertEqual(
+                        'Running',
+                        str(ssvm_response.state),
+                        "Check whether CPVM is running or not"
+                        )
+
+        self.assertEqual(
+                    ssvm_response.publicip,
+                    old_public_ip,
+                    "Check Public IP after reboot with that of before reboot"
+                    )
+
+        self.assertEqual(
+                    ssvm_response.privateip,
+                    old_private_ip,
+                    "Check Private IP after reboot with that of before reboot"
+                    )
+        #Call to verify cloud process is running
+        self.test_03_ssvm_internals()
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_08_reboot_cpvm(self):
+        """Test reboot CPVM
+        """
+        # Validate the following
+        # 1. The CPVM should go to stop and return to Running state
+        # 2. CPVM's public-ip and private-ip must remain
+        #    the same before and after reboot
+        # 3. the cloud process should still be running within the CPVM
+
+
+        list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='consoleproxy',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_cpvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        cpvm_response = list_cpvm_response[0]
+
+        hosts = list_hosts(
+                           self.apiclient,
+                           id=cpvm_response.hostid
+                           )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+
+        #Store the public & private IP values before reboot
+        old_public_ip = cpvm_response.publicip
+        old_private_ip = cpvm_response.privateip
+
+        self.debug("Rebooting CPVM: %s" % cpvm_response.id)
+
+        cmd = rebootSystemVm.rebootSystemVmCmd()
+        cmd.id = cpvm_response.id
+        self.apiclient.rebootSystemVm(cmd)
+
+        # Sleep to ensure that VM is in proper state
+        time.sleep(self.services["sleep"])
+
+        timeout = self.services["timeout"]
+        while True:
+            list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        id=cpvm_response.id
+                                        )
+            if isinstance(list_cpvm_response, list):
+                if list_cpvm_response[0].state == 'Running':
+                    break
+            elif timeout == 0:
+                raise Exception("List CPVM call failed!")
+            
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+
+        cpvm_response = list_cpvm_response[0]
+
+        self.debug("CPVM state: %s" % cpvm_response.state)
+        self.assertEqual(
+                        'Running',
+                        str(cpvm_response.state),
+                        "Check whether CPVM is running or not"
+                        )
+
+        self.assertEqual(
+                    cpvm_response.publicip,
+                    old_public_ip,
+                    "Check Public IP after reboot with that of before reboot"
+                    )
+
+        self.assertEqual(
+                    cpvm_response.privateip,
+                    old_private_ip,
+                    "Check Private IP after reboot with that of before reboot"
+                    )
+        #Call to verify cloud process is running
+        self.test_04_cpvm_internals()
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_09_destroy_ssvm(self):
+        """Test destroy SSVM
+        """
+
+        # Validate the following
+        # 1. SSVM should be completely destroyed and a new one will spin up
+        # 2. listSystemVMs will show a different name for the
+        #    systemVM from what it was before
+        # 3. new SSVM will have a public/private and link-local-ip
+        # 4. cloud process within SSVM must be up and running
+
+        list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='secondarystoragevm',
+                                        state='Running',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_ssvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        ssvm_response = list_ssvm_response[0]
+
+        old_name = ssvm_response.name
+
+        self.debug("Destroying SSVM: %s" % ssvm_response.id)
+        cmd = destroySystemVm.destroySystemVmCmd()
+        cmd.id = ssvm_response.id
+        self.apiclient.destroySystemVm(cmd)
+
+        # Sleep to ensure that VM is in proper state
+        time.sleep(self.services["sleep"])
+        
+        timeout = self.services["timeout"]
+        while True:
+            list_ssvm_response = list_ssvms(
+                                        self.apiclient,
+                                        zoneid=self.zone.id,
+                                        systemvmtype='secondarystoragevm'
+                                        )
+            if isinstance(list_ssvm_response, list):
+                if list_ssvm_response[0].state == 'Running':
+                    break
+            elif timeout == 0:
+                raise Exception("List SSVM call failed!")
+            
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+
+        ssvm_response = list_ssvm_response[0]
+
+        # Verify Name, Public IP, Private IP and Link local IP
+        # for newly created SSVM
+        self.assertNotEqual(
+                        ssvm_response.name,
+                        old_name,
+                        "Check SSVM new name with name of destroyed SSVM"
+                        )
+        self.assertEqual(
+                        hasattr(ssvm_response, 'privateip'),
+                        True,
+                        "Check whether SSVM has private IP field"
+                        )
+
+        self.assertEqual(
+                        hasattr(ssvm_response, 'linklocalip'),
+                        True,
+                        "Check whether SSVM has link local IP field"
+                        )
+
+        self.assertEqual(
+                        hasattr(ssvm_response, 'publicip'),
+                        True,
+                        "Check whether SSVM has public IP field"
+                        )
+        
+        #Call to verify cloud process is running
+        self.test_03_ssvm_internals()
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_10_destroy_cpvm(self):
+        """Test destroy CPVM
+        """
+
+        # Validate the following
+        # 1. CPVM should be completely destroyed and a new one will spin up
+        # 2. listSystemVMs will show a different name for the systemVM from
+        #    what it was before
+        # 3. new CPVM will have a public/private and link-local-ip
+        # 4. cloud process within CPVM must be up and running
+
+        list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='consoleproxy',
+                                        zoneid=self.zone.id
+                                        )
+        self.assertEqual(
+                            isinstance(list_cpvm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        cpvm_response = list_cpvm_response[0]
+
+        old_name = cpvm_response.name
+
+        self.debug("Destroying CPVM: %s" % cpvm_response.id)
+        cmd = destroySystemVm.destroySystemVmCmd()
+        cmd.id = cpvm_response.id
+        self.apiclient.destroySystemVm(cmd)
+
+        # Sleep to ensure that VM is in proper state
+        time.sleep(self.services["sleep"])
+        
+        timeout = self.services["timeout"]
+        while True:
+            list_cpvm_response = list_ssvms(
+                                        self.apiclient,
+                                        systemvmtype='consoleproxy',
+                                        zoneid=self.zone.id
+                                        )
+            if isinstance(list_cpvm_response, list):
+                if list_cpvm_response[0].state == 'Running':
+                    break
+            elif timeout == 0:
+                raise Exception("List CPVM call failed!")
+            
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+
+        cpvm_response = list_cpvm_response[0]
+
+        # Verify Name, Public IP, Private IP and Link local IP
+        # for newly created CPVM
+        self.assertNotEqual(
+                        cpvm_response.name,
+                        old_name,
+                        "Check SSVM new name with name of destroyed CPVM"
+                        )
+        self.assertEqual(
+                        hasattr(cpvm_response, 'privateip'),
+                        True,
+                        "Check whether CPVM has private IP field"
+                        )
+
+        self.assertEqual(
+                        hasattr(cpvm_response, 'linklocalip'),
+                        True,
+                        "Check whether CPVM has link local IP field"
+                        )
+
+        self.assertEqual(
+                        hasattr(cpvm_response, 'publicip'),
+                        True,
+                        "Check whether CPVM has public IP field"
+                        )
+                
+        #Call to verify cloud process is running
+        self.test_04_cpvm_internals()
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_templates.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_templates.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_templates.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_templates.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,766 @@
+# 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.
+""" BVT tests for Templates ISO
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+import urllib
+from random import random
+#Import System modules
+import datetime
+
+
+class Services:
+    """Test Templates Services
+    """
+
+    def __init__(self):
+        self.services = {
+                        "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "virtual_machine": {
+                                    "displayname": "testVM",
+                                    "hypervisor": 'XenServer',
+                                    "protocol": 'TCP',
+                                    "ssh_port": 22,
+                                    "username": "root",
+                                    "password": "password",
+                                    "privateport": 22,
+                                    "publicport": 22,
+                         },
+                        "volume": {
+                                "diskname": "Test Volume",
+                                 },
+                         "template_1": {
+                                "displaytext": "Cent OS Template",
+                                "name": "Cent OS Template",
+                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                         },
+                         "template_2": {
+                                "displaytext": "Public Template",
+                                "name": "Public template",
+                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "isfeatured": True,
+                                "ispublic": True,
+                                "isextractable": True,
+                                "mode": "HTTP_DOWNLOAD",
+                         },
+                        "templatefilter": 'self',
+                        "destzoneid": 5,
+                        # For Copy template (Destination zone)
+                        "isfeatured": True,
+                        "ispublic": True,
+                        "isextractable": False,
+                        "bootable": True,
+                        "passwordenabled": True,
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "mode": 'advanced',
+                        # Networking mode: Advanced, basic
+                        "sleep": 30,
+                        "timeout": 10,
+                     }
+
+
+class TestCreateTemplate(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["volume"]["diskoffering"] = cls.disk_offering.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+        cls.services["sourcezoneid"] = cls.zone.id
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        #create virtual machine
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                    )
+
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        # Poll listVM to ensure VM is stopped properly
+        timeout = cls.services["timeout"]
+        while True:
+            time.sleep(cls.services["sleep"])
+
+            # Ensure that VM is in stopped state
+            list_vm_response = list_virtual_machines(
+                                            cls.api_client,
+                                            id=cls.virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Stopped':
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to stop VM (ID: %s) in change service offering" %
+                                                                        vm.id)
+
+            timeout = timeout - 1
+
+        list_volume = list_volumes(
+                                   cls.api_client,
+                                   virtualmachineid=cls.virtual_machine.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+
+        cls.volume = list_volume[0]
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering,
+                        cls.disk_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_01_create_template(self):
+        """Test create public & private template
+        """
+
+        # Validate the following:
+        # 1. database (vm_template table) should be updated
+        #    with newly created template
+        # 2. UI should show the newly added template
+        # 3. ListTemplates API should show the newly added template
+
+        #Create template from Virtual machine and Volume ID
+        template = Template.create(
+                                self.apiclient,
+                                self.services["template_1"],
+                                self.volume.id,
+                                account=self.account.account.name,
+                                domainid=self.account.account.domainid
+                                )
+        self.cleanup.append(template)
+
+        self.debug("Created template with ID: %s" % template.id)
+
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["templatefilter"],
+                                    id=template.id
+                                    )
+
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        #Verify template response to check whether template added successfully
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+        template_response = list_template_response[0]
+
+        self.assertEqual(
+                            template_response.displaytext,
+                            self.services["template_1"]["displaytext"],
+                            "Check display text of newly created template"
+                        )
+        name = template_response.name
+        self.assertEqual(
+                            name.count(self.services["template_1"]["name"]),
+                            1,
+                            "Check name of newly created template"
+                        )
+        self.assertEqual(
+                            template_response.ostypeid,
+                            self.services["template_1"]["ostypeid"],
+                            "Check osTypeID of newly created template"
+                        )
+        return
+
+
+class TestTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.services = Services().services
+        cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["volume"]["diskoffering"] = cls.disk_offering.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+        cls.services["template_2"]["zoneid"] = cls.zone.id
+        cls.services["sourcezoneid"] = cls.zone.id
+
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            admin=True,
+                            domainid=cls.domain.id
+                            )
+
+        cls.user = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                        )
+        #create virtual machine
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services["virtual_machine"],
+                                    templateid=template.id,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                    )
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        # Poll listVM to ensure VM is stopped properly
+        timeout = cls.services["timeout"]
+        while True:
+            time.sleep(cls.services["sleep"])
+
+            # Ensure that VM is in stopped state
+            list_vm_response = list_virtual_machines(
+                                            cls.api_client,
+                                            id=cls.virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Stopped':
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to stop VM (ID: %s) in change service offering" %
+                                                                        vm.id)
+
+            timeout = timeout - 1
+
+        list_volume = list_volumes(
+                                   cls.api_client,
+                                   virtualmachineid=cls.virtual_machine.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+        try:
+            cls.volume = list_volume[0]
+        except Exception as e:
+            raise Exception(
+                "Exception: Unable to find root volume foe VM: %s" %
+                                                    cls.virtual_machine.id)
+
+        #Create templates for Edit, Delete & update permissions testcases
+        cls.template_1 = Template.create(
+                                         cls.api_client,
+                                         cls.services["template_1"],
+                                         cls.volume.id,
+                                         account=cls.account.account.name,
+                                         domainid=cls.account.account.domainid
+                                         )
+        cls.template_2 = Template.create(
+                                         cls.api_client,
+                                         cls.services["template_2"],
+                                         cls.volume.id,
+                                         account=cls.account.account.name,
+                                         domainid=cls.account.account.domainid
+                                         )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account,
+                        cls.user
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+            #Cleanup created resources such as templates and VMs
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+
+            self.dbclient.close()
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_02_edit_template(self):
+        """Test Edit template
+        """
+
+        # Validate the following:
+        # 1. UI should show the edited values for template
+        # 2. database (vm_template table) should have updated values
+
+        new_displayText = random_gen()
+        new_name = random_gen()
+
+        cmd = updateTemplate.updateTemplateCmd()
+        # Update template attributes
+        cmd.id = self.template_1.id
+        cmd.displaytext = new_displayText
+        cmd.name = new_name
+        cmd.bootable = self.services["bootable"]
+        cmd.passwordenabled = self.services["passwordenabled"]
+
+        self.apiclient.updateTemplate(cmd)
+
+        self.debug("Edited template with new name: %s" % new_name)
+        
+        # Sleep to ensure update reflected across all the calls
+        time.sleep(self.services["sleep"])
+        
+        timeout = self.services["timeout"]
+        while True:
+            # Verify template response for updated attributes
+            list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["templatefilter"],
+                                    id=self.template_1.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+            if isinstance(list_template_response, list):
+                break
+            elif timeout == 0:
+                raise Exception("List Template failed!")
+
+            time.sleep(10)
+            timeout = timeout -1
+            
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+        template_response = list_template_response[0]
+        
+        self.debug("New Name: %s" % new_displayText)
+        self.debug("Name in Template response: %s"
+                                % template_response.displaytext)
+        self.assertEqual(
+                            template_response.displaytext,
+                            new_displayText,
+                            "Check display text of updated template"
+                        )
+        self.assertEqual(
+                            template_response.name,
+                            new_name,
+                            "Check name of updated template"
+                        )
+        self.assertEqual(
+                            str(template_response.passwordenabled).lower(),
+                            str(self.services["passwordenabled"]).lower(),
+                            "Check passwordenabled field of updated template"
+                        )
+        self.assertEqual(
+                            template_response.ostypeid,
+                            self.services["ostypeid"],
+                            "Check OSTypeID of updated template"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_03_delete_template(self):
+        """Test delete template
+        """
+
+        # Validate the following:
+        # 1. UI should not show the deleted template
+        # 2. database (vm_template table) should not contain deleted template
+
+        self.debug("Deleting Template ID: %s" % self.template_1.id)
+
+        self.template_1.delete(self.apiclient)
+
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["templatefilter"],
+                                    id=self.template_1.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        # Verify template is deleted properly using ListTemplates
+        self.assertEqual(
+                         list_template_response,
+                         None,
+                         "Check if template exists in List Templates"
+                         )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_04_extract_template(self):
+        "Test for extract template"
+
+        # Validate the following
+        # 1. Admin should able  extract and download the templates
+        # 2. ListTemplates should display all the public templates
+        #    for all kind of users
+        # 3 .ListTemplates should not display the system templates
+
+        self.debug("Extracting template with ID: %s" % self.template_2.id)
+
+        cmd = extractTemplate.extractTemplateCmd()
+        cmd.id = self.template_2.id
+        cmd.mode = self.services["template_2"]["mode"]
+        cmd.zoneid = self.zone.id
+        list_extract_response = self.apiclient.extractTemplate(cmd)
+
+        try:
+            # Format URL to ASCII to retrieve response code
+            formatted_url = urllib.unquote_plus(list_extract_response.url)
+            url_response = urllib.urlopen(formatted_url)
+            response_code = url_response.getcode()
+        
+        except Exception:
+            self.fail(
+                "Extract Template Failed with invalid URL %s (template id: %s)" \
+                % (formatted_url, self.template_2.id)
+            )
+        self.assertEqual(
+                            list_extract_response.id,
+                            self.template_2.id,
+                            "Check ID of the extracted template"
+                        )
+        self.assertEqual(
+                            list_extract_response.extractMode,
+                            self.services["template_2"]["mode"],
+                            "Check mode of extraction"
+                        )
+        self.assertEqual(
+                            list_extract_response.zoneid,
+                            self.services["template_2"]["zoneid"],
+                            "Check zone ID of extraction"
+                        )
+        self.assertEqual(
+                         response_code,
+                         200,
+                         "Check for a valid response download URL"
+                         )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_05_template_permissions(self):
+        """Update & Test for template permissions"""
+
+        # Validate the following
+        # 1. listTemplatePermissions returns valid
+        #    permissions set for template
+        # 2. permission changes should be reflected in vm_template
+        #    table in database
+
+        self.debug("Updating Template permissions ID:%s" % self.template_2.id)
+
+        cmd = updateTemplatePermissions.updateTemplatePermissionsCmd()
+        # Update template permissions
+        cmd.id = self.template_2.id
+        cmd.isfeatured = self.services["isfeatured"]
+        cmd.ispublic = self.services["ispublic"]
+        cmd.isextractable = self.services["isextractable"]
+        self.apiclient.updateTemplatePermissions(cmd)
+
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter='featured',
+                                    id=self.template_2.id,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        # Verify template response for updated permissions for normal user
+        template_response = list_template_response[0]
+
+        self.assertEqual(
+                            template_response.id,
+                            self.template_2.id,
+                            "Check template ID"
+                        )
+        self.assertEqual(
+                            template_response.ispublic,
+                            int(True),
+                            "Check ispublic permission of template"
+                        )
+
+        self.assertNotEqual(
+                        template_response.templatetype,
+                        'SYSTEM',
+                        "ListTemplates should not list any system templates"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multizone"])
+    def test_06_copy_template(self):
+        """Test for copy template from one zone to another"""
+
+        # Validate the following
+        # 1. copy template should be successful and
+        #    secondary storage should contain new copied template.
+
+        self.debug("Copy template from Zone: %s to %s" % (
+                                            self.services["sourcezoneid"],
+                                            self.services["destzoneid"]
+                                            ))
+        cmd = copyTemplate.copyTemplateCmd()
+        cmd.id = self.template_2.id
+        cmd.destzoneid = self.services["destzoneid"]
+        cmd.sourcezoneid = self.services["sourcezoneid"]
+        self.apiclient.copyTemplate(cmd)
+
+        # Verify template is copied to another zone using ListTemplates
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter=\
+                                    self.services["templatefilter"],
+                                    id=self.template_2.id,
+                                    zoneid=self.services["destzoneid"]
+                                    )
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template extracted in List Templates"
+                        )
+
+        template_response = list_template_response[0]
+        self.assertEqual(
+                            template_response.id,
+                            self.template_2.id,
+                            "Check ID of the downloaded template"
+                        )
+        self.assertEqual(
+                            template_response.zoneid,
+                            self.services["destzoneid"],
+                            "Check zone ID of the copied template"
+                        )
+
+        # Cleanup- Delete the copied template
+        cmd = deleteTemplate.deleteTemplateCmd()
+        cmd.id = template_response.id
+        cmd.zoneid = self.services["destzoneid"]
+        self.apiclient.deleteTemplate(cmd)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_07_list_public_templates(self):
+        """Test only public templates are visible to normal user"""
+
+        # Validate the following
+        # 1. ListTemplates should show only 'public' templates for normal user
+
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter='featured',
+                                    account=self.user.account.name,
+                                    domainid=self.user.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+        #Template response should list all 'public' templates
+        for template in list_template_response:
+            self.assertEqual(
+                            template.ispublic,
+                            True,
+                            "ListTemplates should list only public templates"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_08_list_system_templates(self):
+        """Test System templates are not visible to normal user"""
+
+        # Validate the following
+        # 1. ListTemplates should not show 'SYSTEM' templates for normal user
+
+        list_template_response = list_templates(
+                                    self.apiclient,
+                                    templatefilter='featured',
+                                    account=self.user.account.name,
+                                    domainid=self.user.account.domainid
+                                    )
+        self.assertEqual(
+                            isinstance(list_template_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
+                        )
+
+        for template in list_template_response:
+            self.assertNotEqual(
+                        template.templatetype,
+                        'SYSTEM',
+                        "ListTemplates should not list any system templates"
+                        )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_vm_life_cycle.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_vm_life_cycle.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_vm_life_cycle.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_vm_life_cycle.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1154 @@
+# 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.
+""" BVT tests for Virtual Machine Life Cycle
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+#Import System modules
+import time
+
+class Services:
+    """Test VM Life Cycle Services
+    """
+
+    def __init__(self):
+        self.services = {
+                "disk_offering":{
+                    "displaytext": "Small",
+                    "name": "Small",
+                    "disksize": 1
+                },
+                "account": {
+                    "email": "test@test.com",
+                    "firstname": "Test",
+                    "lastname": "User",
+                    "username": "test",
+                    # Random characters are appended in create account to 
+                    # ensure unique username generated each time
+                    "password": "password",
+                },
+                "small":
+                # Create a small virtual machine instance with disk offering 
+                {
+                    "displayname": "testserver",
+                    "username": "root", # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                },
+                "medium":   # Create a medium virtual machine instance 
+                {
+                    "displayname": "testserver",
+                    "username": "root",
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                },
+                "service_offerings":
+                {
+                 "tiny":
+                   {
+                        "name": "Tiny Instance",
+                        "displaytext": "Tiny Instance",
+                        "cpunumber": 1,
+                        "cpuspeed": 100, # in MHz
+                        "memory": 64, # In MBs
+                    },
+                 "small":
+                    {
+                     # Small service offering ID to for change VM 
+                     # service offering from medium to small
+                        "name": "Small Instance",
+                        "displaytext": "Small Instance",
+                        "cpunumber": 1,
+                        "cpuspeed": 100,
+                        "memory": 256
+                    },
+                "medium":
+                    {
+                    # Medium service offering ID to for
+                    # change VM service offering from small to medium
+                        "name": "Medium Instance",
+                        "displaytext": "Medium Instance",
+                        "cpunumber": 1,
+                        "cpuspeed": 100,
+                        "memory": 256
+                    }
+                },
+                "iso":  # ISO settings for Attach/Detach ISO tests
+                {
+                    "displaytext": "Test ISO",
+                    "name": "testISO",
+                    "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
+                     # Source URL where ISO is located
+                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                    "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO 
+                },
+                "template": {
+                    "displaytext": "Cent OS Template",
+                    "name": "Cent OS Template",
+                    "passwordenabled": True,
+                },
+            "diskdevice": '/dev/xvdd',
+            # Disk device where ISO is attached to instance
+            "mount_dir": "/mnt/tmp",
+            "sleep": 60,
+            "timeout": 10,
+            #Migrate VM to hostid
+            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            # CentOS 5.3 (64-bit)
+            "mode":'advanced',
+        }
+
+
+class TestDeployVM(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.services = Services().services
+        # Get Zone, Domain and templates
+        domain = get_domain(self.apiclient, self.services)
+        zone = get_zone(self.apiclient, self.services)
+
+        template = get_template(
+                            self.apiclient,
+                            zone.id,
+                            self.services["ostypeid"]
+                            )
+        # Set Zones and disk offerings
+        self.services["small"]["zoneid"] = zone.id
+        self.services["small"]["template"] = template.id
+
+        self.services["medium"]["zoneid"] = zone.id
+        self.services["medium"]["template"] = template.id
+        self.services["iso"]["zoneid"] = zone.id
+
+        # Create Account, VMs, NAT Rules etc
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=domain.id
+                            )
+
+        self.service_offering = ServiceOffering.create(
+                                    self.apiclient,
+                                    self.services["service_offerings"]["tiny"]
+                                    )
+        # Cleanup
+        self.cleanup = [
+                        self.service_offering,
+                        self.account
+                        ]
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_deploy_vm(self):
+        """Test Deploy Virtual Machine
+        """
+
+        # Validate the following:
+        # 1. Virtual Machine is accessible via SSH
+        # 2. listVirtualMachines returns accurate information
+        # 3. The Cloud Database contains the valid information
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["small"],
+                                    accountid=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    serviceofferingid=self.service_offering.id
+                                )
+
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM available in List Virtual Machines"
+                        )
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+
+                            vm_response.id,
+                            self.virtual_machine.id,
+                            "Check virtual machine id in listVirtualMachines"
+                        )
+
+        self.assertEqual(
+                    vm_response.displayname,
+                    self.virtual_machine.displayname,
+                    "Check virtual machine displayname in listVirtualMachines"
+                    )
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+
+class TestVMLifeCycle(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        domain = get_domain(cls.api_client, cls.services)
+        zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Set Zones and disk offerings
+        cls.services["small"]["zoneid"] = zone.id
+        cls.services["small"]["template"] = template.id
+
+        cls.services["medium"]["zoneid"] = zone.id
+        cls.services["medium"]["template"] = template.id
+        cls.services["iso"]["zoneid"] = zone.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=domain.id
+                            )
+
+        cls.small_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offerings"]["small"]
+                                    )
+
+        cls.medium_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offerings"]["medium"]
+                                    )
+        #create small and large virtual machines
+        cls.small_virtual_machine = VirtualMachine.create(
+                                        cls.api_client,
+                                        cls.services["small"],
+                                        accountid=cls.account.account.name,
+                                        domainid=cls.account.account.domainid,
+                                        serviceofferingid=cls.small_offering.id,
+                                        mode=cls.services["mode"]
+                                        )
+        cls.medium_virtual_machine = VirtualMachine.create(
+                                       cls.api_client,
+                                       cls.services["medium"],
+                                       accountid=cls.account.account.name,
+                                       domainid=cls.account.account.domainid,
+                                       serviceofferingid=cls.medium_offering.id,
+                                       mode=cls.services["mode"]
+                                    )
+        cls.virtual_machine = VirtualMachine.create(
+                                        cls.api_client,
+                                        cls.services["small"],
+                                        accountid=cls.account.account.name,
+                                        domainid=cls.account.account.domainid,
+                                        serviceofferingid=cls.small_offering.id,
+                                        mode=cls.services["mode"]
+                                        )
+        cls._cleanup = [
+                        cls.small_offering,
+                        cls.medium_offering,
+                        cls.account
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.api_client = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
+        cleanup_resources(cls.api_client, cls._cleanup)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created ISOs
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_01_stop_vm(self):
+        """Test Stop Virtual Machine
+        """
+
+        # Validate the following
+        # 1. Should Not be able to login to the VM.
+        # 2. listVM command should return
+        #    this VM.State of this VM should be ""Stopped"".
+
+        self.debug("Stopping VM - ID: %s" % self.virtual_machine.id)
+        self.small_virtual_machine.stop(self.apiclient)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM available in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+                            list_vm_response[0].state,
+                            "Stopped",
+                            "Check virtual machine is in stopped state"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_02_start_vm(self):
+        """Test Start Virtual Machine
+        """
+        # Validate the following
+        # 1. listVM command should return this VM.State
+        #    of this VM should be Running".
+
+        self.debug("Starting VM - ID: %s" % self.virtual_machine.id)
+        self.small_virtual_machine.start(self.apiclient)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM avaliable in List Virtual Machines"
+                        )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.small_virtual_machine.id
+                )
+        self.assertEqual(
+                            list_vm_response[0].state,
+                            "Running",
+                            "Check virtual machine is in running state"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_03_reboot_vm(self):
+        """Test Reboot Virtual Machine
+        """
+
+        # Validate the following
+        # 1. Should be able to login to the VM.
+        # 2. listVM command should return the deployed VM.
+        #    State of this VM should be "Running"
+
+        self.debug("Rebooting VM - ID: %s" % self.virtual_machine.id)
+        self.small_virtual_machine.reboot(self.apiclient)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM avaliable in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+                            list_vm_response[0].state,
+                            "Running",
+                            "Check virtual machine is in running state"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_04_change_offering_small(self):
+        """Change Offering to a small capacity
+        """
+
+        # Validate the following
+        # 1. Log in to the Vm .We should see that the CPU and memory Info of
+        #    this Vm matches the one specified for "Small" service offering. 
+        # 2. Using  listVM command verify that this Vm 
+        #    has Small service offering Id.
+
+        self.debug("Stopping VM - ID: %s" % self.medium_virtual_machine.id)
+
+        self.medium_virtual_machine.stop(self.apiclient)
+
+        # Poll listVM to ensure VM is stopped properly
+        timeout = self.services["timeout"]
+
+        while True:
+            time.sleep(self.services["sleep"])
+
+            # Ensure that VM is in stopped state
+            list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.medium_virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Stopped':
+                    self.debug("VM state: %s" % vm.state)
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to stop VM (ID: %s) in change service offering" % vm.id)
+
+            timeout = timeout - 1
+
+        self.debug("Change Service offering VM - ID: %s" %
+                                    self.medium_virtual_machine.id)
+
+        cmd = changeServiceForVirtualMachine.changeServiceForVirtualMachineCmd()
+        cmd.id = self.medium_virtual_machine.id
+        cmd.serviceofferingid = self.small_offering.id
+        self.apiclient.changeServiceForVirtualMachine(cmd)
+
+        self.debug("Starting VM - ID: %s" % self.medium_virtual_machine.id)
+        self.medium_virtual_machine.start(self.apiclient)
+
+        # Poll listVM to ensure VM is started properly
+        timeout = self.services["timeout"]
+
+        while True:
+            time.sleep(self.services["sleep"])
+
+            # Ensure that VM is in running state
+            list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.medium_virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Running':
+                    self.debug("VM state: %s" % vm.state)
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to start VM (ID: %s) after changing service offering" % vm.id)
+
+            timeout = timeout - 1
+
+        try:
+            ssh = self.medium_virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail(
+                      "SSH Access failed for %s: %s" % \
+                      (self.medium_virtual_machine.ipaddress, e)
+                      )
+
+        cpuinfo = ssh.execute("cat /proc/cpuinfo")
+
+        cpu_cnt = len([i for i in cpuinfo if "processor" in i])
+        #'cpu MHz\t\t: 2660.499'
+        cpu_speed = [i for i in cpuinfo if "cpu MHz" in i ][0].split()[3]
+
+        meminfo = ssh.execute("cat /proc/meminfo")
+        #MemTotal:        1017464 kB
+        total_mem = [i for i in meminfo if "MemTotal" in i][0].split()[1]
+
+        self.debug(
+            "CPU count: %s, CPU Speed: %s, Mem Info: %s" % (
+                                                            cpu_cnt,
+                                                            cpu_speed,
+                                                            total_mem
+                                                            ))
+        self.assertAlmostEqual(
+                            int(cpu_cnt),
+                            self.small_offering.cpunumber,
+                            "Check CPU Count for small offering"
+                        )
+
+        self.assertAlmostEqual(
+                            list_vm_response[0].cpuspeed,
+                            self.small_offering.cpuspeed,
+                            "Check CPU Speed for small offering"
+                        )
+        self.assertAlmostEqual(
+                            int(total_mem) / 1024, # In MBs
+                            self.small_offering.memory,
+                            "Check Memory(kb) for small offering"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_05_change_offering_medium(self):
+        """Change Offering to a medium capacity
+        """
+        # Validate the following
+        # 1. Log in to the Vm .We should see that the CPU and memory Info of
+        #    this Vm matches the one specified for "Medium" service offering. 
+        # 2. Using  listVM command verify that this Vm 
+        #    has Medium service offering Id.
+
+        self.debug("Stopping VM - ID: %s" % self.small_virtual_machine.id)
+        self.small_virtual_machine.stop(self.apiclient)
+
+        # Poll listVM to ensure VM is stopped properly
+        timeout = self.services["timeout"]
+
+        while True:
+            time.sleep(self.services["sleep"])
+
+            # Ensure that VM is in stopped state
+            list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Stopped':
+                    self.debug("VM state: %s" % vm.state)
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to stop VM (ID: %s) in change service offering" % vm.id)
+
+            timeout = timeout - 1
+
+        self.debug("Change service offering VM - ID: %s" %
+                                            self.small_virtual_machine.id)
+
+        cmd = changeServiceForVirtualMachine.changeServiceForVirtualMachineCmd()
+        cmd.id = self.small_virtual_machine.id
+        cmd.serviceofferingid = self.medium_offering.id
+        self.apiclient.changeServiceForVirtualMachine(cmd)
+
+        self.debug("Starting VM - ID: %s" % self.small_virtual_machine.id)
+        self.small_virtual_machine.start(self.apiclient)
+
+        # Poll listVM to ensure VM is started properly
+        timeout = self.services["timeout"]
+
+        while True:
+            time.sleep(self.services["sleep"])
+
+            # Ensure that VM is in running state
+            list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Running':
+                    self.debug("VM state: %s" % vm.state)
+                    break
+
+            if timeout == 0:
+                    raise Exception(
+                        "Failed to start VM (ID: %s) after changing service offering" % vm.id)
+
+            timeout = timeout - 1
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+
+        try:
+            ssh_client = self.small_virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail(
+                    "SSH Access failed for %s: %s" % \
+                    (self.small_virtual_machine.ipaddress, e)
+                    )
+
+        cpuinfo = ssh_client.execute("cat /proc/cpuinfo")
+
+        cpu_cnt = len([i for i in cpuinfo if "processor" in i])
+        #'cpu MHz\t\t: 2660.499'
+        cpu_speed = [i for i in cpuinfo if "cpu MHz" in i][0].split()[3]
+
+        meminfo = ssh_client.execute("cat /proc/meminfo")
+        #MemTotal:        1017464 kB
+        total_mem = [i for i in meminfo if "MemTotal" in i][0].split()[1]
+
+        self.debug(
+            "CPU count: %s, CPU Speed: %s, Mem Info: %s" % (
+                                                            cpu_cnt,
+                                                            cpu_speed,
+                                                            total_mem
+                                                            ))
+        self.assertAlmostEqual(
+                            int(cpu_cnt),
+                            self.medium_offering.cpunumber,
+                            "Check CPU Count for medium offering"
+                        )
+
+        self.assertAlmostEqual(
+                            list_vm_response[0].cpuspeed,
+                            self.medium_offering.cpuspeed,
+                            "Check CPU Speed for medium offering"
+                        )
+
+        self.assertAlmostEqual(
+                            int(total_mem) / 1024, # In MBs
+                            self.medium_offering.memory,
+                            "Check Memory(kb) for medium offering"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_06_destroy_vm(self):
+        """Test destroy Virtual Machine
+        """
+
+        # Validate the following
+        # 1. Should not be able to login to the VM.
+        # 2. listVM command should return this VM.State
+        #    of this VM should be "Destroyed".
+
+        self.debug("Destroy VM - ID: %s" % self.small_virtual_machine.id)
+        self.small_virtual_machine.delete(self.apiclient)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM avaliable in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+                            list_vm_response[0].state,
+                            "Destroyed",
+                            "Check virtual machine is in destroyed state"
+                        )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_07_restore_vm(self):
+        """Test recover Virtual Machine
+        """
+
+        # Validate the following
+        # 1. listVM command should return this VM.
+        #    State of this VM should be "Stopped".
+        # 2. We should be able to Start this VM successfully.
+
+        self.debug("Recovering VM - ID: %s" % self.small_virtual_machine.id)
+
+        cmd = recoverVirtualMachine.recoverVirtualMachineCmd()
+        cmd.id = self.small_virtual_machine.id
+        self.apiclient.recoverVirtualMachine(cmd)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.small_virtual_machine.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            len(list_vm_response),
+                            0,
+                            "Check VM avaliable in List Virtual Machines"
+                        )
+
+        self.assertEqual(
+                            list_vm_response[0].state,
+                            "Stopped",
+                            "Check virtual machine is in Stopped state"
+                        )
+
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multihost"])
+    def test_08_migrate_vm(self):
+        """Test migrate VM
+        """
+        # Validate the following
+        # 1. Should be able to login to the VM.
+        # 2. listVM command should return this VM.State of this VM
+        #    should be "Running" and the host should be the host 
+        #    to which the VM was migrated to
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.medium_virtual_machine.zoneid,
+                          type='Routing'
+                          )
+
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "Check the number of hosts in the zone"
+                         )
+        self.assertGreaterEqual(
+                len(hosts),
+                2,
+                "Atleast 2 hosts should be present in a zone for VM migration"
+                )
+        # Remove the host of current VM from the hosts list
+        hosts[:] = [host for host in hosts if host.id != self.medium_virtual_machine.hostid]
+
+        host = hosts[0]
+        self.debug("Migrating VM-ID: %s to Host: %s" % (
+                                        self.medium_virtual_machine.id,
+                                        host.id
+                                        ))
+
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.hostid = host.id
+        cmd.virtualmachineid = self.medium_virtual_machine.id
+        self.apiclient.migrateVirtualMachine(cmd)
+
+        list_vm_response = list_virtual_machines(
+                                            self.apiclient,
+                                            id=self.medium_virtual_machine.id
+                                            )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            list_vm_response,
+                            None,
+                            "Check virtual machine is listVirtualMachines"
+                        )
+
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+                            vm_response.id,
+                            self.medium_virtual_machine.id,
+                            "Check virtual machine ID of migrated VM"
+                        )
+
+        self.assertEqual(
+                            vm_response.hostid,
+                            host.id,
+                            "Check destination hostID of migrated VM"
+                        )
+        return
+
+    @attr(configuration = "expunge.interval")
+    @attr(configuration = "expunge.delay")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_09_expunge_vm(self):
+        """Test destroy(expunge) Virtual Machine
+        """
+        # Validate the following
+        # 1. listVM command should NOT  return this VM any more.
+
+        self.debug("Expunge VM-ID: %s" % self.small_virtual_machine.id)
+
+        cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
+        cmd.id = self.small_virtual_machine.id
+        self.apiclient.destroyVirtualMachine(cmd)
+
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='expunge.delay'
+                                     )
+
+        response = config[0]
+        # Wait for some time more than expunge.delay
+        time.sleep(int(response.value) * 2)
+        
+        #VM should be destroyed unless expunge thread hasn't run
+        #Wait for two cycles of the expunge thread
+        config = list_configurations(
+                                     self.apiclient,
+                                     name='expunge.interval'
+                                     )
+        expunge_cycle = int(config[0].value)*2
+        while expunge_cycle > 0:
+            list_vm_response = list_virtual_machines(
+                                                self.apiclient,
+                                                id=self.small_virtual_machine.id
+                                                )
+            if list_vm_response:
+                time.sleep(expunge_cycle)
+                expunge_cycle = 0
+                continue
+            else:
+                break
+            
+        self.assertEqual(
+                        list_vm_response,
+                        None,
+                        "Check Expunged virtual machine is listVirtualMachines"
+                    )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_10_attachAndDetach_iso(self):
+        """Test for detach ISO to virtual machine"""
+
+        # Validate the following
+        # 1. Create ISO
+        # 2. Attach ISO to VM
+        # 3. Log in to the VM.
+        # 4. The device should be available for use
+        # 5. Detach ISO
+        # 6. Check the device is properly detached by logging into VM
+
+        iso = Iso.create(
+                         self.apiclient,
+                         self.services["iso"],
+                         account=self.account.account.name,
+                         domainid=self.account.account.domainid
+                         )
+
+        self.debug("Successfully created ISO with ID: %s" % iso.id)
+        try:
+            iso.download(self.apiclient)
+        except Exception as e:
+            self.fail("Exception while downloading ISO %s: %s"\
+                      % (iso.id, e))
+
+        self.debug("Attach ISO with ID: %s to VM ID: %s" % (
+                                                    iso.id,
+                                                    self.virtual_machine.id
+                                                    ))
+        #Attach ISO to virtual machine
+        cmd = attachIso.attachIsoCmd()
+        cmd.id = iso.id
+        cmd.virtualmachineid = self.virtual_machine.id
+        self.apiclient.attachIso(cmd)
+
+        try:
+            ssh_client = self.virtual_machine.get_ssh_client()
+
+            cmds = [
+                        "mkdir -p %s" % self.services["mount_dir"],
+                        "mount -rt iso9660 %s %s" \
+                                    % (
+                                       self.services["diskdevice"],
+                                       self.services["mount_dir"]
+                                       ),
+                ]
+
+            for c in cmds:
+                res = ssh_client.execute(c)
+
+                self.assertEqual(res, [], "Check mount is successful or not")
+
+                c = "fdisk -l|grep %s|head -1" % self.services["diskdevice"]
+                res = ssh_client.execute(c)
+                #Disk /dev/xvdd: 4393 MB, 4393723904 bytes
+
+        except Exception as e:
+            self.fail("SSH failed for virtual machine: %s - %s" %
+                                (self.virtual_machine.ipaddress, e))
+
+        # Res may contain more than one strings depending on environment
+        # Split strings to form new list which is used for assertion on ISO size 
+        result = []
+        for i in res:
+            for k in i.split():
+                result.append(k)
+
+        # Get ISO size
+        iso_response = list_isos(
+                                 self.apiclient,
+                                 id=iso.id
+                                 )
+        self.assertEqual(
+                            isinstance(iso_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        iso_size = iso_response[0].size
+
+        self.assertEqual(
+                         str(iso_size) in result,
+                         True,
+                         "Check size of the attached ISO"
+                         )
+        try:
+            #Unmount ISO
+            command = "umount %s" % self.services["mount_dir"]
+            ssh_client.execute(command)
+
+        except Exception as e:
+            self.fail("SSH failed for virtual machine: %s - %s" %
+                                (self.virtual_machine.ipaddress, e))
+
+        #Detach from VM
+        cmd = detachIso.detachIsoCmd()
+        cmd.virtualmachineid = self.virtual_machine.id
+        self.apiclient.detachIso(cmd)
+
+        try:
+            res = ssh_client.execute(c)
+
+        except Exception as e:
+            self.fail("SSH failed for virtual machine: %s - %s" %
+                                (self.virtual_machine.ipaddress, e))
+
+        # Check if ISO is properly detached from VM (using fdisk)
+        result = self.services["diskdevice"] in str(res)
+
+        self.assertEqual(
+                         result,
+                         False,
+                         "Check if ISO is detached from virtual machine"
+                         )
+        return
+
+@unittest.skip("Additional test")
+class TestVMPasswordEnabled(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVMPasswordEnabled,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        domain = get_domain(cls.api_client, cls.services)
+        zone = get_zone(cls.api_client, cls.services)
+        template = get_template(
+                            cls.api_client,
+                            zone.id,
+                            cls.services["ostypeid"]
+                            )
+        # Set Zones and disk offerings
+        cls.services["small"]["zoneid"] = zone.id
+        cls.services["small"]["template"] = template.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=domain.id
+                            )
+
+        cls.small_offering = ServiceOffering.create(
+                                    cls.api_client,
+                                    cls.services["service_offerings"]["small"]
+                                    )
+
+        cls.virtual_machine = VirtualMachine.create(
+                                        cls.api_client,
+                                        cls.services["small"],
+                                        accountid=cls.account.account.name,
+                                        domainid=cls.account.account.domainid,
+                                        serviceofferingid=cls.small_offering.id,
+                                        mode=cls.services["mode"]
+                                        )
+        #Stop virtual machine
+        cls.virtual_machine.stop(cls.api_client)
+
+        # Poll listVM to ensure VM is stopped properly
+        timeout = cls.services["timeout"]
+        while True:
+            time.sleep(cls.services["sleep"])
+
+            # Ensure that VM is in stopped state
+            list_vm_response = list_virtual_machines(
+                                            cls.api_client,
+                                            id=cls.virtual_machine.id
+                                            )
+
+            if isinstance(list_vm_response, list):
+
+                vm = list_vm_response[0]
+                if vm.state == 'Stopped':
+                    break
+
+            if timeout == 0:
+                raise Exception(
+                    "Failed to stop VM (ID: %s) in change service offering" %
+                                                                        vm.id)
+
+            timeout = timeout - 1
+
+        list_volume = list_volumes(
+                                   cls.api_client,
+                                   virtualmachineid=cls.virtual_machine.id,
+                                   type='ROOT',
+                                   listall=True
+                                   )
+        if isinstance(list_volume, list):
+            cls.volume = list_volume[0]
+        else:
+            raise Exception(
+                "Exception: Unable to find root volume foe VM: %s" %
+                                                    cls.virtual_machine.id)
+
+        cls.services["template"]["ostypeid"] = cls.services["ostypeid"]
+        #Create templates for Edit, Delete & update permissions testcases
+        cls.pw_enabled_template = Template.create(
+                                         cls.api_client,
+                                         cls.services["template"],
+                                         cls.volume.id,
+                                         account=cls.account.account.name,
+                                         domainid=cls.account.account.domainid
+                                         )
+        # Delete the VM - No longer needed
+        cls.virtual_machine.delete(cls.api_client)
+        cls.services["small"]["template"] = cls.pw_enabled_template.id
+
+        cls.vm = VirtualMachine.create(
+                                        cls.api_client,
+                                        cls.services["small"],
+                                        accountid=cls.account.account.name,
+                                        domainid=cls.account.account.domainid,
+                                        serviceofferingid=cls.small_offering.id,
+                                        mode=cls.services["mode"]
+                                        )
+        cls._cleanup = [
+                        cls.small_offering,
+                        cls.pw_enabled_template,
+                        cls.account
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        # Cleanup VMs, templates etc.
+        cleanup_resources(cls.api_client, cls._cleanup)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created instances
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+    def test_11_get_vm_password(self):
+        """Test get VM password for password enabled template"""
+
+        # Validate the following
+        # 1. Create an account
+        # 2. Deploy VM with default service offering and "password enabled"
+        #    template. Vm should be in running state.
+        # 3. Stop VM deployed in step 2
+        # 4. Reset VM password. SSH with new password should be successful
+
+        self.debug("Stopping VM: %s" % self.vm.name)
+        self.vm.stop(self.apiclient)
+
+        # Sleep to ensure VM is stopped properly
+        time.sleep(self.services["sleep"])
+
+        self.debug("Resetting VM password for VM: %s" % self.vm.name)
+        password = self.vm.resetPassword(self.apiclient)
+        self.debug("Password reset to: %s" % password)
+
+        self.debug("Starting VM to verify new password..")
+        self.vm.start(self.apiclient)
+        self.debug("VM - %s stated!" % self.vm.name)
+
+        vms = VirtualMachine.list(self.apiclient, id=self.vm.id, listall=True)
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should retun valid response for VM: %s" % self.vm.name
+            )
+        virtual_machine = vms[0]
+
+        self.assertEqual(
+                         virtual_machine.state,
+                         "Running",
+                         "VM state should be running"
+                         )
+        try:
+            self.debug("SSHing into VM: %s" % self.vm.ssh_ip)
+            self.vm.password = password
+            ssh = self.vm.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH into VM: %s failed" % self.vm.ssh_ip)
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_volumes.py ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_volumes.py
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/integration/smoke/test_volumes.py	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/integration/smoke/test_volumes.py	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,528 @@
+# 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.
+""" BVT tests for Volumes
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from integration.lib.utils import *
+from integration.lib.base import *
+from integration.lib.common import *
+from nose.plugins.attrib import attr
+#Import System modules
+import os
+import urllib
+import time
+import tempfile
+
+
+class Services:
+    """Test Volume Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                         },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 64,       # In MBs
+                        },
+                        "disk_offering": {
+                                    "displaytext": "Small",
+                                    "name": "Small",
+                                    "disksize": 1
+                        },
+                        "volume_offerings": {
+                            0: {
+                                "diskname": "TestDiskServ",
+                            },
+                        },
+                        "customdisksize": 1,    # GBs
+                        "username": "root",     # Creds for SSH to VM
+                        "password": "password",
+                        "ssh_port": 22,
+                        "diskname": "TestDiskServ",
+                        "hypervisor": 'XenServer',
+                        "privateport": 22,
+                        "publicport": 22,
+                        "protocol": 'TCP',
+                        "diskdevice": "/dev/xvdb",
+                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "mode": 'advanced',
+                        "sleep": 60,
+                        "timeout": 10,
+                    }
+
+
+class TestCreateVolume(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestCreateVolume, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        cls.custom_disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"],
+                                    custom=True
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["template"] = template.id
+        cls.services["customdiskofferingid"] = cls.custom_disk_offering.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.custom_disk_offering,
+                        cls.account
+                        ]
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_01_create_volume(self):
+        """Test Volume creation for all Disk Offerings (incl. custom)
+        """
+
+        # Validate the following
+        # 1. Create volumes from the different sizes
+        # 2. Verify the size of volume with actual size allocated
+
+        self.volumes = []
+        for k, v in self.services["volume_offerings"].items():
+            volume = Volume.create(
+                                   self.apiClient,
+                                   v,
+                                   zoneid=self.zone.id,
+                                   account=self.account.account.name,
+                                   domainid=self.account.account.domainid,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+            self.debug("Created a volume with ID: %s" % volume.id)
+            self.volumes.append(volume)
+
+        volume = Volume.create_custom_disk(
+                                    self.apiClient,
+                                    self.services,
+                                    account=self.account.account.name,
+                                    domainid=self.account.account.domainid,
+                                    )
+        self.debug("Created a volume with custom offering: %s" % volume.id)
+        self.volumes.append(volume)
+
+        #Attach a volume with different disk offerings
+        #and check the memory allocated to each of them
+        for volume in self.volumes:
+            list_volume_response = list_volumes(
+                                                self.apiClient,
+                                                id=volume.id
+                                                )
+            self.assertEqual(
+                            isinstance(list_volume_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+            self.assertNotEqual(
+                                list_volume_response,
+                                None,
+                                "Check if volume exists in ListVolumes"
+                                )
+            self.debug(
+                "Attaching volume (ID: %s) to VM (ID: %s)" % (
+                                                    volume.id,
+                                                    self.virtual_machine.id
+                                                    ))
+            self.virtual_machine.attach_volume(
+                                                self.apiClient,
+                                                volume
+                                               )
+            try:
+                ssh = self.virtual_machine.get_ssh_client()
+                ssh.execute("reboot")
+
+            except Exception as e:
+                self.fail("SSH access failed for VM %s - %s" %
+                                (self.virtual_machine.ipaddress, e))
+
+            # Poll listVM to ensure VM is started properly
+            timeout = self.services["timeout"]
+            while True:
+                time.sleep(self.services["sleep"])
+
+                # Ensure that VM is in running state
+                list_vm_response = list_virtual_machines(
+                                            self.apiClient,
+                                            id=self.virtual_machine.id
+                                            )
+
+                if isinstance(list_vm_response, list):
+
+                    vm = list_vm_response[0]
+                    if vm.state == 'Running':
+                        self.debug("VM state: %s" % vm.state)
+                        break
+
+                if timeout == 0:
+                    raise Exception(
+                        "Failed to start VM (ID: %s) " % vm.id)
+
+                timeout = timeout - 1
+
+            try:
+                ssh = self.virtual_machine.get_ssh_client(
+                                                      reconnect=True
+                                                      )
+                c = "fdisk -l"
+                res = ssh.execute(c)
+
+            except Exception as e:
+                self.fail("SSH access failed for VM: %s - %s" %
+                                (self.virtual_machine.ipaddress, e))
+
+            # Disk /dev/sda doesn't contain a valid partition table
+            # Disk /dev/sda: 21.5 GB, 21474836480 bytes
+            result = str(res)
+            self.debug("fdisk result: %s" % result)
+
+            self.assertEqual(
+                             str(list_volume_response[0].size) in result,
+                             True,
+                             "Check if promised disk size actually available"
+                             )
+            self.virtual_machine.detach_volume(self.apiClient, volume)
+
+    def tearDown(self):
+        #Clean up, terminate the created volumes
+        cleanup_resources(self.apiClient, self.cleanup)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(TestCreateVolume, cls).getClsTestClient().getApiClient()
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+
+class TestVolumes(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(TestVolumes, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostypeid"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["zoneid"] = cls.zone.id
+        cls.services["template"] = template.id
+        cls.services["diskofferingid"] = cls.disk_offering.id
+
+        # Create VMs, VMs etc
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+
+        cls.services["account"] = cls.account.account.name
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                        )
+        cls.virtual_machine = VirtualMachine.create(
+                                    cls.api_client,
+                                    cls.services,
+                                    accountid=cls.account.account.name,
+                                    domainid=cls.account.account.domainid,
+                                    serviceofferingid=cls.service_offering.id,
+                                    mode=cls.services["mode"]
+                                )
+
+        cls.volume = Volume.create(
+                                   cls.api_client,
+                                   cls.services,
+                                   account=cls.account.account.name,
+                                   domainid=cls.account.account.domainid
+                                   )
+        cls._cleanup = [
+                        cls.service_offering,
+                        cls.disk_offering,
+                        cls.account
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+        self.apiClient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_02_attach_volume(self):
+        """Attach a created Volume to a Running VM
+        """
+        # Validate the following
+        # 1. shows list of volumes
+        # 2. "Attach Disk" pop-up box will display with list of  instances
+        # 3. disk should be  attached to instance successfully
+
+        self.debug(
+                "Attaching volume (ID: %s) to VM (ID: %s)" % (
+                                                    self.volume.id,
+                                                    self.virtual_machine.id
+                                                    ))
+        self.virtual_machine.attach_volume(self.apiClient, self.volume)
+
+        list_volume_response = list_volumes(
+                                                self.apiClient,
+                                                id=self.volume.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_volume_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+        volume = list_volume_response[0]
+        self.assertNotEqual(
+                            volume.virtualmachineid,
+                            None,
+                            "Check if volume state (attached) is reflected"
+                            )
+        try:
+            #Format the attached volume to a known fs
+            format_volume_to_ext3(self.virtual_machine.get_ssh_client())
+
+        except Exception as e:
+
+            self.fail("SSH failed for VM: %s - %s" %
+                                    (self.virtual_machine.ipaddress, e))
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_03_download_attached_volume(self):
+        """Download a Volume attached to a VM
+        """
+        # Validate the following
+        # 1. download volume will fail with proper error message
+        #    "Failed - Invalid state of the volume with ID:
+        #    It should be either detached or the VM should be in stopped state
+
+        self.debug("Extract attached Volume ID: %s" % self.volume.id)
+
+        cmd = extractVolume.extractVolumeCmd()
+        cmd.id = self.volume.id
+        cmd.mode = "HTTP_DOWNLOAD"
+        cmd.zoneid = self.services["zoneid"]
+        # A proper exception should be raised;
+        # downloading attach VM is not allowed
+        with self.assertRaises(Exception):
+            self.apiClient.extractVolume(cmd)
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_04_delete_attached_volume(self):
+        """Delete a Volume attached to a VM
+        """
+
+        # Validate the following
+        # 1. delete volume will fail with proper error message
+        #    "Failed - Invalid state of the volume with ID:
+        #    It should be either detached or the VM should be in stopped state
+
+        self.debug("Trying to delete attached Volume ID: %s" %
+                                                        self.volume.id)
+
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = self.volume.id
+        #Proper exception should be raised; deleting attach VM is not allowed
+        #with self.assertRaises(Exception):
+        result = self.apiClient.deleteVolume(cmd)
+        self.assertEqual(
+                         result,
+                         None,
+                         "Check for delete download error while volume is attached"
+                         )
+        
+    @attr(tags = ["advanced", "advancedns", "smoke"])    
+    def test_05_detach_volume(self):
+        """Detach a Volume attached to a VM
+        """
+
+        # Validate the following
+        # Data disk should be detached from instance and detached data disk
+        # details should be updated properly
+
+        self.debug(
+                "Detaching volume (ID: %s) from VM (ID: %s)" % (
+                                                    self.volume.id,
+                                                    self.virtual_machine.id
+                                                    ))
+
+        self.virtual_machine.detach_volume(self.apiClient, self.volume)
+        #Sleep to ensure the current state will reflected in other calls
+        time.sleep(self.services["sleep"])
+        list_volume_response = list_volumes(
+                                                self.apiClient,
+                                                id=self.volume.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_volume_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+
+        self.assertNotEqual(
+                            list_volume_response,
+                            None,
+                            "Check if volume exists in ListVolumes"
+                            )
+        volume = list_volume_response[0]
+        self.assertEqual(
+                         volume.virtualmachineid,
+                         None,
+                         "Check if volume state (detached) is reflected"
+                         )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_06_download_detached_volume(self):
+        """Download a Volume unattached to an VM
+        """
+        # Validate the following
+        # 1. able to download the volume when its not attached to instance
+
+        self.debug("Extract detached Volume ID: %s" % self.volume.id)
+
+        cmd = extractVolume.extractVolumeCmd()
+        cmd.id = self.volume.id
+        cmd.mode = "HTTP_DOWNLOAD"
+        cmd.zoneid = self.services["zoneid"]
+        extract_vol = self.apiClient.extractVolume(cmd)
+
+        #Attempt to download the volume and save contents locally
+        try:
+            formatted_url = urllib.unquote_plus(extract_vol.url)
+            response = urllib.urlopen(formatted_url)
+            fd, path = tempfile.mkstemp()
+            os.close(fd)
+            fd = open(path, 'wb')
+            fd.write(response.read())
+            fd.close()
+
+        except Exception:
+            self.fail(
+                "Extract Volume Failed with invalid URL %s (vol id: %s)" \
+                % (extract_vol.url, self.volume.id)
+            )
+
+    @attr(tags = ["advanced", "advancedns", "smoke"])
+    def test_07_delete_detached_volume(self):
+        """Delete a Volume unattached to an VM
+        """
+        # Validate the following
+        # 1. volume should be deleted successfully and listVolume should not
+        #    contain the deleted volume details.
+        # 2. "Delete Volume" menu item not shown under "Actions" menu.
+        #    (UI should not allow  to delete the volume when it is attached
+        #    to instance by hiding the menu Item)
+
+        self.debug("Delete Volume ID: %s" % self.volume.id)
+
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = self.volume.id
+        self.apiClient.deleteVolume(cmd)
+
+        list_volume_response = list_volumes(
+                                            self.apiClient,
+                                            id=self.volume.id,
+                                            type='DATADISK'
+                                            )
+        self.assertEqual(
+                        list_volume_response,
+                        None,
+                        "Check if volume exists in ListVolumes"
+                    )
+        return
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/adapter.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/adapter.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/adapter.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/adapter.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,336 @@
+<!--
+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.
+-->
+<regression>
+	<globalparam>
+		
+	<!-- PARAMETERS USED BY SANITY TEST, HAVE TO BE SET -->
+	
+		<param description="Management server ip address">
+			<name>192.168.131.168</name>
+			<variable>hostip</variable>
+		</param>
+		<param description="Zone id">
+			<name>2</name>
+			<variable>globalzoneid</variable>
+		</param>
+		<param description="Service offering id">
+			<name>7</name>
+			<variable>globalserviceofferingid</variable>
+		</param>
+		<param description="Disk offering id, used for volume creation">
+			<name>5</name>
+			<variable>globaldiskofferingid</variable>
+		</param>
+		<param description="Template id used for deployVm">
+			<name>2</name>
+			<variable>globaltemplateid</variable>
+		</param>
+		<param description="Hypervisor type: Xen, KVM or VmWare">
+			<name>XenServer</name>
+			<variable>globalhypervisortype</variable>
+		</param>
+		<param description="Default network offering - used for virtual network creation">
+			<name>6</name>
+			<variable>globalnetworkofferingid</variable>
+		</param>
+		<param description="NetworkID of the admin - used for virtual network VMs under admin account">
+			<name>204</name>
+			<variable>globalnetworkid</variable>
+		</param>
+		
+	<!-- PARAMETERS USED BY OTHER TESTS -->
+		<param>
+			<name>192.168.131.168</name>
+			<variable>db</variable>
+		</param>
+		<param>
+			<name>192.168.131.168</name>
+			<variable>ms1</variable>
+		</param>
+		<param>
+			<name>192.168.130.199</name>
+			<variable>ms2</variable>
+		</param>
+		<param>
+			<name>root</name>
+			<variable>dbUserName</variable>
+		</param>
+		<param>
+			<name></name>
+			<variable>dbPassword</variable>
+		</param>
+		<param>
+			<name>72.52.126.11</name>
+			<variable>dns1</variable>
+		</param>
+		<param>
+			<name>72.52.126.12</name>
+			<variable>dns2</variable>
+		</param>
+		<param>
+			<name>192.168.10.253</name>
+			<variable>internaldns1</variable>
+		</param>
+		<param>
+			<name>192.168.10.254</name>
+			<variable>internaldns2</variable>
+		</param>
+		<param>
+			<name>4</name>
+			<variable>mediumglobalserviceofferingid</variable>
+		</param>
+		<param>
+			<name>6</name>
+			<variable>mediumglobaldiskofferingid</variable>
+		</param>
+		<param>
+			<name>3</name>
+			<variable>globalzoneid1</variable>
+		</param>
+		<param>
+			<name>ZONE1</name>
+			<variable>globalzonename</variable>
+		</param>
+		<param>
+			<name>3</name>
+			<variable>globaltemplateid_passwordenabled</variable>
+		</param>
+		<param>
+			<name>205</name>
+			<variable>globalisoid</variable>
+		</param>
+		<param>
+			<name>http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso</name>
+			<variable>globalisourl</variable>
+		</param>
+		<param>
+			<name>http://172.16.0.220/template/5d67394c-4efd-4b62-966b-51aa53b35277.vhd</name>
+			<variable>globaltemplateurl</variable>
+		</param>
+		<param>
+			<name>../metadata/func/commands</name>
+			<variable>apicommands</variable>
+		</param>
+		<param>
+			<name>root</name>
+			<variable>xenusername</variable>
+		</param>
+		<param>
+			<name>password</name>
+			<variable>xenpassword</variable>
+		</param>
+		<param>
+			<name>192.168.161.21</name>
+			<variable>secondary_storage_ip</variable>
+		</param>
+		<param>
+			<name>/export/regression/secondary</name>
+			<variable>secondary_storage_dir</variable>
+		</param>
+		<param>
+			<name>13</name>
+			<variable>flatnetworkserviceofferingid</variable>
+		</param>
+		<param>
+			<name>12</name>
+			<variable>flatnetworkdiskofferingid</variable>
+		</param>
+	</globalparam>
+	
+
+	<test>
+		<filename>../metadata/func/sanity.xml</filename>
+		<testname>SANITY TEST</testname>
+	</test>
+
+	<test> 
+		<class>com.cloud.test.regression.SanityTest</class>
+		<filename>../metadata/func/regression.xml</filename>
+		<testname>REGRESSION TEST</testname>
+	</test>
+	
+	<test>
+		<filename>../metadata/func/templatedwnldstress.xml</filename>
+		<testname>TEMPLATE DOWNLOAD STRESS TEST</testname>
+	</test>
+<!--	<test> -->
+<!--		<filename>../metadata/func/static_nat.xml</filename> -->
+<!--		<testname>1-1 NAT FEATURE</testname>-->
+<!--	</test>-->
+	
+	
+<!--	<test>-->
+<!--		<filename>../metadata/func/ha.xml</filename>-->
+<!--		<testname>HA TEST - BASIC CASES ONLY</testname>-->
+<!--	</test>-->
+<!--	-->
+<!--	<test>-->
+<!--		<filename>../metadata/func/templates_sync.xml</filename>-->
+<!--		<testname>TEMPLATES SYNC TEST</testname>-->
+<!--	</test>-->
+
+<!--	<test>-->
+<!--		<filename>../metadata/func/expunge.xml</filename>-->
+<!--		<testname>EXPUNGE TEST FOR VOLUMES, SNAPSHOTS AND TEMPLATES</testname>-->
+<!--	</test>-->
+<!--	-->
+<!--	-->
+<!--	<test>-->
+<!--		<filename>../metadata/func/regression_user.xml</filename>-->
+<!--		<testname>REGRESSION TEST FOR REGULAR USER</testname>-->
+<!--	</test>-->
+<!--	-->
+<!--	<test>-->
+<!--		<filename>../metadata/func/userapi.xml</filename>-->
+<!--		<testname>USER/ACCOUNT/DOMAIN TEST</testname>-->
+<!--	</test>-->
+<!--	-->
+<!--	<test>-->
+<!--		<filename>../metadata/func/vmapi.xml</filename>-->
+<!--		<testname>VM TEST</testname>-->
+<!--	</test>-->
+<!--	-->
+<!---->
+<!--	<test>-->
+<!--		<class>com.cloud.test.regression.LoadBalancingTest</class>-->
+<!--		<filename>../metadata/func/loadbalancers.xml</filename>-->
+<!--		<testname>LOAD BALANCING TEST</testname>-->
+<!--	</test>-->
+<!--	-->
+<!--	<test>-->
+<!--		<class>com.cloud.test.regression.PortForwardingTest</class>-->
+<!--		<filename>../metadata/func/securitygroups.xml</filename>-->
+<!--		<testname>SECURITY GROUP TEST</testname>-->
+<!--	</test>-->
+
+<!--	<test>-->
+<!--		<filename>../metadata/func/portforwarding.xml</filename>-->
+<!--		<testname>PORT FORWARDING TEST</testname>-->
+<!--	</test>-->
+
+<!--	<test>-->
+<!--		<filename>../metadata/func/sharedstorage_volume_test.xml</filename>-->
+<!--		<testname>VOLUMES IN SHARED STORAGE SETUP</testname>-->
+<!--	</test>-->
+
+<!--	<test>-->
+<!--		<filename>../metadata/func/localstorage_volume_test.xml</filename>-->
+<!--		<testname>VOLUMES IN LOCAL STORAGE SETUP</testname>-->
+<!--	</test>-->
+<!---->
+<!--	<test>-->
+<!--		<filename>../metadata/func/private_templates.xml</filename>-->
+<!--		<testname>PRIVATE TEMPLATES TEST</testname>-->
+<!--	</test>-->
+<!---->
+<!--	-->
+<!--		<test>-->
+<!--		<filename>../metadata/func/iso.xml</filename>-->
+<!--		<testname>ISO TEST</testname>-->
+<!--	</test>-->
+<!---->
+<!--	<test>-->
+<!--		<filename>../metadata/func/snapshots.xml</filename>-->
+<!--		<testname>SNAPSHOTS TEST</testname>-->
+<!--	</test>-->
+
+<!--		<test>-->
+<!--			<filename>../metadata/func/resource_limits.xml</filename>-->
+<!--			<testname>RESOURCE LIMITS TEST</testname>-->
+<!--		</test>-->
+<!--	-->
+
+<!--		<test>-->
+<!--			<filename>../metadata/func/vmsync.xml</filename>-->
+<!--			<testname>VM SYNCHRONIZATION TEST</testname>-->
+<!--		</test>-->
+<!--	-->
+
+<!--		<test>-->
+<!--			<filename>../metadata/func/mgmtvmsync.xml</filename>-->
+<!--			<testname>MANAGEMENT SERVER SYNCHRONIZATION WITH KILLED VM'S TEST</testname>-->
+<!--		</test>-->
+<!--	-->
+
+<!--		<test>-->
+<!--			<filename>../metadata/func/flatnetwork.xml</filename>-->
+<!--			<testname>Flat network test</testname>-->
+<!--		</test>-->
+	
+
+<!--	<test>
+		<class>com.cloud.test.regression.DelegatedAdminTest</class>
+		<testname>DELEGATED ADMIN TEST</testname>
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_rootadmin1_rootadmin2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_rootadmin_vs_domainlevel1admin.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_domainlevel1admin_rootadmin.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_domainlevel1admin_domainlevel1admin.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_domainlevel1_domainlevel2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_domainlevel2_child_domainlevel1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_domainlevel2_nonchild_domainlevel1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename>
+
+		<filename>../metadata/delegatedAdmin/delegated_admin_createusers.xml</filename>
+		<filename>../metadata/delegatedAdmin/pickuser_domainlevel2_rootadmin1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part1.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_verify_part2.xml</filename>
+		<filename>../metadata/delegatedAdmin/delegated_admin_cleanup.xml</filename> -->
+<!--	</test> -->
+	
+
+
+</regression>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_cleanup.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_cleanup.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_cleanup.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_cleanup.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,126 @@
+<!--
+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.
+-->
+<delegatedadmin>
+	
+<!--  EXECUTE CLEANUP FOR DOMAINS -->
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>2</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+	<command>
+		<name>listDomains</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>name</name>
+			    <value>0-1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>level1domain1id</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listDomains</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>name</name>
+			    <value>0-2</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>level1domain2id</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deleteUser</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>rootadmin1id</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteUser</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>rootadmin2id</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteDomain</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>level1domain1id</param>
+			</item>
+			<item>
+			    <name>cleanup</name>
+			    <value>true</value>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>deleteDomain</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>level1domain2id</param>
+			</item>
+			<item>
+			    <name>cleanup</name>
+			    <value>true</value>
+			</item>
+		</parameters>
+	</command>
+
+
+</delegatedadmin>	
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_createusers.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_createusers.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_createusers.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_createusers.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,312 @@
+<!--
+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.
+-->
+<delegatedadmin>
+
+<!--  CREATE ALL USERS -->
+
+<!--  Create 3 domains -->
+	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item>
+			    <name>name</name>
+			    <value>0-1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>level1domain1id</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item>
+			    <name>name</name>
+			    <value>0-2</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>level1domain2id</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item>
+			    <name>name</name>
+			    <value>0-1-1</value>
+			</item>
+			<item getparam="true">
+				<name>parentdomainid</name>
+				<param>level1domain1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>level2domain1id</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item>
+			    <name>name</name>
+			    <value>0-2-1</value>
+			</item>
+			<item getparam="true">
+				<name>parentdomainid</name>
+				<param>level1domain2id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>level2domain2id</param>
+			</item>
+		</returnvalue>
+	</command>
+
+
+<!-- Create root admin 1 -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>123@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootadmin1id</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>rootadmin1account</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- Create root admin 2 -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>123@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootadmin2id</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>rootadmin2account</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!-- Create domain admin for domain1 in level 1 -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>123@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>2</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>level1domain1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>domain11adminid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>domain11adminaccount</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!-- Create domain admin for domain2 in level 1 -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>123@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>2</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>level1domain2id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>domain12adminid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>domain12adminaccount</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!-- Create domain admin for domain1 in level 2 -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>123</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>123@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>2</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>level2domain1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>domain21adminid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>domain21adminaccount</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+
+</delegatedadmin>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_verify_part1.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_verify_part1.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_verify_part1.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_verify_part1.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,420 @@
+<!--
+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.
+-->
+<delegatedadmin>
+<!--  EXECUTE INITIAL SET OF COMMANDS AS USER1 -->
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+<!--  VM RELATED COMMANDS -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>		
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  VOLUME RELATED COMMANDS -->
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+<!--  TEMPLATE RELATED COMMANDS - REGISTER AND CREATETEMPLATE COMMANDS -->
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>registerTemplate</name>
+		<testcase>Register template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item random="true">
+				<name>displaytext</name>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globaltemplateurl</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+<!--  ISO RELATED COMMANDS -->
+	<command>
+		<name>registerIso</name>
+		<usercommand>true</usercommand>
+		<testcase>Register iso</testcase>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item random="true" >
+				<name>displaytext</name>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globalisourl</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>53</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>isoid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!--  SNAPSHOT RELATED COMMANDS -->
+	<command>
+		<name>createSnapshot</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid</param>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	<command>
+		<name>createSnapshotPolicy</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item>
+				<name>intervaltype</name>
+				<value>hourly</value>
+			</item>
+			<item>
+				<name>schedule</name>
+				<value>10</value>
+			</item>
+			<item>
+				<name>maxsnaps</name>
+				<value>4</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>Africa/Casablanca</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotpolicyid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  Ip address section -->
+	<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<testcase>Associate ip address</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+
+<!--  Port forwarding section -->
+	<command>
+		<name>createPortForwardingService</name>
+		<testcase>Create port forwarding service</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>none</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingService</name>
+		<testcase>Create port forwarding service</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>none</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfgroupid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase>Create port forwarding service rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+			    <name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+		</returnvalue>
+	</command>		
+
+
+<!--  Load balancer section -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>Create load balancer rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>ipaddress</param>
+			</item>
+			<item randomnumber="true">
+			    <name>privateport</name>
+			</item>
+			<item randomnumber="true">
+			    <name>publicport</name>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>Create load balancer rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>ipaddress</param>
+			</item>
+			<item randomnumber="true">
+			    <name>privateport</name>
+			</item>
+			<item randomnumber="true">
+			    <name>publicport</name>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name> 
+		<testcase>Assign to load balancer</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+</delegatedadmin>	
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_verify_part2.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_verify_part2.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/delegated_admin_verify_part2.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/delegated_admin_verify_part2.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,952 @@
+<!--
+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.
+-->
+<delegated_admin_verify_part2>
+<!--  VERIFY THAT USER2 CAN/CAN'T EXECUTE COMMANDS AGAINST USER1 -->
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  VM RELATED COMMANDS -->	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>Reboot virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>Start virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>Stop virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>Reset password for virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase>Change service offering for virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase>Update virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>List virtual machines</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+			    <name>serviceofferingid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  VOLUME RELATED COMMANDS -->
+	<command>
+		<name>listVolumes</name>
+		<testcase>List volumes</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach volume</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<testcase>Detach volume</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<testcase>Creating volume</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>			
+	
+
+<!--  SNAPSHOT RELATED COMMANDS -->
+	<command>
+		<name>listSnapshots</name>
+		<testcase>List snapshots</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>snapshotid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listSnapshotPolicies</name>
+		<testcase>Listing snapshot policies</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createSnapshotPolicy</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item>
+				<name>intervaltype</name>
+				<value>hourly</value>
+			</item>
+			<item>
+				<name>schedule</name>
+				<value>10</value>
+			</item>
+			<item>
+				<name>maxsnaps</name>
+				<value>4</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>Africa/Casablanca</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  TEMPLATE RELATED COMMANDS - FOR THE TEMPLATE CREATED FROM THE VOLUME-->
+	<command>
+		<name>updateTemplate</name>
+		<testcase>Update template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>hello</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>updateTemplatePermissions</name>
+		<testcase>Update template permissions</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>copyTemplate</name>
+		<testcase>Copy template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>sourcezoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>destzoneid</name>
+				<param>globalzoneid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<testcase>List templates</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplatePermissions</name>
+		<testcase>List template permissions</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>		
+				
+				
+	<!--  TEMPLATE RELATED COMMANDS - FOR THE REGISTERED TEMPLATE-->
+	<command>
+		<name>updateTemplate</name>
+		<testcase>Update template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>hello</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>updateTemplatePermissions</name>
+		<testcase>Update template permissions</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>copyTemplate</name>
+		<testcase>Copy template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>sourcezoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>destzoneid</name>
+				<param>globalzoneid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<testcase>List templates</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplatePermissions</name>
+		<testcase>List template permissions</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+
+<!--  ISO RELATED COMMANDS - FOR THE REGISTERED TEMPLATE-->
+	<command>
+		<name>updateIso</name>
+		<testcase>Update iso</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>isoid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>hello</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listIsos</name>
+		<testcase>List isos</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>isoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>copyIso</name>
+		<testcase>Copy iso</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>isoid</param>
+			</item>
+			<item getparam="true">
+				<name>sourcezoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>destzoneid</name>
+				<param>globalzoneid1</param>
+			</item>
+		</parameters>
+	</command>		
+	
+	<command>
+		<name>attachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>Attaching iso</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>isoid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>detachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>Detaching iso</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- IP ADDRESS SECTION -->
+	<command>
+		<name>listPublicIpAddresses</name>
+		<usercommand>true</usercommand>	
+		<testcase>List public ip addresses</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<testcase>Associate ip address</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!--  PORT FORWARDING SERVICE SECTION -->
+	<command>
+		<name>listPortForwardingServices</name>
+		<testcase>List port forwarding services</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listPortForwardingServiceRules</name>
+		<empty>List port forwarding service rule</empty>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listPortForwardingServicesByVm</name>
+		<testcase>List port forwarding services by vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>		
+
+	<command>
+		<name>removePortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>Remove port forwarding service</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>ipaddress</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>assignPortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>Assigning port forwarding service</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid1</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>ipaddress</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingService</name>
+		<testcase>Create port forwarding service</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>none</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase>Create port forwarding service rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>publicport</name>
+				<value>222</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>222</value>
+			</item>
+			<item getparam="true">
+			    <name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>				
+	
+	<command>
+		<name>deletePortForwardingServiceRule</name>
+		<testcase>Delete port forwarding service rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfruleid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>deletePortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>Deleting port forwarding service</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Load balancer section-->
+	<command>
+		<name>listLoadBalancerRules</name>
+		<testcase>List load balancer rules</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<testcase>List load balancer rule instances</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>removeFromLoadBalancerRule</name>
+		<testcase>Remove from load balancer</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>Assign to load balancer</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid1</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>Delete load balancer rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>Create load balancer rule</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>ipaddress</param>
+			</item>
+			<item randomnumber="true">
+			    <name>privateport</name>
+			</item>
+			<item randomnumber="true">
+			    <name>publicport</name>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!--  Destroy commands - cleanup section-->
+	<command>
+		<name>disassociateIpAddress</name>
+		<usercommand>true</usercommand>	
+		<testcase>Disassociate ip address</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress</param>
+			</item>
+		</parameters>
+	</command>
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase>Deleting snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteSnapshotPolicies</name>
+		<testcase>Deleting snapshot policy</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotpolicyid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>Delete template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>Delete template</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>registeredtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteVolume</name>
+		<testcase>Deleting volume</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteIso</name>
+		<testcase>Delete iso</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>isoid</param>
+			</item>
+		</parameters>
+	</command>					
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+
+</delegated_admin_verify_part2>	
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel1admin_domainlevel1admin.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel1admin_domainlevel1admin.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel1admin_domainlevel1admin.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel1admin_domainlevel1admin.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>domain11adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domain12adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel1admin_rootadmin.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel1admin_rootadmin.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel1admin_rootadmin.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel1admin_rootadmin.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>domain11adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>rootadmin1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel1_domainlevel2.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel1_domainlevel2.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel1_domainlevel2.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel1_domainlevel2.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>domain11adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domain21adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel2_child_domainlevel1.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel2_child_domainlevel1.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel2_child_domainlevel1.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel2_child_domainlevel1.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>domain21adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domain11adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel2_nonchild_domainlevel1.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel2_nonchild_domainlevel1.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel2_nonchild_domainlevel1.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel2_nonchild_domainlevel1.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>domain21adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domain12adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel2_rootadmin1.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel2_rootadmin1.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_domainlevel2_rootadmin1.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_domainlevel2_rootadmin1.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>domain21adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>rootadmin1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_rootadmin1_rootadmin2.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_rootadmin1_rootadmin2.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_rootadmin1_rootadmin2.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_rootadmin1_rootadmin2.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>rootadmin1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>rootadmin2id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_rootadmin_vs_domainlevel1admin.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_rootadmin_vs_domainlevel1admin.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/delegatedAdmin/pickuser_rootadmin_vs_domainlevel1admin.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/delegatedAdmin/pickuser_rootadmin_vs_domainlevel1admin.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,122 @@
+<!--
+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.
+-->
+<pickuser>
+
+<!-- PICK UP THE USERS FOR FUTURE EXECUTION - THIS PART CAN BE MODIFIED WITH DIFFERENT USERIDs -->
+
+<!--  User who executes first set of commands -->
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>rootadmin1id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid1</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype1</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname1</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+
+<!--  User who executes second set of commands -->	
+	<command>
+		<name>listUsers</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domain11adminid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid2</param>
+			</item>
+			<item setparam="true">
+				<name>domainid</name>
+				<param>domainid2</param>
+			</item>
+			<item setparam="true">
+				<name>accounttype</name>
+				<param>accounttype2</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domainid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>domainlevel2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+</pickuser>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/commands ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/commands
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/commands	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/commands	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,191 @@
+# 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.
+
+updateAccount=no
+listAccounts=no
+
+createUser=no
+updateUser=no
+deleteUser=no
+listUsers=no
+disableUser=yes
+enableUser=no
+disableAccount=yes
+enableAccount=no
+lockUser=no
+lockAccount=no
+deleteAccount=yes
+
+createDomain=no
+updateDomain=no
+deleteDomain=yes
+listDomains=no
+listDomainChildren=no
+
+updateResourceLimit=no
+deleteResourceLimit=no
+listResourceLimits=no
+
+deployVirtualMachine=yes
+destroyVirtualMachine=yes
+rebootVirtualMachine=yes
+startVirtualMachine=yes
+stopVirtualMachine=yes
+resetPasswordForVirtualMachine=yes
+changeServiceForVirtualMachine=no
+updateVirtualMachine=no
+recoverVirtualMachine=no
+listVirtualMachines=no
+
+createSnapshot=yes
+deleteSnapshot=yes
+listSnapshots=no
+listRecurringSnapshotSchedule=no
+createVolumeFromSnapshot=yes
+createSnapshotPolicy=no
+deleteSnapshotPolicies=no
+listSnapshotPolicies=no
+
+createTemplate=yes
+registerTemplate=no
+updateTemplate=no
+deleteTemplate=no
+listTemplates=no
+updateTemplatePermissions=no
+listTemplatePermissions=no
+copyTemplate=yes
+
+attachIso=yes
+detachIso=yes
+listIsos=no
+registerIso=no
+updateIso=no
+deleteIso=yes
+copyIso=yes
+
+listOSTypes=no
+
+createServiceOffering=no
+deleteServiceOffering=no
+updateServiceOffering=no
+listServiceOfferings=no
+
+createDiskOffering=no
+updateDiskOffering=no
+deleteDiskOffering=no
+listDiskOfferings=no
+
+createVlan=no
+deleteVlan=no
+
+createVlanIpRange=no
+deleteVlanIpRange=no
+listVlanIpRanges=no
+
+createVlanRange=no
+deleteVlanRange=no
+listVlanRanges=no
+
+associateIpAddress=yes
+disassociateIpAddress=yes
+listPublicIpAddresses=no
+listPrivateIpAddresses=no
+updatePublicIpRange=no
+updatePrivateIpRange=no
+
+createPortForwardingServiceRule=yes
+deletePortForwardingServiceRule=yes
+listPortForwardingServiceRules=no
+createPortForwardingService=no
+deletePortForwardingService=yes
+assignPortForwardingService=yes
+removePortForwardingService=yes
+listPortForwardingServices=no
+listPortForwardingServicesByVm=no
+createPortForwardingRule=no
+deletePortForwardingRule=no
+listPortForwardingRules=no
+updatePortForwardingRule=no
+
+createIpForwardingRule=yes
+deleteIpForwardingRule=yes
+listIpForwardingRules=no
+
+createLoadBalancerRule=no
+deleteLoadBalancerRule=yes
+removeFromLoadBalancerRule=yes
+assignToLoadBalancerRule=yes
+listLoadBalancerRules=no
+listLoadBalancerRuleInstances=no
+
+startRouter=yes
+rebootRouter=yes
+stopRouter=yes
+listRouters=no
+
+startSystemVm=yes
+rebootSystemVm=yes
+stopSystemVm=yes
+listSystemVms=no
+
+updateConfiguration=no
+listConfigurations=no
+
+createPod=no
+updatePod=no
+deletePod=no
+listPods=no
+
+createZone=no
+updateZone=no
+deleteZone=no
+listZones=no
+
+listEvents=no
+
+listAlerts=no
+
+listCapacity=no
+
+addHost=no
+reconnectHost=yes
+deleteHost=no
+prepareHostForMaintenance=yes
+cancelHostMaintenance=yes
+listHosts=no
+addSecondaryStorage=no
+
+attachVolume=yes
+detachVolume=yes
+createVolume=yes
+deleteVolume=no
+listVolumes=no
+
+registerUserKeys=no
+
+queryAsyncJobResult=no
+
+listStoragePools=no
+listStoragePoolsAndHosts=no
+createStoragePool=no
+
+
+createNetworkGroup=no
+revokeNetworkGroupIngress=yes
+authorizeNetworkGroupIngress=yes
+
+createNetwork=no
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/directnw_regression.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/directnw_regression.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/directnw_regression.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/directnw_regression.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1910 @@
+<!--
+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.
+-->
+<sanity>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+	
+	<!-- Test case #   - Create the Account and a User -->
+	
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>nimbus-account</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+		</returnvalue>
+	</command>
+	
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+	
+	<!-- Test case # 3 - Create a User -->
+	
+	<command>
+		<name>createUser</name>
+		<testcase>  3 [Create User Command]</testcase>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>nimbus-account</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>secondusernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>			
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>seconduserid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #950 - listAccounts -->
+	<command>
+		<name>listAccounts</name>
+		<testcase>950 [List the Account of the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #6 - updateUser command -->
+	<command>
+		<name>updateUser</name>
+		<testcase>  6 [Update the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item random="true" setparam="true">
+					<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Updated User updated in (6)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case lockUser command -->
+	<!-- LOCK USER COMMAND IS NO LONGER USED. IT IS BEING COMMENTED FOR RECORDS -->
+	<!-- 
+	<command>
+		<name>lockUser</name>
+		<testcase>    [Lock the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #428 - disableUser command -->
+	<command>
+		<name>disableUser</name>
+		<testcase>428 [Disable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #9 - enableUser command -->
+	<command>
+		<name>enableUser</name>
+		<testcase>  9 [Enable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case # - lockAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Lock the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case # - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Lock the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>false</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case #10 - createDomain command -->
+	<command>
+		<name>createDomain</name>
+		<testcase> 10 [Create Domain]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case #11 - listDomains command -->
+	<command>
+		<name>listDomains</name>
+		<testcase> 11 [List Domains]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!--
+		Test case #952 - updateDomain command - edit domain name and verify
+		that it was really updated
+	-->
+	<command>
+		<name>updateDomain</name>
+		<testcase>952 [Update the Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case # - listDomainChildren command -->
+
+	<command>
+		<name>listDomainChildren</name>
+		<testcase> -   List One of the Children of the Parent Domain - </testcase>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalues list="true">
+			<name>domain</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+	
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->	
+
+	<!-- Test case #654 - deleteDomain command -->
+	<command>
+		<name>deleteDomain</name>
+		<testcase>654 [Delete Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>cleanup</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalues>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List Templates - List System Template]</testcase>
+		<parameters>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<!--<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item> -->
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item setparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item setparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>				
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Verify All the Parameters of the Listed Template -	</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item getparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item getparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case #28 - listServiceOffering command -->
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> 28 [List the Small Instance Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item setparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item setparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>876 [Verify the First Service Offering] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>serviceoffering</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+	<!-- Test case #39 - listZones command -->
+	<command>
+		<name>listZones</name>
+		<testcase> 39 [List the Global Zone with id-2]</testcase>
+
+		<returnvalue list="true">
+			<name>zone</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>internaldns1</name>
+				<param>internaldns1</param>
+			</item>
+			<item>
+				<name>vlan</name>
+			</item>
+			<item>
+				<name>guestcidraddress</name>				
+			</item>
+			<item>
+				<name>networktype</name>
+				<value>Basic</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- ----------------------------------------------------------------------------------------------------------------------------- -->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</sanity>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/error_events.properties ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/error_events.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/error_events.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/error_events.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,32 @@
+# 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.
+
+# All the ERROR level events that need to be checked in EventsApiTest
+
+VM.CREATE=1
+VM.START=1
+VM.STOP=1
+VM.REBOOT=1
+VM.UPGRADE=1
+VM.RESETPASSWORD=1
+ROUTER.CREATE=1
+ROUTER.START=1
+ROUTER.STOP=1
+ROUTER.REBOOT=1
+NET.IPASSIGN=1
+NET.RULEADD=2
+NET.RULEDELETE=2
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/expunge.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/expunge.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/expunge.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/expunge.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1207 @@
+<!--
+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.
+-->
+<expunge>
+
+<!--  VOLUMES EXPUNGE SECTION -->
+<!-- 
+		STEPS/TEST CASES COVERED:
+		1. Create an Account and a User
+		2. Create a Network for that Account
+		3. Deploy a VM in the account
+		4. Acquire an IP Address
+		5. Release the IP Address
+		6. Reboot the VM
+		7. Stop the VM
+		8. Start the VM 
+		9. List Routers
+		10. Stop Router
+		11.	List Router
+		12. Start Router
+		13. Destroy VM
+		14. Verify that vm is destroyed
+		15.	Recover virtual machine
+		16. Verify that vm is recovered
+		17. Delete Account
+		
+	 -->	
+	 <command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>volumesexpungeadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>volumesexpungeadminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 
+	<command>
+		<name>createUser</name>
+		<testcase>Creating user</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  Verify that correct vdis get created on the xen host -->	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploy vm from regular centos template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VolumeExpungeTest-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>List virtual machines</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>vm_hostid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host where vm is running</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vm_hostid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listRouters</name>
+		<testcase>List Routers</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>router_id</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>router_hostid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host where domR is running</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>router_hostid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>routerhost_ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listVolumes</name>
+		<testcase>List data disk vm volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vm_datavolumeid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vm_datavolumename</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select path from volumes</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vm_datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>path</name>
+				<param>vm_datavolumepath</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<testcase>List root disk vm volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vm_rootvolumeid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vm_rootvolumename</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select path from volumes</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm root volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vm_rootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>path</name>
+				<param>vm_rootvolumepath</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select path from volumes</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the domR</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>instance_id</name>
+				<param>router_id</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>path</name>
+				<param>router_rootvolumepath</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for vm DATADISK volume before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>vm_datavolumepath</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for vm ROOT volume before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>vm_rootvolumepath</param>
+			</item>
+		</parameters>
+	</command>			
+		
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for router ROOT volume before domR is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>routerhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>router_rootvolumepath</param>
+			</item>
+		</parameters>
+	</command>			
+
+<!--  Destroy vm created from regular template and verify that vm VDI get destroyed by expunge thread-->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listConfigurations</name>
+		<testcase>Getting expunge interval value</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>expunge.interval</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>value</name>
+				<param>expunge.interval</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for vm DATADISK volume before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>vm_datavolumepath</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for vm ROOT volume before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>vm_rootvolumepath</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Create a volume, delete it and make sure that it get's destroyed right away on the backend -->
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Creating a volume</testcase>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Attach the Volume to an Existing VM</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Detach the Volume from the VM</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createSnapshot</name>
+		<usercommand>true</usercommand>
+		<testcaseid>Create snapshot from detached volume</testcaseid>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid</param>
+			</item>
+			<item setparam="true">
+				<name>path</name>
+				<param>snapshotpath</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select path from volumes</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the detached volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>path</name>
+				<param>detached_volumepath</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for detached volume before the volume is deleted</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>detached_volumepath</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>deleteVolume</name>
+		<testcase>Delete detached volume</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for detached volume after the volume is deleted</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>detached_volumepath</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Verify that snapshot vdi was created on the backend -->
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for snapshot after it's created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>snapshotpath</param>
+			</item>
+		</parameters>
+	</command>							
+	
+	
+<!--  Delete user and make sure that domR volumes/snapshots/templates (private and public) get destroyed on backend -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>Stop the domR</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>router_id</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>			
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for domR after it's destroyed as a part of account cleanup</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>routerhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>router_rootvolumepath</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for snapshot after corresponding account is deleted</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>snapshotpath</param>
+			</item>
+		</parameters>
+	</command>		
+	
+	
+	
+<!--  TEMPLATES EXPUNGE SECTION -->
+<templatesexpunge>
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>Updating storage.cleanup.interval</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>storage.cleanup.interval</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+
+
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Deploy vm, create private template from the ROOT disk, deploy vm from the new template -->	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploying virtual machine from centos template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ExpungeTestVM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>Stop virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template from root volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying virtual machine from the private template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMcreatedfrmTemplate</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>vm_hostid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host where vm is running</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vm_hostid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select install_path from template_spool_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting private template vdi from the db</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_uuid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for template on the xen host before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>template_uuid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine created from the private template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for storage cleanup interval</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for template on the xen host after vm using template is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>template_uuid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!--  Cleanup section -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>Delete private template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>Updating storage.cleanup.interval</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>storage.cleanup.interval</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>60000</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+</templatesexpunge>							
+	
+</expunge>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/external_firewall.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/external_firewall.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/external_firewall.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/external_firewall.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,389 @@
+<!--
+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.
+-->
+<externalfirewall>
+	<command>
+		<name>createAccount</name>
+		<testcase>Creating account</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Create default network-->
+	<command>
+		<name>createNetwork</name>
+		<testcase>Creating default network</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>deploying virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>Associating first public ip address</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip1id</param>
+			</item> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>Associating second public ip address</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip2id</param>
+			</item> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- IP FORWARDING SECTION -->	
+	<command>
+		<name>enableStaticNat</name>
+		<testcase>Enable Static NAT - 1</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item> 
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>		
+		</parameters>
+	</command>
+
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 1</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleeping for 2 mins to ensure that vm comes up for ssh test</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+			<item>
+			    <name>u</name>
+				<value>http://yahoo.com</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- LOAD BALANCER SECTION -->	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>Creating load balancer rule</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicipid</name>
+				<param>nonsourcenatpublicip2id</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>Assigning vm to the load balancer</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineids</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>Deleting the load balancer</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>Dissociating first public ip address</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip1id</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>Dissociating second public ip address</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip2id</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Delete account</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+</externalfirewall>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/flatnetwork.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/flatnetwork.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/flatnetwork.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/flatnetwork.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,533 @@
+<!--
+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.
+-->
+<flatnetwork>
+	<command>
+		<name>createUser</name>
+		<testcase>Creating user</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createNetworkGroup</name>
+		<usercommand>true</usercommand>
+		<testcase>Creating a network group</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>authorizeNetworkGroupIngress</name>
+		<testcase>Authorizing network group ingress</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.1.143/32</value>
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploying vm</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkgrouplist</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploying vm</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkgrouplist</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Creating a volume</testcase>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>flatnetworkdiskofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Attaching the volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>rs-ccb35ea5</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 1 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Stopping vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Starting vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Rebooting vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Detaching volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Attaching the volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+		<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Stopping vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Starting vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Rebooting vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Detaching volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>deleteVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Deleting volume</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Creating a new volume</testcase>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>flatnetworkdiskofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>Attaching the volume to the vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>revokeNetworkGroupIngress</name>
+		<testcase>Revoking network group igress</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.1.143/32</value>
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+		
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail as network group is revoked</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Destroying virutal machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!--  Delete user as a part of cleanup -->	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>			
+
+</flatnetwork>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/ha.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/ha.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/ha.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/ha.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,367 @@
+<!--
+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.
+-->
+<ha>
+
+<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy ha disabled vm</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>HADisabledVM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy ha enabled vm</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>HAEnabledVM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group2</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid_ha</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname_ha</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_ha</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase>Update virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_ha</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Find out hosts ips were vms are running -->
+	<command>
+		<name>listHosts</name>
+		<testcase>List host with ha disabled machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host with ha enabled machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_ha</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_ha</param>
+			</item>
+		</returnvalue>
+	</command>
+
+
+<!--  Get some parameters from the db -->
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Getting internal instance name for the vm with ha disabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Getting internal instance name for the vm with ha enabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_ha</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name_ha</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+<!-- Kill both vms-->
+	<command>
+		<name>killvm.sh</name>
+		<script>true</script>
+		<testcase>Kill ha disabled vm on the backend</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>n</name>
+				<param>instance_name</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>killvm.sh</name>
+		<script>true</script>
+		<testcase>Kill ha enabled vm on the backend</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>ipaddress_ha</param>
+			</item>
+			<item getparam="true">
+			    <name>n</name>
+				<param>instance_name_ha</param>
+			</item>
+		</parameters>
+	</command>	
+
+<!--  Sleep for some time -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!--  Check that vms are running - verify both api and backend  -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>List virtual machine with ha disabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>List virtual machine with ha enabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_ha</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_ha</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host with ha enabled machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_ha</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_ha</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listvm.sh</name>
+		<script>true</script>
+		<testcase>List ha enabled machine</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>ipaddress_ha</param>
+			</item>
+			<item getparam="true">
+			    <name>n</name>
+				<param>instance_name_ha</param>
+			</item>
+		</parameters>
+	</command>					
+		
+			
+
+<!--  Cleanup section - destroy all the vms -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy ha disabled vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy ha enabled vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_ha</param>
+			</item>
+		</parameters>
+	</command>
+	
+</ha>	
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/iso.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/iso.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/iso.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/iso.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,907 @@
+<!--
+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.
+-->
+<isotest>
+
+<!--  Test case 869 - admin attaching iso to user's vm -->
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>2</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ISOTest-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>869-1</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>869-2</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Test case 870 - verify that user2 can't attach iso to user2 vm - Negative case -->
+	
+		<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 	
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	<command>
+		<name>attachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>870</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 871 - try to attach iso to the vm in destroyed state - Negative case -->
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>2</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+		
+	<command>
+		<name>destroyVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachIso</name>
+		<testcase>871</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 872 - try to attach iso to non-existing vm - Negative case -->
+	<command>
+		<name>attachIso</name>
+		<testcase>872</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+			    <name>virtualmachineid</name>
+				<value>600000</value>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!--  Test case 1073 - attach iso to the running vm and reboot -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ISOTest-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachIso</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1073-1</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>1073-2</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  Test case 1074 - attach iso to the running vm and stop/start -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1074-1</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>1074-2</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1074-3</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>1074-4</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Test case 1075 - try to attach iso to the domR - negative case -->
+	<command>
+		<name>listRouters</name>
+		<testcase>35</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>attachIso</name>
+		<testcase>1075</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 1076 - detach iso from Running vm -->
+	<command>
+		<name>detachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>1076</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1077 - detach iso from Stopped vm -->
+	<command>
+		<name>attachIso</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+	</command>
+		
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>detachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>1077</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1078 - deploy vm from iso -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroying vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1078</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globalisoid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ISOTest-VM-3</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  Test case 1079 - deploy vm from iso, detach iso and reboot the vm -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroying vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1079-1</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globalisoid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ISOTest-VM-4</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>1079-2</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1079-3</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>1079-4</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+<!--  Test case 1080 - deploy vm from iso, detach iso and stop/start the vm -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroying vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1080-1</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globalisoid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ISOTest-VM-5</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>isoid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachIso</name>
+		<usercommand>true</usercommand>
+		<testcase>1080-2</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1080-3</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1080-4</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>1080-4</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globalisoid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Execute cleanup -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting user as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroying vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+</isotest>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/loadbalancers.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/loadbalancers.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/loadbalancers.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/loadbalancers.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2036 @@
+<!--
+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.
+-->
+<LoadBalancerRules>
+
+<!-- Test case #853 - port value validation when do create a load balancer -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy Virtual Machine in the admin account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>LoadBalancer-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>	[Acquire a non-Source NAT IP Address for the Admin Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Create Load Balancing Rule -ve test (Private Port 0)]</testcase>
+		<error>true</error>
+		<testcase>853</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>0</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>986</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Create Load Balancing Rule -ve test (Private Port 65536)]</testcase>
+		<error>true</error>
+		<testcase>853</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>65536</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>986</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Create Load Balancing Rule -ve test (Private Port 65536)]</testcase>
+		<error>true</error>
+		<testcase>853</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>0</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Create Load Balancing Rule -ve test (Public Port 65536)]</testcase>
+		<error>true</error>
+		<testcase>853</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>65535</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>65536</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- Test case #919 - algorithm validation when do create a load balancer -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>919 [Create Load Balancing Rule - 1(Set of LB Rules for Algorithm Validation begins)]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9191</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9191</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>919-1 [Create Load Balancing Rule - 2]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9192</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9192</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>leastconn</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>919-2 [Create Load Balancing Rule - 3]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9193</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9193</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<error>true</error>
+		<testcase>919-3 [Create Load Balancing Rule - 4 (Set of LB Rules for Algorithm Validation ends)]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9194</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9194</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobinblahblah</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+
+
+<!-- Test case #920 - verify that the same names are allowed for load balancers belonging to the same account-->
+
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>920-1 [Create Load Balancer Rule]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9201</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9201</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>920-2 [Create a Load Balancer Rule with the Same Name]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9202</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9202</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+
+
+<!-- Test case #921 - verify that the same names for load balancers are allowed across accounts -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>921-1 [Create Load Balancer Rule in one account]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>921</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>921</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>	[List the Created User in that account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 	
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>	[Register User Keys]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>loadbalancersregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>loadbalancersregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy Virtual Machine in that Account]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmidtemp</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>	[Acquire a Non-Source NAT IP Address]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Creating a LB Rule with the same name of a rule in another account]</testcase>
+		<usercommand>true</usercommand>
+		<testcase>921-2</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9211</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9211</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+
+
+<!-- Test case #922 - try to create a load balancer with non-existing ip address -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>922 [Create Load Balancer Rule with Non-existing ip address -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>publicip</name>
+				<value>192.168.0.5</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>922</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>922</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case #923 - try to create a load balancer rule with ip address belonging to different user -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<testcase>923 [Create Load Balancer Rule with Ip Address belonging to different user -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>923</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>923</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+		</parameters>
+	</command>		
+	
+<!-- Test case #924 - create a load balancer with non-source nat ip address -->
+	<command>
+		<name>associateIpAddress</name>
+		<testcase> [Acquire a non-Source NAT Ip address]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>924 [Create Load Balancer Rule from non-Source NAT IP Address]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>924</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>924</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- Test case #925 - try to delete load balancer with non-existing id - negative case-->
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase> [Try to a delete a Non-Existing Load Balancer Rule]</testcase>
+		<error>true</error>
+		<testcase>925</testcase>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>10000</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!-- Test case #926 - verify that admin can delete any rule via 8096 port-->
+	<command>
+			<name>deleteAccount</name>
+			<testcase>	[Delete account]</testcase>
+			<parameters>
+				<item getparam="true">
+				    <name>id</name>
+					<param>accountid</param>
+				</item>
+			</parameters>
+	</command>	
+
+	<command>
+		<name>createAccount</name>
+		<testcase>   [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>   [List the Created User]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>	[Register User Keys]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>loadbalancersregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>loadbalancersregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase> [Deploy Virtual Machine in the account created]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase> [Acquire a non-Source NAT IP Address for that account]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase> [Create Load Balancer Rule with the acquired Ip address]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>name</name>
+				<value>loadb9261</value>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9261</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9261</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase> [Create a Second Load Balancer Rule with the Acquired Ip Address]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>name</name>
+				<value>loadb9262</value>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9262</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9262</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid2</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase> [Create a Third Load Balancer Rule with the Acquired Ip Address]</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>name</name>
+				<value>loadb9263</value>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>9263</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>9263</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid3</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>926 [Admin allowed to Delete Load Balancer Rule of another account via 8096 port]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid1</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!-- Test case #927 - verify that admin can delete any rule via 8080 port-->
+	<command>
+		<name>deleteAccount</name>
+		<testcase>	[Delete Account as a part of Clean Up]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+
+	<command>
+		<name>createAccount</name>
+		<testcase>	[Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase> [List the Created User of the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase> [Register User Keys]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase> [Admin allowed to Delete Load Balancer Rule of another account via 8080 port]</testcase>
+		<usercommand>true</usercommand>
+		<testcase>927</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 928 - verify that regular user can't delete lb rule belonging to another user -->
+	<command>
+		<name>deleteAccount</name>
+		<testcase>	[Delete Account as part of Clean Up]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createAccount</name>
+		<testcase>	[Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>	
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase> [List the Created User of the account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 		
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>	[Register User Keys]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>loadbalancers-regressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>loadbalancers-defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<testcase>928 [Regular User can't Delete LBrule belonging to Another User]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid3</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 939 - verify that you can assign a load balancer to multipe vms -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase> [Deploy a Virtual Machine-1 to check multiple VMs - LB assignment]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>LoadBalancers-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase> [Deploy a Virtual Machine-2 to check multiple VMs - LB assignment]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>LoadBalancers-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase> [Acquire a non-Source NAT IP address]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Create a Load Balancer Rule]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>931</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>931</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>source</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>939 [Assign the First VM to the Load Balancing Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineids</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>939 [Assign the Second VM to the Load Balancing Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineids</name>
+				<param>vmid2</param>
+			</item>
+		</parameters>
+	</command>	
+	
+<!--  Test case 978 - try to create 2 load balancers with the same settings -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>978 [Create Load Balancing Rule (to test the creation of 2 LB Rules with the same settings )]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>978</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>978</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>978 [Creation of Second LoadBalancer Rule should Fail]</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>978</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>978</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+<!--  Test case 1017 - verify that you can create a load balancer with source nat ip address -->
+	<command>
+		<name>listRouters</name>
+		<testcase>	[Obtain the source nat IP Address - List Routers]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>1017 [Create Load Balancer Rule with Source NAT IP Address]</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>1017</value>
+			</item>
+			<item>
+			    <name>publicport</name>
+				<value>1017</value>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item>
+			    <name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!--  Execute cleanup here -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>	[Destroy VM as a Part of Cleanup]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>	[Destroy vm as a part of cleanup]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>	[Destroy vm as a part of cleanup]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>	[Deleting Account as a part of cleanup]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+</LoadBalancerRules>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/localstorage_volume_test.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/localstorage_volume_test.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/localstorage_volume_test.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/localstorage_volume_test.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,153 @@
+<!--
+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.
+-->
+<volumes>
+	<command>
+		<name>deployVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  test case 1027 - try to create a volume in local storage setup (no shared storage) - should fail -->
+	<command>
+		<name>createVolume</name>
+		<testcase>1027</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1032 - try to detach datadisk volume from the Centos vm in local storage setup - should fail -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datadiskvolume</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<testcase>1032</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datadiskvolume</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	
+	<!--  Test case 1034 - try to detach root volume from the Centos vm in local storage setup - should fail -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootdiskvolume</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<testcase>1034</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>rootdiskvolume</param>
+			</item>
+		</parameters>
+	</command>
+	
+		
+	
+	
+	
+</volumes>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/mgmtvmsync.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/mgmtvmsync.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/mgmtvmsync.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/mgmtvmsync.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,651 @@
+<!--
+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.
+-->
+<mgmtvmsync>
+<!-- 1. Deploy two VMs -->
+<!-- 1.1 Deploy HA enabled VM -->
+<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy First VM test case</testcase>
+            
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item>
+				<name>displayname</name>
+				<value>FirstVM</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid_1st</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname_1st</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_1st</param>
+			</item>
+		</returnvalue>
+</command>
+
+<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy Second VM test case</testcase>
+            
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item>
+				<name>displayname</name>
+				<value>SecondVM</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid_2nd</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname_2nd</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_2nd</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 2. Disable HA on the two VMs respectively -->
+<!-- 2.1 Disable HA for First VM -->
+<command>
+		<name>updateVirtualMachine</name>
+		<testcase>HA disable first virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_1st</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>HAdisabledFirstVirtualMachine</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+</command>
+
+<!-- 2.2 Disable HA for Second VM -->
+<command>
+		<name>updateVirtualMachine</name>
+		<testcase>HA disable second virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_2nd</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>HAdisabledSecondVirtualMachine</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>			
+		</parameters>
+</command>
+
+<!-- 3. Obtain the Host IP addresses for the Hosts accommodating the VMs -->
+<!-- 3.1 Obtains the Host IP address of the HA enabled VM's Host machine -->
+<command>
+		<name>listHosts</name>
+		<testcase>Obtain IP address of ha disabled VM's Host Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_1st</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 3.2 Obtains the Host IP address of the HA disabled VM's Host machine -->
+
+<command>
+		<name>listHosts</name>
+		<testcase>Obtain IP address of ha enabled VM's Host Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_2nd</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_2nd</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 4. Get VM instance name of the VMs from the db -->
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Obtaining the internal instance name for the ha disabled VM Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name_1st</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Obtaining the internal instance name for the ha enabled VM Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_2nd</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name_2nd</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 5. Stop the Management Server -->
+
+<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Stopping management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>stop</value>
+			</item>
+		</parameters>
+</command>
+
+	
+
+<!-- 6. Kill the two VMs -->
+
+<command>
+	<name>killvm.sh</name>
+	<testcase>Kill the First HA disabled VM</testcase>
+	<script>true</script>
+	
+	<parameters>
+		<item getparam="true">
+			<name>n</name>
+			<param>instance_name_1st</param>
+		</item>
+		
+		<item getparam="true">
+			<name>h</name>
+			<param>ipaddress_1st</param>
+		</item>
+	</parameters>
+</command>
+
+<command>
+	<name>killvm.sh</name>
+	<testcase>Kill the Second HA disabled VM</testcase>
+	<script>true</script>
+	
+	<parameters>
+		<item getparam="true">
+			<name>n</name>
+			<param>instance_name_2nd</param>
+		</item>
+		
+		<item getparam="true">
+			<name>h</name>
+			<param>ipaddress_2nd</param>
+		</item>
+	</parameters>
+</command>
+
+<!-- 7. Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>100</value>
+			</item>
+		</parameters>
+	</command>	
+
+
+<!-- 8. Start the Management Server -->
+
+<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Starting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>start</value>
+			</item>
+		</parameters>
+</command>
+
+<!--9. Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>100</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!-- 10. Check the Management Server Database for the states of the killed VMs -->
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>Check the stopped status of First virtual machine with ha disabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>			
+		</returnvalue>
+	</command>		
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>Check the stopped status of Second virtual machine with ha disabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_2nd</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			
+		</returnvalue>
+	</command>
+
+<!-- Clean up -->
+<!-- 11. Destroy VMs-->
+<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy the First vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_1st</param>
+			</item>
+		</parameters>
+</command>
+	
+<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy the Second vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_2nd</param>
+			</item>
+		</parameters>
+</command>
+
+
+<!-- SECOND SCENARIO -->
+<!-- 1. Deploy VM -->
+<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy VM test case</testcase>
+            
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item>
+				<name>displayname</name>
+				<value>FirstVM</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid_1st</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname_1st</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_1st</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 2. Obtains the Host IP address of the HA enabled VM's Host machine -->
+<command>
+		<name>listHosts</name>
+		<testcase>Obtain IP address of the VM's Host Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_1st</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+
+<!-- 3. Get VM instance name of the VMs from the db -->
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Obtaining the internal instance name for the VM Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name_1st</param>
+			</item>
+		</returnvalue>
+</command>
+	
+<!-- 4. Stop the Management Server -->
+<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Stopping management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>stop</value>
+			</item>
+		</parameters>
+</command>
+
+<!-- 5. Kill the VM -->
+
+<command>
+	<name>shutdown.sh</name>
+	<testcase>Shut down the VM Test Case</testcase>
+	<script>true</script>
+	
+	<parameters>
+		<item getparam="true">
+			<name>n</name>
+			<param>instance_name_1st</param>
+		</item>
+		
+		<item getparam="true">
+			<name>h</name>
+			<param>ipaddress_1st</param>
+		</item>
+	</parameters>
+</command>
+
+<!-- 6. Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+
+
+<!-- 7. Start the Management Server -->
+<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Starting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>start</value>
+			</item>
+		</parameters>
+</command>
+
+<!-- 8. Wait for some time for the management server to respond -->
+<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+</command>	
+
+<!-- 9. Check the Management Server Database for the state of the killed VM -->
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>Check the stopped status of virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host that is presumed to have the VM Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_1st</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_1st</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listvm.sh</name>
+		<script>true</script>
+		<testcase> VM Not Found on the host Test Case</testcase>
+		<error>true</error>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>ipaddress_1st</param>
+			</item>
+			<item getparam="true">
+			    <name>n</name>
+				<param>instance_name_1st</param>
+			</item>
+		</parameters>
+	</command>							
+
+</mgmtvmsync>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/portforwarding.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/portforwarding.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/portforwarding.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/portforwarding.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1068 @@
+<!--
+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.
+-->
+<portforwardtest>
+
+<!--  make preparations for test - deploy a VM, got an additional ip address -->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>	[Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>pfuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>pfuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>pfuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>	[List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>portforwardingregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>portforwardingregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>pfuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>pfuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>pfuserlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>pfuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy Virtual Machine in the created Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>PortForwarding-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listRouters</name>
+		<testcase>	[List the Created DomR for the Account]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>	[Acquire a new IP Address for the Account]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  Test case 323 - create port forwarding rule for sourcenat ip address -->
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>323 [Create Port Forwarding Rule from Source NAT ip address]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<!--  Test case 324 - create port forwarding rule for non-sourcenate ip address -->
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>324 [Create Port Forwarding Rule from Non-Source NAT ip address]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 325 - create port forwarding rule with protocol TCP -->
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>325 [Create Port Forwarding Rule with TCP protocol]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>23</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>23</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 326 - create port forwarding rule with protocol UDP -->
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>326 [Create Port Forwarding Rule with UDP protocol]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>345</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>345</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>udp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 327 - update existing port forwarding rule -->
+<!-- 
+	<command>
+		<name>updatePortForwardingRule</name>
+		<testcase>327</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>24</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>23</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>udp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+-->	
+<!--  Test case 328 - bug 6159 - verify that you can create portForwarding rules with the same parameters for UDP/TCP -->
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>328 [Create Port Forwarding Rule with TCP protocol] </testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>328 [Create Port Forwarding Rule with same parameters with UDP protocol]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>udp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 329 - delete portForwarding rule -->
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>	[Acquire IP Address for the account (del pf rule exercise begin) ] </testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>	[Create Port Forwarding Rule with the acquired IP Address] </testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip1</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>udp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>portforwardingruleid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deletePortForwardingRule</name>
+		<testcase>329 [Delete Port Forwarding Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>portforwardingruleid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listPortForwardingRules</name>
+		<testcase>329 [Try to list the Deleted Port Forwarding Rules (del pf rule exercise end)]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>
+
+<!--  test case 331 - delete non source nat public ip address and make sure that all port forwarding rules for this ip got removed as well -->
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>	[Create Port Forwarding Rule with the Non-Source NAT IP Address (del ip exercise begin)] </testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip1</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>25</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>udp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>portforwardingruleid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>	[Release the Non-Source NAT IP Address] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listPortForwardingRules</name>
+		<testcase>331 [Try to List the Port Forwarding Rules created from Released IP Address(del ip exercise end)]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>
+	
+<!--  Test case 332 - try to create a port forwarding rule with the parameters that are already in use by existing load balancing rule - Negative case-->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>	[Create Load Balancing Rule Inorder to test PF-LBrule collision (pf-lb collision exercise begin)] </testcase>
+		<parameters>
+		<item getparam="true"> 
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>publicip</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>220</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>220</value>
+		</item>
+		<item>
+			<name>algorithm</name>
+			<value>roundrobin</value>
+		</item>
+		<item random="true">
+			<name>name</name>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>lbid</param>
+		</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>	[Assign the Created LB Rule to the VM created in the Test] </testcase>
+		<parameters>
+		<item getparam="true"> 
+			<name>virtualmachineids</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>id</name>
+			<param>lbid</param>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>	[Create Port Forwarding Rule to test PF-LBrule collision (pf-lb rule collison exercise end)] </testcase>
+		<testcase>332</testcase>
+		<error>true</error>
+		<parameters>
+		<item getparam="true"> 
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>220</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>220</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+<!--  test case 336 - try to add a new port forwarding rule when domR is stopped -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>	[	Stop the DomR (add new pfrule when domR is stopped exercise begin)] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>336 [Create Port Forwarding Rule with the Source NAT IP Address]</testcase>
+		<parameters>
+		<item getparam="true"> 
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>336</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>336</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startRouter</name>
+		<testcase>	[Start the DomR (add new pfrule when domR is stopped exercise end)] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  test case 337 - try to update an existing port forwarding rule when domR is stopped - negative case -->
+
+		<command>
+		<name>createPortForwardingRule</name>
+		<testcase>337 [Create Port Forwarding Rule with the Source NAT IP Address]</testcase>
+		<parameters>
+		<item getparam="true"> 
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>337</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>337</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>portforwardingruleid_forremove</param>
+			</item>
+		</returnvalue>
+	</command>
+<!-- 
+		THIS CASE IS OBSOLETE AS WE NO LONGER ALLOW TO UPDATE A PF RULE
+			
+	<command>
+		<name>stopRouter</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createPortForwardingRule</name>
+		<testcase>337</testcase>
+		<error>true</error>
+		<parameters>
+		<item getparam="true"> 
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>338</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>337</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startRouter</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	
+<!--  Test case 338 - delete existing port forwarding rule while domR is stopped -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>	[Stop the DomR (del pf rule exercise begin)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>deletePortForwardingRule</name>
+		<testcase>338 [Delete Port Forwarding Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>portforwardingruleid_forremove</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startRouter</name>
+		<testcase>	[Start the DomR (del pf rule exercise end)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- Cleanup section -->
+	<command>
+		<name>deleteAccount</name>
+		<testcase>	[Delete Account as part of Clean Up]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+
+</portforwardtest>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/private_templates.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/private_templates.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/private_templates.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/private_templates.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,911 @@
+<!--
+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.
+-->
+<privatetemplates>
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>privateuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>privateuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>privateuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>privatetemplates_regressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>privatetemplates_regressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>PrivateTemplate-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Test case 507 - create a private template for stopped vm -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>507</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Test case 508 - create a private template for Running vm  - negative case-->
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<testcase>508</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 509 - create a private template for Destroyed vm  - negative case-->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<testcase>509</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 510 - deploy a vm from the private template-->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>510</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>PrivateTemplate-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  Test case 511 - Deploy a vm from the private template created from the vm which was deployed from the private template-->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>511</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>PrivateTemplate-VM-3</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  Test case 512 - Try to create 2 templates with the same name for the same account - should be allowed-->
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>512</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 513 - create 2 templates with the same name for different accounts -->
+
+<command>
+		<name>createAccount</name>
+		<testcase>    [Create Different Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam1</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>jack12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar1</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar1</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar1</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar1</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>PrivateTemplate-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>513</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid1</param>
+			</item>
+			<item random="true" getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Execute a cleanup -->	
+	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Deleting First Account as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Deleting Second Account as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountvar1</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- 	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting user as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting user as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid1</param>
+			</item>
+		</parameters>
+	</command>
+
+-->
+	
+</privatetemplates>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_events.properties ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_events.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_events.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_events.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,43 @@
+# 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.
+
+# All the events that need to be created as a result of execution of Regression test
+VM.CREATE=2
+VM.DESTROY=2
+VM.START=2
+VM.STOP=2
+VM.REBOOT=1
+VM.UPGRADE=1
+VM.RESETPASSWORD=1
+ROUTER.CREATE=1
+ROUTER.DESTROY=1
+ROUTER.START=2
+ROUTER.STOP=2
+ROUTER.REBOOT=1
+NET.IPASSIGN=2
+NET.IPRELEASE=2
+SNAPSHOT.CREATE=1
+SNAPSHOT.DELETE=1
+PF.SERVICE.APPLY=1
+PF.SERVICE.REMOVE=1
+TEMPLATE.CREATE=2
+NET.RULEADD=4
+NET.RULEDELETE=4
+VOLUME.CREATE=6
+VOLUME.DELETE=6
+VOLUME.ATTACH=1
+VOLUME.DETACH=1
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_new.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_new.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_new.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_new.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,7672 @@
+<!--
+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.
+-->
+<sanity>
+	<!--
+		Test case#28 's return value need to be changed, if the global service
+		offering id is changed; USE Small Instance, Virtual Networking
+	-->
+	<!-- Delete Test case# 876, merged with 28 -->
+	<!--
+		Test case#39 List Zones...need to be changed if different dns,
+		internal dns and CIDR are given
+	-->
+	<!--
+		Test case 13: It doesnt contain user_data, size, network_group_list
+	-->
+
+	<!-- Test case #3 - createUser command -->
+	<command>
+		<name>createUser</name>
+		<testcase>  3 [Create User Command]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #950 - listAccounts -->
+	<command>
+		<name>listAccounts</name>
+		<testcase>950 [List the Account of the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #6 - updateUser command -->
+	<command>
+		<name>updateUser</name>
+		<testcase>  6 [Update the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Updated User updated in (6)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case lockUser command -->
+	<command>
+		<name>lockUser</name>
+		<testcase>    [Lock the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #428 - disableUser command -->
+	<command>
+		<name>disableUser</name>
+		<testcase>428 [Disable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #9 - enableUser command -->
+	<command>
+		<name>enableUser</name>
+		<testcase>  9 [Enable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #10 - createDomain command -->
+	<command>
+		<name>createDomain</name>
+		<testcase> 10 [Create Domain]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #11 - listDomains command -->
+	<command>
+		<name>listDomains</name>
+		<testcase> 11 [List Domains]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #952 - updateDomain command - edit domain name and verify
+		that it was really updated
+	-->
+	<command>
+		<name>updateDomain</name>
+		<testcase>952 [Update the Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+		</parameters>
+		<returnvalues>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+
+	<command>
+		<name>listDomains</name>
+		<testcase> -   Check the Existence of the Updated Domain - </testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Test case #654 - deleteDomain command -->
+	<command>
+		<name>deleteDomain</name>
+		<testcase>654 [Delete Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>cleanup</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalues>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalues>
+	</command>
+
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List Templates - List System Template]</testcase>
+		<parameters>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item setparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item setparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>				
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Verify All the Parameters of the Listed Template -	</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item getparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item getparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #28 - listServiceOffering command -->
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> 28 [List the Small Instance Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item setparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item setparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item setparam="true">
+				<name>usevirtualnetwork</name>
+				<param>smallofferingusenetwork</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>876 [Verify the First Service Offering] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>serviceoffering</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>usevirtualnetwork</name>
+				<param>smallofferingusenetwork</param>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #39 - listZones command -->
+	<command>
+		<name>listZones</name>
+		<testcase> 39 [List the Global Zone with id-2]</testcase>
+
+		<returnvalue list="true">
+			<name>zone</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>internaldns1</name>
+				<param>internaldns1</param>
+			</item>
+			<item>
+				<name>vlan</name>
+			</item>
+			<item>
+				<name>guestcidraddress</name>
+				<value>10.1.1.0/24</value>
+			</item>
+			<item>
+				<name>networktype</name>
+				<value>Advanced</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #13 - deployVirtualMachine command -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase> 13 [Deploy Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+
+		</returnvalue>
+	</command>
+	
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for a minute </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<!-- Test case #957 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>957 [List Virtual Machines Command]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+			<item>
+				<name>rootdeviceid</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #35 - listRouters command -->
+	<!-- networkdomain - IS NOT RETURNED IF THE NETWORK_DOMAIN IS NULL FOR THE ACCOUNT - uncomment when needed -->
+	<command>
+		<name>listRouters</name>
+		<testcase> 35 [List Routers]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+	 		<item setparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+	 		<item setparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #546 - associateIpAddress command -->
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>546 [Associate IP Address]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>
+			</item>
+			<item>
+				<name>vlanname</name>
+			</item>
+			<item>
+				<name>vlanid</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--  LOAD BALANCING RULES SECTION -->
+
+	<!-- Test case #986 - create a load balancer -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>986 [Create Load Balancer Rule]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>description</name>
+				<value>FirstLoadBalancingRuleCreated</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>FirstLoadBalancingRuleCreated</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #988 - listLoadBalancerRules -->
+	<command>
+		<name>listLoadBalancerRules</name>
+		<testcase>988 [List Load Balancer Rules]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Test case #989 - assignToLoadBalancerRule -->
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>989 [Assign VM the Load Balancer Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!--
+		Test case #987 - deleteLoadBalancerRule; make sure to return the lb
+		rule after the verification
+	-->
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>987 [Load Balancer Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listLoadBalancerRules</name>
+		<empty>true</empty>
+	</command>
+
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase> +   Create a Second Load Balancer Rule + </testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>SecondLoadBalancerRuleCreated</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>SecondLoadBalancerRuleCreated</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase> +   Assign the Second Load Balancer Rule to a VM + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!--
+		Test case #991 - listLoadBalancerRuleInstances; make sure to return
+		the lb rule after the verification
+	-->
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<testcase>991 [List LoadBalancer Rule Instances]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #990 - removeFromLoadBalancerRule -->
+	<command>
+		<name>removeFromLoadBalancerRule</name>
+		<testcase>990 [Remove From Load Balancer Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!--  PORT FORWARDING RULES SECTION -->
+	<!-- Test case #965 - create a security group -->
+<!-- <command>
+		<name>createPortForwardingService</name>
+		<testcase>965 [Create Port Forwarding Service]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #972 - listPortForwardingServices-->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<testcase>972 [List Port Forwarding Service created in (965)] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #967 - create a network rule -->
+<!-- <command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase>967 [Create Port Forwarding Service Rule]</testcase>
+		<parameters>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>isenabled</name>
+				<value>true</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #968 - listPortForwardingServiceRules -->
+<!-- <command>
+		<name>listPortForwardingServiceRules</name>
+		<testcase>968 [List Port Fowarding Service Rules]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #970 - assignPortForwardingService command -->
+<!-- <command>
+		<name>assignPortForwardingService</name>
+		<testcase>970 [Assign Port Forwarding Service created in (967)] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #973 - listPortForwardingServicesByVm command -->
+<!-- <command>
+		<name>listPortForwardingServicesByVm</name>
+		<testcase>973 [List Port Forwarding Services By VM]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #969 - deletePortForwardingServiceRule -->
+<!-- <command>
+		<name>deletePortForwardingServiceRule</name>
+		<testcase>969 [Delete Port Forwarding Service Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listPortForwardingServiceRules</name>
+		<testcase> -   Check for the deleted Port Forwardng Service Rules - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase> +   Create Port Forwarding Service Rule that will be Removed + </testcase>
+		<parameters>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>isenabled</name>
+				<value>true</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #971 - removePortForwardingService command -->
+<!-- <command>
+		<name>removePortForwardingService</name>
+		<testcase>971 [Remove Port Forwarding Service created in (967)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listPortForwardingServicesByVm</name>
+		<testcase> -   Verify the Emptiness of the Port Forwarding Services(byVM) List - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #966 - deletePortForwardingService command -->
+<!-- <command>
+		<name>deletePortForwardingService</name>
+		<testcase>966 [Delete Port Forwarding Service] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #<add number> - listPortForwardingServices command -->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<testcase> -   Verify the Emptiness of the List of Port Forwarding Services - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- VERIFY WHEN THE MANAGEMENT SERVER IS UP!!! -->
+	<!-- Test case #15 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> 15 [List Virtual Machines]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>
+			<item setparam="true">
+				<name>guestosid</name>
+				<param>rootostypeid</param>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+			<item>
+				<name>rootdeviceid</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #16 - rebootVirtualMachine command; verfiy that machine is
+		in Running state after it's rebooted
+	-->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase> 16 [Reboot Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+	 		<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #17 - stopVirtualMachine command; verify that machine is in
+		Stopped state after it's stopped
+	-->
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase> 17 [Stop Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- BUG 6290: waiting for it to be RESOLVED: Until its resolved the diskofferingid is commented -->
+	<!-- VOLUME COMMANDS -->
+	<!--  listVolumes command -->
+	<command>
+		<name>listVolumes</name>
+		<testcase>    [List the ROOT Volume of VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>rootvolumename</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>deviceid</name>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>vmname</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>vmdisplayname</name>
+			</item>
+			<item>
+				<name>vmstate</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>attached</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>Template</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param> 
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+			</item>
+			<item>
+				<name>serviceofferingdisplaytext</name>
+			</item>
+			
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase>    [List the DATA Volume of VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>datavolumename</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>deviceid</name>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>vmname</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>vmdisplayname</name>
+			</item>
+			<item>
+				<name>vmstate</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>DiskOffering</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item>
+				<name>diskofferingname</name>
+			</item>
+			<item>
+				<name>diskofferingdisplaytext</name>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>attached</name>
+			</item>
+			<item>
+				<name>destroyed</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!--
+		Detach volume command - detach volume from the vm and make sure that
+		you don't see it in the list of volumes for this vm
+	-->
+	<command>
+		<name>detachVolume</name>
+		<testcase>    [Detach the DATA Volume of VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase>    [Empty List after Detaching the Volume of VM created in (13)]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!--
+		Create volume command - create a volume and make sure that it appeared
+		in the list
+	-->
+	<command>
+		<name>createVolume</name>
+		<testcase>1026 [Create Volume]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>			
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>None</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>DiskOffering</value>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item>
+				<name>diskofferingname</name>
+			</item>
+			<item>
+				<name>diskofferingdisplaytext</name>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>destroyed</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!--
+		Attach volume command - attach volume to the vm and make sure that you
+		see it in the list of volumes for this vm
+	-->
+	<command>
+		<name>attachVolume</name>
+		<testcase>    [Attach The Created Volume in (1026) to the VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>deviceid</name>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>vmname</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>vmdisplayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>vmstate</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>			
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>DiskOffering</value>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item>
+				<name>diskofferingname</name>
+			</item>
+			<item>
+				<name>diskofferingdisplaytext</name>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>attached</name>
+			</item>
+			<item>
+				<name>destroyed</name>
+				<value>false</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase> -   Check that Data Disk Volume list is not Empty - </testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!--
+		Delete volume command - delete volume and make sure that you don't see
+		it in the list of volumes any more
+	-->
+	<command>
+		<name>createVolume</name>
+		<testcase>    [Create the Volume, Used for Deletion Test]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newthirddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>deleteVolume</name>
+		<testcase> -   Delete the Created Volume - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase> -   Check the Emptiness of the Volumes List - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!--  SNAPSHOT COMMANDS -->
+	<!--
+		Test case #<> - createSnapshot command; verify that snapshot got
+		created
+	-->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>    [Create Snapshot from Data Volume created in (1026)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>snapshottype</name>
+				<value>MANUAL</value>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>volumename</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item>
+				<name>volumetype</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>intervaltype</name>
+				<value>MANUAL</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #26 - listSnapshots command -->
+	<command>
+		<name>listSnapshots</name>
+		<testcase> 26 [List Snapshots]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>snapshottype</name>
+				<value>MANUAL</value>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>volumename</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item>
+				<name>volumetype</name>
+				<param>DATADISK</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>intervaltype</name>
+				<value>MANUAL</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #24 - deleteSnapshot command; verify that you got true, and
+		listSnapshots doesn't display anything
+	-->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase> 24 [Delete the Created Snapshot]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listSnapshots</name>
+		<testcase> -   Check the Emptiness of the Snapshots list - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Test case #958 - createTemplate command -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase> +   Create Snapshot to assist Template creation + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>958 [Create Template from Snapshot] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>snapshotid1</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item getparam="true">
+				<name>osTypeId</name>
+				<param>rootostypeid</param>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>privatetemplatedisplaytext</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>			
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>rootostypeid</param>
+			</item>
+			<item>
+				<name>ostypename</name>
+			</item>
+			<item>
+				<name>account</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+	<!-- BUG 6169 PRESENT: COULDNT VERIFY THE TAGS -->
+	<!-- Under Construction: Can be executed for now -->
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>    [Register template]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>privatetemplatedisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>privatetemplatedisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+			<item getparam="true">
+				<name>accountid</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Processing</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>isextractable</name>
+				<value>true</value>
+			</item>	 		
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for five minutes </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+		
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List the Registered Template]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>privatetemplatedisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>	
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+	 		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplate</name>
+		<testcase>    [Update Template registered in (958)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>UpdatedTemplate</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>TemplateUpdated</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>name</name>
+				<value>TemplateUpdated</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>UpdatedTemplate</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+	 		<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+			<item>
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for four minutes </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>    [List updated template]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>name</name>
+				<value>TemplateUpdated</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>UpdatedTemplate</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+	 		<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+			<item>
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case - listTemplatePermissions command -->
+	<command>
+		<name>listTemplatePermissions</name>
+		<testcase>    [List Template Permissions command]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplatePermissions</name>
+		<testcase>    [Update Template Permissions]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>    [List Template with Updated Permission]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #959 - deleteTemplate command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>959 [Delete Template created in (958)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Check the Emptiness of the Template List - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<!--
+		Test case #20 - changeServiceOffering command; make sure that vm has
+		correct service offering assigned
+	-->
+	<!--  VERIFY THIS TESTCASE AGAIN AFTER THE BUG 6238 IS FIXED -->
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase> 20 [Change Service Offering for Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>			
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>	
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+	 		<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> - Check the change in the Service Offering - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- CONSIDER THE FOLLOWING TEST CASE AT THE LAST -->
+	<!--
+		Test case #19 - resetpassword for virtual machine; make sure the
+		machine is in Running state after it comes back
+	-->
+	<!-- Under Construction: NOT CONSIDERED FOR NOW-->
+	<!-- 
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase> 19 [Reset Password For Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>password</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!--
+		Test case #18 - stop vm than start it; verify that VM status is
+		Running
+	-->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> + Check the Stopped status of VM that needs to be started + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>18 [Start the Stopped VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>				
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>					
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>				
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>					
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #21- enable/disable HA for the VM; verify that HA is enabled
+	-->
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase> + HA Enable on Virtual Machine + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21 [Verify the Update using List VMs]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase> + HA Disable on Virtual Machine + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>				
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>					
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21 [Verify the Update using List VMs]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #547- list IP addresses for the account -->
+	<command>
+		<name>listPublicIpAddresses</name>
+		<testcase>547 [List Public IP Addresses]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>publicipaddress</name>
+			<element>0</element>
+			<item>
+				<name>ipaddress</name>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>true</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>vlanid</name>
+			</item>
+			<item>
+				<name>vlanname</name>
+			</item>
+			<item>
+				<name>isstaticnat</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #548- disassociate ip address -->
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>548 [Disassociate IP Address]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #36- reboot router -->
+	<command>
+		<name>rebootRouter</name>
+		<testcase> 36 [Reboot Router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+	 		<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #37- stop router -->
+	<!-- REMOVE THE COMMENTS AT THE BOTTOM ONCE AFTER THE BUG IS FIXED -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>37 [Stop Router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+	 		<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #38- start router -->
+	<command>
+		<name>startRouter</name>
+		<testcase>38 [Start Router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item getparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item getparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- What to check...here.. -->
+	<!-- Test case #40- list events -->
+	<command>
+		<name>listEvents</name>
+		<testcase>40 [List Events]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>event</name>
+			<element>0</element>
+			<item>
+				<name>id</name>
+			</item>
+			<item>
+				<name>username</name>
+			</item>
+			<item>
+				<name>type</name>
+			</item>
+			<item>
+				<name>level</name>
+			</item>
+			<item>
+				<name>description</name>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+			</item>
+			<item>
+				<name>parentid</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #14- destroy virtualMachine and verify its state -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase> 14 [Destroy Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> -   Verify the Destroyed Status of the Virtual Machine -	</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Destroyed</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #22- recover destroyed virtualMachine and verify that it's
+		state is Stopped after that
+	-->
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>22 [ Recover Virtual Machine ]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> - Verify the Stopped Status of the Recovered VM -</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #549- listConfigurations command -->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>549 [List Configurations]</testcase>
+		<returnvalue list="true">
+			<name>configuration</name>
+			<element>0</element>
+			<item>
+				<name>category</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>value</name>
+			</item>
+			<item>
+				<name>description</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #878- listConfiguarations command with category parameter
+	-->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>878 [List Configurations with category parameter]</testcase>
+		<parameters>
+			<item>
+				<name>category</name>
+				<value>advanced</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>configuration</name>
+			<element>0</element>
+			<item>
+				<name>category</name>
+				<value>Advanced</value>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>value</name>
+			</item>
+			<item>
+				<name>description</name>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!--
+		Test case #550- udpateConfiguration and make sure that the value got
+		updated
+	-->
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>550 [Update Configuration]</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>Successfully updated configuration value.</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listConfigurations</name>
+		<testcase> - Verify the Updated Configuration - </testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>category</name>
+				<value>Advanced</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+			<item>
+				<name>description</name>
+				<value>Time to wait before alerting on a updating agent</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- INCOMPLETE -->
+	<!-- Test case #552- list pods command-->
+	<command>
+		<name>listPods</name>
+		<testcase>552 [List Pods]</testcase>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>POD1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>id</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>POD1</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>cidr</name>
+			</item>
+			<item>
+				<name>startip</name>
+			</item>
+			<item>
+				<name>endip</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #3 - Create User command -->
+	<command>
+		<name>createUser</name>
+		<testcase>3 [Create User]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernamejack</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernamejack</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listAccounts</name>
+		<testcase> - List Accounts - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #951 - updateAccount command -->
+	<command>
+		<name>updateAccount</name>
+		<testcase>951 [Update Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>newname</name>
+				<param>updatedname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>	
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listAccounts</name>
+		<testcase> -  Check the Presence of the Updated Account</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case lockAccount -->
+	<command>
+		<name>lockAccount</name>
+		<testcase>    [Lock Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>	
+		</returnvalue>
+	</command>
+
+	<!-- Test case #7 - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase> 7  [Disable Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>	
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #8 - enableAccount command -->
+	<command>
+		<name>enableAccount</name>
+		<testcase> 8  [Enable Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #953 - createLimit command -->
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>953 [Create using Update Resource Limit]</testcase>
+		<parameters>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #956 - listLimits command -->
+	<command>
+		<name>listResourceLimits</name>
+		<usercommand>true</usercommand>
+		<testcase>956 [Verify the creation using List Resource Limits]</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #954 - updateResourceLimit command -->
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>954 [Update Resource Limit]</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listResourceLimits</name>
+		<testcase> -  Verify the update using List Resource Limits - </testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #932 - createDiskOfferings command -->
+	<command>
+		<name>createDiskOffering</name>
+		<testcase>932 [Create Disk Offering]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>newdiskdesc</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #934 - listDiskOfferings command -->
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase>934 [List the Created Disk Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case # - updateDiskOffering command; verify that name, display
+		name were set
+	-->
+	<command>
+		<name>updateDiskOffering</name>
+		<testcase>Update the Created Disk Offering</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase> -  Verify the Update using List Disk Offering - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!--
+		Test case #933 - deleteDiskOffering command; verify that disk was
+		deleted
+	-->
+	<command>
+		<name>deleteDiskOffering</name>
+		<testcase>933 [Delete Disk Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase> - Verify the Deletion of the Disk Offering - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!-- Test case #4 - deleteUser command -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>4 [Delete User]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Generate an Alert and get back to this test -->
+	<!-- Test case #750 - listAlerts command -->
+	<command>
+		<name>listAlerts</name>
+		<testcase>750 [List Alerts]</testcase>
+		<empty>false</empty>
+	</command>
+
+	<!-- Test case #974 - listCapacity command -->
+	<command>
+		<name>listCapacity</name>
+		<testcase>974 [List Capacity]</testcase>
+		<returnvalue list="true">
+			<name>capacity</name>
+			<element>0</element>
+			<item>
+				<name>type</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>podname</name>
+			</item>
+			<item>
+				<name>capacityused</name>
+			</item>
+			<item>
+				<name>capacitytotal</name>
+			</item>
+			<item>
+				<name>percentused</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #975 - listHosts command -->
+	<command>
+		<name>listHosts</name>
+		<testcase>975 [List Hosts]</testcase>
+		<parameters>
+			<item>
+				<name>type</name>
+				<value>Routing</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>host</name>
+			<element>0</element>
+			<item>
+				<name>id</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>		
+			<item>
+				<name>state</name>
+			</item>
+			<item>
+				<name>disconnected</name>
+			</item>
+			<item>
+				<name>type</name>
+				<value>Routing</value>
+			</item>
+			<item>
+				<name>ipaddress</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>podname</name>
+			</item>
+			<item>
+				<name>version</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+			</item>
+			<item>
+				<name>cpuallocated</name>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>averageload</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>memorytotal</name>
+			</item>
+			<item>
+				<name>memoryallocated</name>
+			</item>
+			<item>
+				<name>memoryused</name>
+			</item>
+			<item>
+				<name>capabilities</name>
+			</item>
+			<item>
+				<name>lastpinged</name>
+			</item>
+			<item>
+				<name>managementserverid</name>
+			</item>
+			<item>
+				<name>clusterid</name>
+			</item>
+			<item>
+				<name>clustername</name>
+			</item>
+			<item>
+				<name>islocalstorageactive</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>events</name>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- BUG 6314:NEEDS TO BE RESOLVED -->
+	<!-- Test case #960 - listIsos command -->
+	<command>
+		<name>listIsos</name>
+		<testcase>960 [List ISOs]</testcase>
+		<returnvalue list="true">
+			<name>iso</name>
+			<element>0</element>
+			<item>
+				<name>id</name>				
+			</item>
+			<item>
+				<name>name</name>
+				<value>xs-tools.iso</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>xen-pv-drv-iso</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+			</item>
+			<item>
+				<name>ostypename</name>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>isostatus</name>
+				<value>Successfully Installed</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #962 - createServiceOffering command -->
+	<command>
+		<name>createServiceOffering</name>
+		<testcase>962 [Create Service Offering]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #964 - updateServiceOffering command -->
+	<command>
+		<name>updateServiceOffering</name>
+		<testcase>964 [Update Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> - Verify the update of the Service Offering - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #963 - deleteServiceOffering command -->
+	<command>
+		<name>deleteServiceOffering</name>
+		<testcase>963-1 [Delete Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>963-2 [List Service Offering]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!-- Test case # - register Iso command -->
+	<command>
+		<name>registerIso</name>
+		<testcase>    [Register ISO]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>Other install media</value>
+			</item>
+			<item>
+				<name>accountid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for five minutes </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<!-- Test case # - listIsos command -->
+	<command>
+		<name>listIsos</name>
+		<testcase>    [List ISOs]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>Ubuntu</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>isostatus</name>
+				<value>Successfully Installed</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>    [Register Template]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globaltemplateurl</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+			</item>
+				<name>created</name>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+ 			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 4.5 (32-bit)</value>
+			</item>
+			<item>
+				<name>accountid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Processing</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>isextractable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--  Test case - listConsoleProxies -->
+	<command>
+		<name>listSystemVms</name>
+		<testcase>    [List system VM (Console Proxy VM)]</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>systemvm</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+				<value>consoleproxy</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #- reboot console proxy -->
+	<command>
+		<name>rebootSystemVm</name>
+		<testcase>    [Reboot System VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+				<value>consoleproxy</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #- stop console proxy -->
+	<command>
+		<name>stopSystemVm</name>
+		<testcase>    [Stop System VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+				<value>consoleproxy</value>
+			</item>			
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #- start console proxy -->
+	<command>
+		<name>startSystemVm</name>
+		<testcase>    [Start System VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!--  Delete iso command -->
+	<command>
+		<name>deleteIso</name>
+		<testcase>   [Delete ISO]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listIsos</name>
+		<testcase>    [List ISOs]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+		
+	</command>
+
+	<!--  Delete template command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>    [Delete template]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>    [List templates]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+	</command>
+
+</sanity>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_test.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_test.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_test.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_test.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,3483 @@
+<!--
+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.
+-->
+<sanity>
+<!-- Test case #3 - createUser command -->
+	<command>
+		<name>createUser</name>
+		<testcase>3</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>username</name>
+			    <param>usernameparam</param>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>alena123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #950 - listAccounts -->
+	<command>
+		<name>listAccounts</name>
+		<testcase>950</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+			</item>
+			<item>
+				<name>vmavailable</name>
+			</item>
+			<item>
+				<name>vmlimit</name>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+			</item>
+			<item>
+				<name>templatelimit</name>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item>
+				<name>iscleanuprequired</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<!-- Test case #6 - updateUser command -->
+	<command>
+		<name>updateUser</name>
+		<testcase>6</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+			<item random="true" setparam="true">
+			    <name>username</name>
+			    <param>newuser</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>5</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>	
+		</returnvalue>
+	</command>	
+	
+	<!-- Test case lockUser command -->
+	<command>
+		<name>lockUser</name>
+		<testcase>Lock user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #428 - disableUser command -->
+	<command>
+		<name>disableUser</name>
+		<testcase>428</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+	
+	<!-- Test case #9 - enableUser command -->
+	<command>
+		<name>enableUser</name>
+		<testcase>9</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #10 - createDomain command -->
+	<command>
+		<name>createDomain</name>
+		<testcase>10</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>domainname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+	
+	<!-- Test case #11 - listDomains command -->
+	<command>
+		<name>listDomains</name>
+		<testcase>11</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!-- Test case #952 - updateDomain command - edit domain name and verify that it was really updated-->
+	<command>
+		<name>updateDomain</name>
+		<testcase>952</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>newdomainname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listDomains</name>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>newdomainname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #654 - deleteDomain command -->
+	<command>
+		<name>deleteDomain</name>
+		<testcase>654</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newdomainid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase>27</testcase>
+		<parameters>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>centos52templateid</param>
+		    </item>
+			<item setparam="true">
+				<name>name</name>
+				<param>centos52templatename</param>
+		    </item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>centos52templatedisplaytext</param>
+		    </item>
+			<item setparam="true">
+				<name>ispublic</name>
+				<param>centos52templateispublic</param>
+		    </item>
+			<item setparam="true">
+				<name>created</name>
+				<param>centos52templatecreated</param>
+		    </item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+		    </item>
+			<item setparam="true">
+				<name>passwordenabled</name>
+				<param>centos52templatepasswordenabled</param>
+		    </item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>centos52templatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>centos52templateid</param>
+		    </item>
+			<item getparam="true">
+				<name>name</name>
+				<param>centos52templatename</param>
+		    </item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>centos52templatedisplaytext</param>
+		    </item>
+			<item getparam="true">
+				<name>ispublic</name>
+				<param>centos52templateispublic</param>
+		    </item>
+			<item getparam="true">
+				<name>created</name>
+				<param>centos52templatecreated</param>
+		    </item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+		    </item>
+			<item getparam="true">
+				<name>passwordenabled</name>
+				<param>centos52templatepasswordenabled</param>
+		    </item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #28 - listServiceOffering command -->
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>28</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+		<name>serviceoffering</name>
+		<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>876</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+		<name>serviceoffering</name>
+		<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+			</item>
+			<item setparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+				<value>1</value>
+			</item>
+			<item setparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+				<value>500</value>
+			</item>
+			<item setparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+				<value>512</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #39 - listZones command -->
+	<command>
+		<name>listZones</name>
+		<testcase>39</testcase>
+		<returnvalue list="true"> 
+			<element>0</element>
+			<name>zone</name>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>name</name>
+				<value>ZONE1</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #13 - deployVirtualMachine command -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>13</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #957 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>957</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>			
+	
+	<!-- Test case #35 - listRouters command -->
+	<command>
+		<name>listRouters</name>
+		<testcase>35</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item setparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true" >
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<!-- Test case #546 - associateIpAddress command -->	
+<!-- <command>
+		<name>associateIpAddress</name>
+		<testcase>546</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<!--  LOAD BALANCING RULES SECTION -->
+	
+	<!-- Test case #986 - create a load balancer -->
+<!-- <command>
+		<name>createLoadBalancerRule</name>
+		<testcase>986</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+-->	
+	<!-- Test case #988 - listLoadBalancerRules -->
+<!-- <command>
+		<name>listLoadBalancerRules</name>
+		<testcase>988</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+	
+ -->		
+	<!-- Test case #989 - assignToLoadBalancerRule -->
+<!-- <command>
+		<name>assignToLoadBalancerRule</name>
+		
+		<testcase>989</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	<!-- Test case #987 - deleteLoadBalancerRule; make sure to return the lb rule after the verification -->
+<!-- <command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>987</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRules</name>
+		<empty>true</empty>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<parameters>
+			<item random="true" setparam="true"> 
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	
+	<!-- Test case #991 - listLoadBalancerRuleInstances; make sure to return the lb rule after the verification -->
+<!-- <command>
+		<name>listLoadBalancerRuleInstances</name>
+		<testcase>991</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	<!-- Test case #990 - removeFromLoadBalancerRule -->
+<!-- <command>
+		<name>removeFromLoadBalancerRule</name>
+		<testcase>990</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	<!--  PORT FORWARDING RULES SECTION -->
+	
+	<!-- Test case #965 - create a security group -->
+<!-- <command>
+		<name>createPortForwardingService</name>
+		<testcase>965</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>pfgroupname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>none</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+		</returnvalue>
+	</command>	
+ -->		
+	<!-- Test case #972 - listPortForwardingServices-->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<testcase>972</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+ -->		
+	<!-- Test case #967 - create a network rule -->
+<!-- <command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase>967</testcase>
+		<parameters>
+			<item>
+			    <name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+			    <name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+		</returnvalue>
+	</command>	
+ -->		
+	<!-- Test case #968 - listPortForwardingServiceRules -->
+<!-- <command>
+		<name>listPortForwardingServiceRules</name>
+		<testcase>968</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	
+	<!-- Test case #970 - assignPortForwardingService command -->
+<!-- <command>
+		<name>assignPortForwardingService</name>
+		<testcase>970</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	<!-- Test case #973 - listPortForwardingServicesByVm command -->
+<!-- <command>
+		<name>listPortForwardingServicesByVm</name>
+		<testcase>973</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	
+	<!-- Test case #969 - deletePortForwardingServiceRule -->
+<!-- <command>
+		<name>deletePortForwardingServiceRule</name>
+		<testcase>969</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfruleid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listPortForwardingServiceRules</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingServiceRule</name>
+		<parameters>
+			<item>
+			    <name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+			    <name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+		</returnvalue>
+	</command>	
+ -->		
+	<!-- Test case #971 - removePortForwardingService command -->
+<!-- <command>
+		<name>removePortForwardingService</name>
+		<testcase>971</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listPortForwardingServicesByVm</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+
+	<!-- Test case #966 - deletePortForwardingService command -->
+<!-- <command>
+		<name>deletePortForwardingService</name>
+		<testcase>966</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	<!-- Test case #<add number> - listPortForwardingServices command -->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>name</name>
+				<param>pfgroupname</param>
+			</item>
+		</parameters>
+	</command>	
+ -->		
+	
+	<!-- Test case #15 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>15</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #16 - rebootVirtualMachine command; verfiy that machine is in Running state after it's rebooted -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>16</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #17 - stopVirtualMachine command; verify that machine is in Stopped state after it's stopped -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>17</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!-- VOLUME COMMANDS -->	
+
+<!--  listVolumes command -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!--  Detach volume command - detach volume from the vm and make sure that you don't see it in the list of volumes for this vm -->
+	<command>
+		<name>detachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Create volume command - create a volume and make sure that it appeared in the list -->
+	<command>
+		<name>createVolume</name>
+		<testcase>1026</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>diskofferingid</name>
+				<value>5</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!--  Attach volume command - attach volume from to the vm and make sure that you see it in the list of volumes for this vm -->
+	<command>
+		<name>attachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Delete volume command - delete volume and make sure that you don't see it in the list of volumes any more -->
+	<command>
+		<name>createVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>diskofferingid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>deleteVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+
+<!--  SNAPSHOT COMMANDS -->	
+	<!-- Test case #<> - createSnapshot command; verify that snapshot got created -->
+	<command>
+		<name>createSnapshot</name>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listSnapshots</name>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #24 - deleteSnapshot command; verify that you got true, and listSnapshots doesn't display anything -->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase>24</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #26 - listSnapshots command -->
+	<command>
+		<name>listSnapshots</name>
+		<testcase>26</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #958 - createTemplate command -->
+	<command>
+		<name>createTemplate</name>
+		<testcase>958</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase>27</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplate</name>
+		<testcase>Update template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>lalala</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>blah</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<testcase>List updated template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>displaytext</name>
+				<value>lalala</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case - listTemplatePermissions command -->
+	<command>
+		<name>listTemplatePermissions</name>
+		<testcase>list template permissions command</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplatePermissions</name>
+		<testcase>update template permissions</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<testcase>List template with updated permission</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #959 - deleteTemplate command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>959</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+	</command>
+	
+
+	
+	<!-- Test case #20 - changeServiceOffering command; make sure that vm has correct service offering assigned -->
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase>20</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #19 - resetpassword for virtual machine; make sure the machine is in Running state after it comes back -->
+<!-- <command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>19</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>password</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<!-- Test case #18 - stop vm than start it; verify that VM status is Running -->
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>18</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #21- enable/disable HA for the VM; verify that HA is enabled -->
+	<command>
+		<name>updateVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>updateVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+	<!-- Test case #547- list IP addresses for the account -->
+<!-- <command>
+		<name>listPublicIpAddresses</name>
+		<testcase>547</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>
+ -->		
+	
+	<!-- Test case #548- disassociate ip address -->
+<!-- <command>
+		<name>disassociateIpAddress</name>
+		<testcase>548</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+ -->		
+	<!-- Test case #36- reboot router -->
+	<command>
+		<name>rebootRouter</name>
+		<testcase>36</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #37- stop router -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>37</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #38- start router -->
+	<command>
+		<name>startRouter</name>
+		<testcase>38</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item getparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item getparam="true">
+				<name>macaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #40- list events -->
+	<command>
+		<name>listEvents</name>
+		<testcase>40</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #14- destroy virtualMachine and verify its state -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>14</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Destroyed</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #22- recover destroyed virtualMachine and verify that it's state is Stopped after that -->
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>22</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #549- listConfigurations command -->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>549</testcase>
+		<empty>false</empty>
+	</command>	
+	
+	<!-- Test case #878- listConfiguarations command with category parameter-->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>878</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item>
+				<name>category</name>
+				<value>advanced</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Test case #550- udpateConfiguration and make sure that the value got updated-->
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>550</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listConfigurations</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!-- Test case #552- list pods command-->
+	<command>
+		<name>listPods</name>
+		<testcase>552</testcase>
+		<parameters>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>	
+	
+	
+<!-- Test case #951 - updateAccount command -->
+	<command>
+		<name>createUser</name>
+		<testcase>3</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listAccounts</name>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>accountname1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>updateAccount</name>
+		<testcase>951</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+			    <name>newname</name>
+			    <param>updatedname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listAccounts</name>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>updatedname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<!-- Test case lockAccount -->
+	<command>
+		<name>lockAccount</name>
+		<testcase>Lock Account</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- Test case #7 - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>7</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>	
+	
+
+<!-- Test case #8 - enableAccount command -->
+	<command>
+		<name>enableAccount</name>
+		<testcase>8</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>		
+	
+	
+<!-- Test case #953 - createLimit command -->	
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>953</testcase>
+		<parameters>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>max</name>
+				<value>300</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	<!-- Test case #956 - listLimits command -->	
+	<command>
+		<name>listResourceLimits</name>
+		<usercommand>true</usercommand>
+		<testcase>956</testcase>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>		
+	
+<!-- Test case #954 - updateResourceLimit command -->	
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>954</testcase>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>max</name>
+				<value>65</value>
+			</item>
+		</parameters>
+	</command>		
+	
+	<command>
+		<name>listResourceLimits</name>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!-- Test case #932 - createDiskOfferings command -->
+	<command>
+		<name>createDiskOffering</name>
+		<testcase>932</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>newdiskname</param>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>newdiskdesc</value>
+			</item>
+			<item>
+			    <name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+			    <name>disksize</name>
+				<value>1099511627776</value>
+			</item>
+			<item>
+			    <name>ismirrored</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+		
+		
+	<!-- Test case #934 - listDiskOfferings command -->
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase>934</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>name</name>
+				<value>newdisk</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<!-- Test case # - updateDiskOffering command; verify that name, display name were set -->
+	<command>
+		<name>updateDiskOffering</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>diskid</param>
+			</item>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>newdiskname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listDiskOfferings</name>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+	
+	<!-- Test case #933 - deleteDiskOffering command; verify that disk was deleted -->
+	<command>
+		<name>deleteDiskOffering</name>
+		<testcase>933</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listDiskOfferings</name>
+		<empty>true</empty>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+	</command>	
+
+	
+<!-- Test case #4 - deleteUser command -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>4</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- Test case #750 - listAlerts command -->
+	<command>
+		<name>listAlerts</name>
+		<testcase>750</testcase>
+		<empty>false</empty>
+	</command>
+	
+<!-- Test case #974 - listCapacity command -->
+	<command>
+		<name>listCapacity</name>
+		<testcase>974</testcase>
+		<empty>false</empty>
+	</command>
+	
+	<!-- Test case #975 - listHosts command -->
+	<command>
+		<name>listHosts</name>
+		<empty>false</empty>
+		<testcase>975</testcase>
+	</command>
+	
+	
+	<!-- Test case #960 - listIsos command -->
+	<command>
+		<name>listIsos</name>
+		<testcase>960</testcase>
+		<empty>true</empty>
+	</command>
+	
+	<!-- Test case #962 - createServiceOffering command -->
+	<command>
+		<name>createServiceOffering</name>
+		<testcase>962</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+			    <name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+			    <name>memory</name>
+				<value>256</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>id</name>
+				<param>soid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>soid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>newofferingid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #964 - updateServiceOffering command -->
+	<command>
+		<name>updateServiceOffering</name>
+		<testcase>964</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>display</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>newofferingid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #963 - deleteServiceOffering command -->
+	<command>
+		<name>deleteServiceOffering</name>
+		<testcase>963-1</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>963-2</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case # - register Iso command -->	
+		<command>
+		<name>registerIso</name>
+		<testcase>Register iso</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>53</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case # - listIsos command -->	
+		<command>
+		<name>listIsos</name>
+		<testcase>List isos</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>Register template</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globaltemplateurl</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Test case - listConsoleProxies -->
+	<command>
+		<name>listSystemVms</name>
+		<testcase>List system vms</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>systemvm</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>zoneid</name>
+			</item>
+			<item>
+				<name>zonename</name>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #- reboot console proxy -->
+	<command>
+		<name>rebootSystemVm</name>
+		<testcase>Reboot system vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #- stop console proxy -->
+	<command>
+		<name>stopSystemVm</name>
+		<testcase>Stop system vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #- start console proxy -->
+	<command>
+		<name>startSystemVm</name>
+		<testcase>Start system vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!--  Delete iso command -->
+	<command>
+		<name>deleteIso</name>
+		<testcase>Delete iso</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listIsos</name>
+		<testcase>List isos</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Delete template command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>Delete template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>List templates</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+	</command>
+
+	
+</sanity>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_user.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_user.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_user.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_user.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2382 @@
+<!--
+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.
+-->
+<sanity>
+
+<!-- Test case #   - Create the Account and a User -->
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>user@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>userlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>user@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- Test case #3 - createUser command -->
+<!-- <command>
+		<name>createUser</name>
+		<testcase>3</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>username</name>
+			    <param>usernameparam</param>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>alena123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>regression_user_network</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>regression_user_network</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #950 - listAccounts -->
+	<command>
+		<name>listAccounts</name>
+		<usercommand>true</usercommand>
+		<testcase>950</testcase>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+			</item>
+			<item>
+				<name>vmavailable</name>
+			</item>
+			<item>
+				<name>vmlimit</name>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+			</item>
+			<item>
+				<name>templatelimit</name>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+			</item>
+		</returnvalue>
+	</command>	
+
+	
+	<!-- Test case #13 - deployVirtualMachine command -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>13</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>RegularUser-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>RegularUser-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #957 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<testcase>957</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>RegularUser-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>			
+	
+	<!-- Test case #35 - listRouters command -->
+	<command>
+		<name>listRouters</name>
+		<testcase>35</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item setparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true" >
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<!-- Test case #546 - associateIpAddress command -->	
+	<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<testcase>546</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!--  LOAD BALANCING RULES SECTION -->
+	
+	<!-- Test case #986 - create a load balancer -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<testcase>986</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicipid</name>
+				<param>sourcenatpublicipid</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!-- Test case #988 - listLoadBalancerRules -->
+	<command>
+		<name>listLoadBalancerRules</name>
+		<usercommand>true</usercommand>
+		<testcase>988</testcase>
+		<empty>false</empty>
+	</command>
+	
+	
+	<!-- Test case #989 - assignToLoadBalancerRule -->
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<testcase>989</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #987 - deleteLoadBalancerRule; make sure to return the lb rule after the verification -->
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<testcase>987</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRules</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true" setparam="true"> 
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<!-- Test case #991 - listLoadBalancerRuleInstances; make sure to return the lb rule after the verification -->
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<usercommand>true</usercommand>
+		<testcase>991</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #990 - removeFromLoadBalancerRule -->
+	<command>
+		<name>removeFromLoadBalancerRule</name>
+		<usercommand>true</usercommand>
+		<testcase>990</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!--  PORT FORWARDING RULES SECTION -->
+	
+	<!-- Test case #965 - create a security group -->
+<!-- 	I NEED TO TAKE ADVICE FROM ALENA BEFORE I GO AHEAD WITH THIS SECTION
+		
+		<command>
+		<name>createPortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>965</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>pfgroupname</param>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>none</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+		</returnvalue>
+	</command>	
+-->	
+	<!-- Test case #972 - listPortForwardingServices-->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<usercommand>true</usercommand>
+		<testcase>972</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>pfgroupname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+-->	
+	<!-- Test case #967 - create a network rule -->
+<!-- 	<command>
+		<name>createPortForwardingServiceRule</name>
+		<usercommand>true</usercommand>
+		<testcase>967</testcase>
+		<parameters>
+			<item>
+			    <name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+			    <name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+		</returnvalue>
+	</command>	
+-->	
+	<!-- Test case #968 - listPortForwardingServiceRules -->
+<!-- <command>
+		<name>listPortForwardingServiceRules</name>
+		<usercommand>true</usercommand>
+		<testcase>968</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+-->	
+	
+	<!-- Test case #970 - assignPortForwardingService command -->
+<!-- 	<command>
+		<name>assignPortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>970</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+-->	
+	<!-- Test case #973 - listPortForwardingServicesByVm command -->
+<!-- 	<command>
+		<name>listPortForwardingServicesByVm</name>
+		<usercommand>true</usercommand>
+		<testcase>973</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+-->	
+	
+	<!-- Test case #969 - deletePortForwardingServiceRule -->
+<!-- 	<command>
+		<name>deletePortForwardingServiceRule</name>
+		<usercommand>true</usercommand>
+		<testcase>969</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfruleid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listPortForwardingServiceRules</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingServiceRule</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+			    <name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+			    <name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+			    <name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+		</returnvalue>
+	</command>	
+-->	
+	<!-- Test case #971 - removePortForwardingService command -->
+<!-- 	<command>
+		<name>removePortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>971</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listPortForwardingServicesByVm</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>	
+-->	
+
+	<!-- Test case #966 - deletePortForwardingService command -->
+<!-- 	<command>
+		<name>deletePortForwardingService</name>
+		<usercommand>true</usercommand>
+		<testcase>966</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>	
+-->	
+	<!-- Test case #<add number> - listPortForwardingServices command -->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>name</name>
+				<param>pfgroupname</param>
+			</item>
+		</parameters>
+	</command>	
+-->	
+	
+	<!-- Test case #15 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<testcase>15</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #16 - rebootVirtualMachine command; verfiy that machine is in Running state after it's rebooted -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>16</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #17 - stopVirtualMachine command; verify that machine is in Stopped state after it's stopped -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>17</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!-- VOLUME COMMANDS -->	
+
+<!--  listVolumes command -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!--  Detach volume command - detach volume from the vm and make sure that you don't see it in the list of volumes for this vm -->
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Create volume command - create a volume and make sure that it appeared in the list -->
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1026</testcase>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!--  Attach volume command - attach volume from to the vm and make sure that you see it in the list of volumes for this vm -->
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<usercommand>true</usercommand>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Delete volume command - delete volume and make sure that you don't see it in the list of volumes any more -->
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>deleteVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+
+<!--  SNAPSHOT COMMANDS -->	
+	<!-- Test case #<> - createSnapshot command; verify that snapshot got created -->
+	<command>
+		<name>createSnapshot</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listSnapshots</name>
+		<usercommand>true</usercommand>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #24 - deleteSnapshot command; verify that you got true, and listSnapshots doesn't display anything -->
+	<command>
+		<name>deleteSnapshot</name>
+		<usercommand>true</usercommand>
+		<testcase>24</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #26 - listSnapshots command -->
+	<command>
+		<name>listSnapshots</name>
+		<usercommand>true</usercommand>
+		<testcase>26</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #958 - createTemplate command -->
+	<command>
+		<name>createSnapshot</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>958</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>snapshotid1</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<usercommand>true</usercommand>
+		<testcase>27</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>Update template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>blahblahblah</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>blah</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<usercommand>true</usercommand>
+		<testcase>List updated template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>displaytext</name>
+				<value>blahblahblah</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case - listTemplatePermissions command -->
+	<command>
+		<name>listTemplatePermissions</name>
+		<usercommand>true</usercommand>
+		<testcase>list template permissions command</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplatePermissions</name>
+		<usercommand>true</usercommand>
+		<testcase>update template permissions</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<usercommand>true</usercommand>
+		<testcase>List template with updated permission</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #959 - deleteTemplate command -->
+	<command>
+		<name>deleteTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>959</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase> Stop the VM before changing the Service</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #20 - changeServiceOffering command; make sure that vm has correct service offering assigned -->
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>20</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #19 - resetpassword for virtual machine; make sure the machine is in Running state after it comes back -->
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>19</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>password</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #18 - stop vm than start it; verify that VM status is Running -->
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>18</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #21- enable/disable HA for the VM; verify that HA is enabled -->
+	<command>
+		<name>updateVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<testcase>21</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>updateVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<testcase>21</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+	<!-- Test case #547- list IP addresses for the account -->
+	<command>
+		<name>listPublicIpAddresses</name>
+		<usercommand>true</usercommand>
+		<testcase>547</testcase>
+	</command>
+	
+	
+	<!-- Test case #548- disassociate ip address -->
+	<command>
+		<name>disassociateIpAddress</name>
+		<usercommand>true</usercommand>
+		<testcase>548</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Test case #40- list events -->
+	<command>
+		<name>listEvents</name>
+		<usercommand>true</usercommand>
+		<testcase>40</testcase>
+	</command>
+	
+	<!-- Test case #14- destroy virtualMachine and verify its state -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>14</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case # - register Iso command -->	
+		<command>
+		<name>registerIso</name>
+		<usercommand>true</usercommand>
+		<testcase>Register iso</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>globalisoid</param>
+			</item>
+		</parameters>
+				<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>128</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case # - listIsos command -->	
+		<command>
+		<name>listIsos</name>
+		<usercommand>true</usercommand>
+		<testcase>List isos</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>Register template</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>132</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Delete iso command -->
+	<command>
+		<name>deleteIso</name>
+		<usercommand>true</usercommand>
+		<testcase>Delete iso</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listIsos</name>
+		<usercommand>true</usercommand>
+		<testcase>List isos</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Delete template command -->
+	<command>
+		<name>deleteTemplate</name>
+		<usercommand>true</usercommand>
+		<testcase>Delete template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<usercommand>true</usercommand>
+		<testcase>List templates</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+	</command>
+
+	
+</sanity>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_works.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_works.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression_works.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression_works.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,8418 @@
+<!--
+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.
+-->
+<sanity>
+
+<!--  -->	
+	
+	<!-- Test case #   - Create the Account and a User -->
+	
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+		</returnvalue>
+	</command>
+	
+<!--  -->	
+	
+	<!-- Test case # 3 - Create a User -->
+	
+	<command>
+		<name>createUser</name>
+		<testcase>  3 [Create User Command]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<value>accountname</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>secondusernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>			
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>seconduserid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case #950 - listAccounts -->
+	<command>
+		<name>listAccounts</name>
+		<testcase>950 [List the Account of the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case #6 - updateUser command -->
+	<command>
+		<name>updateUser</name>
+		<testcase>  6 [Update the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item random="true" setparam="true">
+					<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Updated User updated in (6)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case lockUser command -->
+	<!-- LOCK USER COMMAND IS NO LONGER USED. IT IS BEING COMMENTED FOR RECORDS -->
+	<!-- 
+	<command>
+		<name>lockUser</name>
+		<testcase>    [Lock the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+
+<!--  -->	
+
+	<!-- Test case #428 - disableUser command -->
+	<command>
+		<name>disableUser</name>
+		<testcase>428 [Disable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case #9 - enableUser command -->
+	<command>
+		<name>enableUser</name>
+		<testcase>  9 [Enable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->	
+
+	<!-- Test case # - lockAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Lock the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case # - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Lock the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>false</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case #10 - createDomain command -->
+	<command>
+		<name>createDomain</name>
+		<testcase> 10 [Create Domain]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case #11 - listDomains command -->
+	<command>
+		<name>listDomains</name>
+		<testcase> 11 [List Domains]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!--
+		Test case #952 - updateDomain command - edit domain name and verify
+		that it was really updated
+	-->
+	<command>
+		<name>updateDomain</name>
+		<testcase>952 [Update the Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+
+<!--  -->
+
+	<!-- Test case # - listDomainChildren command -->
+
+	<command>
+		<name>listDomainChildren</name>
+		<testcase> -  [List One of the Children of the Parent Domain] </testcase>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalues list="true">
+			<name>domain</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+	
+<!--  -->	
+
+	<!-- Test case #654 - deleteDomain command -->
+	<command>
+		<name>deleteDomain</name>
+		<testcase>654 [Delete Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>cleanup</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalues>
+	</command>
+
+<!--  -->
+
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List Templates - List System Template]</testcase>
+		<parameters>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<!--<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item> -->
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item setparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item setparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>				
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Verify All the Parameters of the Listed Template -	</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item getparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item getparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case #28 - listServiceOffering command -->
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> 28 [List the Small Instance Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item setparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item setparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>876 [Verify the First Service Offering] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>serviceoffering</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!--  -->
+
+	<!-- Test case #39 - listZones command -->
+	<command>
+		<name>listZones</name>
+		<testcase> 39 [List the Global Zone with id-2]</testcase>
+
+		<returnvalue list="true">
+			<name>zone</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>internaldns1</name>
+				<param>internaldns1</param>
+			</item>
+			<item>
+				<name>vlan</name>
+			</item>
+			<item>
+				<name>guestcidraddress</name>				
+			</item>
+			<item>
+				<name>networktype</name>
+				<value>Advanced</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- I WORKED TILL HERE >>> WORK NEEDS TO BE RESUMED HERE -->
+
+	<!-- Test case #13 - deployVirtualMachine command -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase> 13 [Deploy Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+
+		</returnvalue>
+	</command>
+	
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for a minute </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<!-- Test case #957 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>957 [List Virtual Machines Command]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+			<item>
+				<name>rootdeviceid</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #35 - listRouters command -->
+	<!-- networkdomain - IS NOT RETURNED IF THE NETWORK_DOMAIN IS NULL FOR THE ACCOUNT - uncomment when needed -->
+	<command>
+		<name>listRouters</name>
+		<testcase> 35 [List Routers]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+	 		<item setparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+	 		<item setparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #546 - associateIpAddress command -->
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>546 [Associate IP Address]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>
+			</item>
+			<item>
+				<name>vlanname</name>
+			</item>
+			<item>
+				<name>vlanid</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--  LOAD BALANCING RULES SECTION -->
+
+	<!-- Test case #986 - create a load balancer -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>986 [Create Load Balancer Rule]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>description</name>
+				<value>FirstLoadBalancingRuleCreated</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>FirstLoadBalancingRuleCreated</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #988 - listLoadBalancerRules -->
+	<command>
+		<name>listLoadBalancerRules</name>
+		<testcase>988 [List Load Balancer Rules]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Test case #989 - assignToLoadBalancerRule -->
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>989 [Assign VM the Load Balancer Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!--
+		Test case #987 - deleteLoadBalancerRule; make sure to return the lb
+		rule after the verification
+	-->
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>987 [Load Balancer Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listLoadBalancerRules</name>
+		<empty>true</empty>
+	</command>
+
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase> +   Create a Second Load Balancer Rule + </testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>SecondLoadBalancerRuleCreated</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>SecondLoadBalancerRuleCreated</value>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase> +   Assign the Second Load Balancer Rule to a VM + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!--
+		Test case #991 - listLoadBalancerRuleInstances; make sure to return
+		the lb rule after the verification
+	-->
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<testcase>991 [List LoadBalancer Rule Instances]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #990 - removeFromLoadBalancerRule -->
+	<command>
+		<name>removeFromLoadBalancerRule</name>
+		<testcase>990 [Remove From Load Balancer Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!--  PORT FORWARDING RULES SECTION -->
+	<!-- Test case #965 - create a security group -->
+<!-- <command>
+		<name>createPortForwardingService</name>
+		<testcase>965 [Create Port Forwarding Service]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #972 - listPortForwardingServices-->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<testcase>972 [List Port Forwarding Service created in (965)] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>none</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #967 - create a network rule -->
+<!-- <command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase>967 [Create Port Forwarding Service Rule]</testcase>
+		<parameters>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>isenabled</name>
+				<value>true</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #968 - listPortForwardingServiceRules -->
+<!-- <command>
+		<name>listPortForwardingServiceRules</name>
+		<testcase>968 [List Port Fowarding Service Rules]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #970 - assignPortForwardingService command -->
+<!-- <command>
+		<name>assignPortForwardingService</name>
+		<testcase>970 [Assign Port Forwarding Service created in (967)] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #973 - listPortForwardingServicesByVm command -->
+<!-- <command>
+		<name>listPortForwardingServicesByVm</name>
+		<testcase>973 [List Port Forwarding Services By VM]</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #969 - deletePortForwardingServiceRule -->
+<!-- <command>
+		<name>deletePortForwardingServiceRule</name>
+		<testcase>969 [Delete Port Forwarding Service Rule]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listPortForwardingServiceRules</name>
+		<testcase> -   Check for the deleted Port Forwardng Service Rules - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>createPortForwardingServiceRule</name>
+		<testcase> +   Create Port Forwarding Service Rule that will be Removed + </testcase>
+		<parameters>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>pfruleid</param>
+			</item>
+			<item>
+				<name>publicport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>privateport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>isenabled</name>
+				<value>true</value>
+			</item>
+			<item getparam="true">
+				<name>portforwardingserviceid</name>
+				<param>pfgroupid</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!-- Test case #971 - removePortForwardingService command -->
+<!-- <command>
+		<name>removePortForwardingService</name>
+		<testcase>971 [Remove Port Forwarding Service created in (967)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listPortForwardingServicesByVm</name>
+		<testcase> -   Verify the Emptiness of the Port Forwarding Services(byVM) List - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #966 - deletePortForwardingService command -->
+<!-- <command>
+		<name>deletePortForwardingService</name>
+		<testcase>966 [Delete Port Forwarding Service] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- Test case #<add number> - listPortForwardingServices command -->
+<!-- <command>
+		<name>listPortForwardingServices</name>
+		<testcase> -   Verify the Emptiness of the List of Port Forwarding Services - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>pfgroupid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>pfgroupname</param>
+			</item>
+		</parameters>
+	</command>
+-->
+	<!-- VERIFY WHEN THE MANAGEMENT SERVER IS UP!!! -->
+	<!-- Test case #15 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> 15 [List Virtual Machines]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>
+			<item setparam="true">
+				<name>guestosid</name>
+				<param>rootostypeid</param>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+			<item>
+				<name>rootdeviceid</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #16 - rebootVirtualMachine command; verfiy that machine is
+		in Running state after it's rebooted
+	-->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase> 16 [Reboot Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+	 		<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #17 - stopVirtualMachine command; verify that machine is in
+		Stopped state after it's stopped
+	-->
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase> 17 [Stop Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>vmcreated</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- BUG 6290: waiting for it to be RESOLVED: Until its resolved the diskofferingid is commented -->
+	<!-- VOLUME COMMANDS -->
+	<!--  listVolumes command -->
+	<command>
+		<name>listVolumes</name>
+		<testcase>    [List the ROOT Volume of VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>rootvolumename</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>deviceid</name>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>vmname</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>vmdisplayname</name>
+			</item>
+			<item>
+				<name>vmstate</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>attached</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>Template</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param> 
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+			</item>
+			<item>
+				<name>serviceofferingdisplaytext</name>
+			</item>
+			
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase>    [List the DATA Volume of VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>datavolumename</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>deviceid</name>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>vmname</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>vmdisplayname</name>
+			</item>
+			<item>
+				<name>vmstate</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>DiskOffering</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item>
+				<name>diskofferingname</name>
+			</item>
+			<item>
+				<name>diskofferingdisplaytext</name>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>attached</name>
+			</item>
+			<item>
+				<name>destroyed</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!--
+		Detach volume command - detach volume from the vm and make sure that
+		you don't see it in the list of volumes for this vm
+	-->
+	<command>
+		<name>detachVolume</name>
+		<testcase>    [Detach the DATA Volume of VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase>    [Empty List after Detaching the Volume of VM created in (13)]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!--
+		Create volume command - create a volume and make sure that it appeared
+		in the list
+	-->
+	<command>
+		<name>createVolume</name>
+		<testcase>1026 [Create Volume]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>			
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>None</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>DiskOffering</value>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item>
+				<name>diskofferingname</name>
+			</item>
+			<item>
+				<name>diskofferingdisplaytext</name>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>destroyed</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!--
+		Attach volume command - attach volume to the vm and make sure that you
+		see it in the list of volumes for this vm
+	-->
+	<command>
+		<name>attachVolume</name>
+		<testcase>    [Attach The Created Volume in (1026) to the VM created in (13)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>deviceid</name>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>vmname</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>vmdisplayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item>
+				<name>vmstate</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Created</value>
+			</item>			
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>sourceid</name>
+			</item>
+			<item>
+				<name>sourcetype</name>
+				<value>DiskOffering</value>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+			<item>
+				<name>diskofferingname</name>
+			</item>
+			<item>
+				<name>diskofferingdisplaytext</name>
+			</item>
+			<item>
+				<name>storage</name>
+				<value>primary storage</value>
+			</item>
+			<item>
+				<name>attached</name>
+			</item>
+			<item>
+				<name>destroyed</name>
+				<value>false</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase> -   Check that Data Disk Volume list is not Empty - </testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!--
+		Delete volume command - delete volume and make sure that you don't see
+		it in the list of volumes any more
+	-->
+	<command>
+		<name>createVolume</name>
+		<testcase>    [Create the Volume, Used for Deletion Test]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newthirddiskvolume</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>deleteVolume</name>
+		<testcase> -   Delete the Created Volume - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVolumes</name>
+		<testcase> -   Check the Emptiness of the Volumes List - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!--  SNAPSHOT COMMANDS -->
+	<!--
+		Test case #<> - createSnapshot command; verify that snapshot got
+		created
+	-->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>    [Create Snapshot from Data Volume created in (1026)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>snapshottype</name>
+				<value>MANUAL</value>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>volumename</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item>
+				<name>volumetype</name>
+				<value>DATADISK</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>intervaltype</name>
+				<value>MANUAL</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #26 - listSnapshots command -->
+	<command>
+		<name>listSnapshots</name>
+		<testcase> 26 [List Snapshots]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>snapshottype</name>
+				<value>MANUAL</value>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>volumename</name>
+				<param>newseconddiskvolume</param>
+			</item>
+			<item>
+				<name>volumetype</name>
+				<param>DATADISK</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>intervaltype</name>
+				<value>MANUAL</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #24 - deleteSnapshot command; verify that you got true, and
+		listSnapshots doesn't display anything
+	-->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase> 24 [Delete the Created Snapshot]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listSnapshots</name>
+		<testcase> -   Check the Emptiness of the Snapshots list - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Test case #958 - createTemplate command -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase> +   Create Snapshot to assist Template creation + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>958 [Create Template from Snapshot] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>snapshotid1</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item getparam="true">
+				<name>osTypeId</name>
+				<param>rootostypeid</param>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>privatetemplatedisplaytext</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>			
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>rootostypeid</param>
+			</item>
+			<item>
+				<name>ostypename</name>
+			</item>
+			<item>
+				<name>account</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+	<!-- BUG 6169 PRESENT: COULDNT VERIFY THE TAGS -->
+	<!-- Under Construction: Can be executed for now -->
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>    [Register template]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>privatetemplatedisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>privatetemplatedisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+			<item getparam="true">
+				<name>accountid</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Processing</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>isextractable</name>
+				<value>true</value>
+			</item>	 		
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for five minutes </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+		
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List the Registered Template]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>privatetemplatedisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>	
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+	 		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplate</name>
+		<testcase>    [Update Template registered in (958)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>UpdatedTemplate</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>TemplateUpdated</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>name</name>
+				<value>TemplateUpdated</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>UpdatedTemplate</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+	 		<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+			<item>
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for four minutes </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>    [List updated template]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>name</name>
+				<value>TemplateUpdated</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>UpdatedTemplate</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+	 		<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 5.3 (64-bit)</value>
+			</item>
+			<item>
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case - listTemplatePermissions command -->
+	<command>
+		<name>listTemplatePermissions</name>
+		<testcase>    [List Template Permissions command]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplatePermissions</name>
+		<testcase>    [Update Template Permissions]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>    [List Template with Updated Permission]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #959 - deleteTemplate command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>959 [Delete Template created in (958)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Check the Emptiness of the Template List - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<!--
+		Test case #20 - changeServiceOffering command; make sure that vm has
+		correct service offering assigned
+	-->
+	<!--  VERIFY THIS TESTCASE AGAIN AFTER THE BUG 6238 IS FIXED -->
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase> 20 [Change Service Offering for Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>			
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>	
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+	 		<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> - Check the change in the Service Offering - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- CONSIDER THE FOLLOWING TEST CASE AT THE LAST -->
+	<!--
+		Test case #19 - resetpassword for virtual machine; make sure the
+		machine is in Running state after it comes back
+	-->
+	<!-- Under Construction: NOT CONSIDERED FOR NOW-->
+	<!-- 
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase> 19 [Reset Password For Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>password</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+	<!--
+		Test case #18 - stop vm than start it; verify that VM status is
+		Running
+	-->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> + Check the Stopped status of VM that needs to be started + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>18 [Start the Stopped VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>				
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>					
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>				
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>					
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #21- enable/disable HA for the VM; verify that HA is enabled
+	-->
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase> + HA Enable on Virtual Machine + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21 [Verify the Update using List VMs]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase> + HA Disable on Virtual Machine + </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>Testcase13-VM</value>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>groupid</name>
+			</item>
+			<item>
+				<name>group</name>
+				<value>Testcase13</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>templatename</name>
+			</item>
+			<item>
+				<name>templatedisplaytext</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+			<item>
+				<name>serviceofferingname</name>
+				<value>Medium Instance, Virtual Networking</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>				
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>1000</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>guestosid</name>
+			</item>					
+			<item>
+				<name>rootdeviceid</name>
+			</item>
+			<item>
+				<name>rootdevicetype</name>
+				<value>NetworkFilesystem</value>
+			</item>
+			<item>
+				<name>networkgrouplist</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21 [Verify the Update using List VMs]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #547- list IP addresses for the account -->
+	<command>
+		<name>listPublicIpAddresses</name>
+		<testcase>547 [List Public IP Addresses]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>publicipaddress</name>
+			<element>0</element>
+			<item>
+				<name>ipaddress</name>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>true</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>forvirtualnetwork</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>vlanid</name>
+			</item>
+			<item>
+				<name>vlanname</name>
+			</item>
+			<item>
+				<name>isstaticnat</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #548- disassociate ip address -->
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>548 [Disassociate IP Address]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #36- reboot router -->
+	<command>
+		<name>rebootRouter</name>
+		<testcase> 36 [Reboot Router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+	 		<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #37- stop router -->
+	<!-- REMOVE THE COMMENTS AT THE BOTTOM ONCE AFTER THE BUG IS FIXED -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>37 [Stop Router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+	 		<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #38- start router -->
+	<command>
+		<name>startRouter</name>
+		<testcase>38 [Start Router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>networkdomain</name>
+				<param>routernetworkdomain</param>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item getparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item getparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>guestnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- What to check...here.. -->
+	<!-- Test case #40- list events -->
+	<command>
+		<name>listEvents</name>
+		<testcase>40 [List Events]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>event</name>
+			<element>0</element>
+			<item>
+				<name>id</name>
+			</item>
+			<item>
+				<name>username</name>
+			</item>
+			<item>
+				<name>type</name>
+			</item>
+			<item>
+				<name>level</name>
+			</item>
+			<item>
+				<name>description</name>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+			</item>
+			<item>
+				<name>parentid</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #14- destroy virtualMachine and verify its state -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase> 14 [Destroy Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> -   Verify the Destroyed Status of the Virtual Machine -	</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Destroyed</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #22- recover destroyed virtualMachine and verify that it's
+		state is Stopped after that
+	-->
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>22 [ Recover Virtual Machine ]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase> - Verify the Stopped Status of the Recovered VM -</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #549- listConfigurations command -->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>549 [List Configurations]</testcase>
+		<returnvalue list="true">
+			<name>configuration</name>
+			<element>0</element>
+			<item>
+				<name>category</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>value</name>
+			</item>
+			<item>
+				<name>description</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case #878- listConfiguarations command with category parameter
+	-->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>878 [List Configurations with category parameter]</testcase>
+		<parameters>
+			<item>
+				<name>category</name>
+				<value>advanced</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>configuration</name>
+			<element>0</element>
+			<item>
+				<name>category</name>
+				<value>Advanced</value>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>value</name>
+			</item>
+			<item>
+				<name>description</name>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!--
+		Test case #550- udpateConfiguration and make sure that the value got
+		updated
+	-->
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>550 [Update Configuration]</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>Successfully updated configuration value.</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listConfigurations</name>
+		<testcase> - Verify the Updated Configuration - </testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>category</name>
+				<value>Advanced</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+			<item>
+				<name>description</name>
+				<value>Time to wait before alerting on a updating agent</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- INCOMPLETE -->
+	<!-- Test case #552- list pods command-->
+	<command>
+		<name>listPods</name>
+		<testcase>552 [List Pods]</testcase>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>POD1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>id</name>
+				<value>2</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>POD1</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>cidr</name>
+			</item>
+			<item>
+				<name>startip</name>
+			</item>
+			<item>
+				<name>endip</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #3 - Create User command -->
+	<command>
+		<name>createUser</name>
+		<testcase>3 [Create User]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernamejack</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernamejack</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jack12</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jacklastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jack@gmail.com</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listAccounts</name>
+		<testcase> - List Accounts - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #951 - updateAccount command -->
+	<command>
+		<name>updateAccount</name>
+		<testcase>951 [Update Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>newname</name>
+				<param>updatedname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>	
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listAccounts</name>
+		<testcase> -  Check the Presence of the Updated Account</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case lockAccount -->
+	<command>
+		<name>lockAccount</name>
+		<testcase>    [Lock Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>	
+		</returnvalue>
+	</command>
+
+	<!-- Test case #7 - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase> 7  [Disable Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>	
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #8 - enableAccount command -->
+	<command>
+		<name>enableAccount</name>
+		<testcase> 8  [Enable Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #953 - createLimit command -->
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>953 [Create using Update Resource Limit]</testcase>
+		<parameters>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #956 - listLimits command -->
+	<command>
+		<name>listResourceLimits</name>
+		<usercommand>true</usercommand>
+		<testcase>956 [Verify the creation using List Resource Limits]</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #954 - updateResourceLimit command -->
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>954 [Update Resource Limit]</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listResourceLimits</name>
+		<testcase> -  Verify the update using List Resource Limits - </testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #932 - createDiskOfferings command -->
+	<command>
+		<name>createDiskOffering</name>
+		<testcase>932 [Create Disk Offering]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>description</name>
+				<value>newdiskdesc</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #934 - listDiskOfferings command -->
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase>934 [List the Created Disk Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!--
+		Test case # - updateDiskOffering command; verify that name, display
+		name were set
+	-->
+	<command>
+		<name>updateDiskOffering</name>
+		<testcase>Update the Created Disk Offering</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase> -  Verify the Update using List Disk Offering - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+				<name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isCustomized</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<!--
+		Test case #933 - deleteDiskOffering command; verify that disk was
+		deleted
+	-->
+	<command>
+		<name>deleteDiskOffering</name>
+		<testcase>933 [Delete Disk Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase> - Verify the Deletion of the Disk Offering - </testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!-- Test case #4 - deleteUser command -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>4 [Delete User]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Generate an Alert and get back to this test -->
+	<!-- Test case #750 - listAlerts command -->
+	<command>
+		<name>listAlerts</name>
+		<testcase>750 [List Alerts]</testcase>
+		<empty>false</empty>
+	</command>
+
+	<!-- Test case #974 - listCapacity command -->
+	<command>
+		<name>listCapacity</name>
+		<testcase>974 [List Capacity]</testcase>
+		<returnvalue list="true">
+			<name>capacity</name>
+			<element>0</element>
+			<item>
+				<name>type</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>podname</name>
+			</item>
+			<item>
+				<name>capacityused</name>
+			</item>
+			<item>
+				<name>capacitytotal</name>
+			</item>
+			<item>
+				<name>percentused</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #975 - listHosts command -->
+	<command>
+		<name>listHosts</name>
+		<testcase>975 [List Hosts]</testcase>
+		<parameters>
+			<item>
+				<name>type</name>
+				<value>Routing</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>host</name>
+			<element>0</element>
+			<item>
+				<name>id</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>		
+			<item>
+				<name>state</name>
+			</item>
+			<item>
+				<name>disconnected</name>
+			</item>
+			<item>
+				<name>type</name>
+				<value>Routing</value>
+			</item>
+			<item>
+				<name>ipaddress</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>podname</name>
+			</item>
+			<item>
+				<name>version</name>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+			</item>
+			<item>
+				<name>cpuallocated</name>
+			</item>
+			<item>
+				<name>cpuused</name>
+			</item>
+			<item>
+				<name>averageload</name>
+			</item>
+			<item>
+				<name>networkkbsread</name>
+			</item>
+			<item>
+				<name>networkkbswrite</name>
+			</item>
+			<item>
+				<name>memorytotal</name>
+			</item>
+			<item>
+				<name>memoryallocated</name>
+			</item>
+			<item>
+				<name>memoryused</name>
+			</item>
+			<item>
+				<name>capabilities</name>
+			</item>
+			<item>
+				<name>lastpinged</name>
+			</item>
+			<item>
+				<name>managementserverid</name>
+			</item>
+			<item>
+				<name>clusterid</name>
+			</item>
+			<item>
+				<name>clustername</name>
+			</item>
+			<item>
+				<name>islocalstorageactive</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>events</name>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- BUG 6314:NEEDS TO BE RESOLVED -->
+	<!-- Test case #960 - listIsos command -->
+	<command>
+		<name>listIsos</name>
+		<testcase>960 [List ISOs]</testcase>
+		<returnvalue list="true">
+			<name>iso</name>
+			<element>0</element>
+			<item>
+				<name>id</name>				
+			</item>
+			<item>
+				<name>name</name>
+				<value>xs-tools.iso</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>xen-pv-drv-iso</value>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+			</item>
+			<item>
+				<name>ostypename</name>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>isostatus</name>
+				<value>Successfully Installed</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #962 - createServiceOffering command -->
+	<command>
+		<name>createServiceOffering</name>
+		<testcase>962 [Create Service Offering]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #964 - updateServiceOffering command -->
+	<command>
+		<name>updateServiceOffering</name>
+		<testcase>964 [Update Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> - Verify the update of the Service Offering - </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>servofferingname</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>storagetype</name>
+				<value>shared</value>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>usevirtualnetwork</name>
+				<value>true</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #963 - deleteServiceOffering command -->
+	<command>
+		<name>deleteServiceOffering</name>
+		<testcase>963-1 [Delete Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>963-2 [List Service Offering]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>servofferingid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+	<!-- Test case # - register Iso command -->
+	<command>
+		<name>registerIso</name>
+		<testcase>    [Register ISO]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>Other install media</value>
+			</item>
+			<item>
+				<name>accountid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase> **  Sleep for five minutes </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+
+	<!-- Test case # - listIsos command -->
+	<command>
+		<name>listIsos</name>
+		<testcase>    [List ISOs]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>Ubuntu</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>isostatus</name>
+				<value>Successfully Installed</value>
+			</item>
+			<item>
+				<name>size</name>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>    [Register Template]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globaltemplateurl</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+			</item>
+				<name>created</name>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>false</value>
+			</item>
+ 			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>ostypename</name>
+				<value>CentOS 4.5 (32-bit)</value>
+			</item>
+			<item>
+				<name>accountid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Processing</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>isextractable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!--  Test case - listConsoleProxies -->
+	<command>
+		<name>listSystemVms</name>
+		<testcase>    [List system VM (Console Proxy VM)]</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>systemvm</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+				<value>consoleproxy</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #- reboot console proxy -->
+	<command>
+		<name>rebootSystemVm</name>
+		<testcase>    [Reboot System VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+				<value>consoleproxy</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #- stop console proxy -->
+	<command>
+		<name>stopSystemVm</name>
+		<testcase>    [Stop System VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+				<value>consoleproxy</value>
+			</item>			
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #- start console proxy -->
+	<command>
+		<name>startSystemVm</name>
+		<testcase>    [Start System VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>systemvmtype</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>hostname</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>publicnetmask</name>
+			</item>
+			<item>
+				<name>templateid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!--  Delete iso command -->
+	<command>
+		<name>deleteIso</name>
+		<testcase>   [Delete ISO]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listIsos</name>
+		<testcase>    [List ISOs]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+		
+	</command>
+
+	<!--  Delete template command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>    [Delete template]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>    [List templates]</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+	</command>
+
+</sanity>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/regression.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/regression.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,4443 @@
+<!--
+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.
+-->
+<regression>
+
+<!-- Test case #   - Create the Account and a User -->
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>			
+		</returnvalue>
+	</command>
+	
+	
+	
+	<!-- Test case # 3 - Create a User -->
+	<command>
+		<name>createUser</name>
+		<testcase>  3 [Create User Command]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>secondusernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>		
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>seconduserid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #950 - listAccounts -->
+	<command>
+		<name>listAccounts</name>
+		<testcase>950 [List the Account of the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #6 - updateUser command -->
+	<command>
+		<name>updateUser</name>
+		<testcase>  6 [Update the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item random="true" setparam="true">
+					<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Updated User updated in (6)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	
+
+	<!-- Test case lockUser command -->
+	<!-- LOCK USER COMMAND IS NO LONGER USED. IT IS BEING COMMENTED FOR RECORDS -->
+	<!-- 
+	<command>
+		<name>lockUser</name>
+		<testcase>    [Lock the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedadminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedadmin@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+-->
+
+	<!-- Test case #428 - disableUser command -->
+	<command>
+		<name>disableUser</name>
+		<testcase>428 [Disable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case #9 - enableUser command -->
+	<command>
+		<name>enableUser</name>
+		<testcase>  9 [Enable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>newuser</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - disableAcount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Disable the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Lock the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>false</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+						<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #10 - createDomain command -->
+	<command>
+		<name>createDomain</name>
+		<testcase> 10 [Create Domain]</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+
+	<!-- Test case #11 - listDomains command -->
+	<command>
+		<name>listDomains</name>
+		<testcase> 11 [List Domains]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+
+	<!--
+		Test case #952 - updateDomain command - edit domain name and verify
+		that it was really updated
+	-->
+	<command>
+		<name>updateDomain</name>
+		<testcase>952 [Update the Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+
+
+
+	<!-- Test case # - listDomainChildren command -->
+
+	<command>
+		<name>listDomainChildren</name>
+		<testcase> -  [List One of the Children of the Parent Domain] </testcase>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalues list="true">
+			<name>domain</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdomainname</param>
+			</item>
+			<item>
+				<name>level</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+	
+	
+
+	<!-- Test case #654 - deleteDomain command -->
+	<command>
+		<name>deleteDomain</name>
+		<testcase>654 [Delete Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>cleanup</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalues>
+	</command>
+
+
+
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List Templates - List System Template]</testcase>
+		<parameters>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<!--<item>
+				<name>bootable</name>
+				<value>false</value>
+			</item> -->
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item setparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item setparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>				
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Verify All the Parameters of the Listed Template -	</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item getparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item getparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</returnvalue>
+	</command>
+
+
+
+	<!-- Test case #28 - listServiceOffering command -->
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> 28 [List the Small Instance Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item setparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item setparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>876 [Verify the First Service Offering] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>serviceoffering</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #39 - listZones command -->
+	<command>
+		<name>listZones</name>
+		<testcase> 39 [List the Global Zone with id-2]</testcase>
+		<returnvalue list="true">
+			<name>zone</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>internaldns1</name>
+				<param>internaldns1</param>
+			</item>
+			<item>
+				<name>vlan</name>
+			</item>
+			<item>
+				<name>guestcidraddress</name>				
+			</item>
+			<item>
+				<name>networktype</name>
+				<value>Advanced</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<!-- Create default network-->
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #13 - deployVirtualMachine command -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>13</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #957 - listVirtualMachines command -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>957</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingname</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</returnvalue>
+	</command>			
+	
+	<!-- Test case #35 - listRouters command -->
+	<command>
+		<name>listRouters</name>
+		<testcase>35</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>router</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item setparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item setparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item setparam="true" >
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<!-- Test case #546 - associateIpAddress command -->	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>546</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+				<name>allocated</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>issourcenat</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!--  LOAD BALANCING RULES SECTION -->
+	
+	<!-- Test case #986 - create a load balancer -->
+	<command>
+		<name>createLoadBalancerRule</name>
+		<testcase>986</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicipid</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+				<name>publicipid</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!-- Test case #988 - listLoadBalancerRules -->
+	<command>
+		<name>listLoadBalancerRules</name>
+		<testcase>988</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainId</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Test case #989 - assignToLoadBalancerRule -->
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<testcase>989</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineids</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #987 - deleteLoadBalancerRule; make sure to return the lb rule after the verification -->
+	<command>
+		<name>deleteLoadBalancerRule</name>
+		<testcase>987</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRules</name>
+		<empty>true</empty>
+	</command>
+	
+	<command>
+		<name>createLoadBalancerRule</name>
+		<parameters>
+			<item random="true" setparam="true"> 
+			    <name>name</name>
+			    <param>lbname</param>
+			</item>
+			<item getparam="true">
+			    <name>publicipid</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item randomnumber="true" setparam="true">
+			    <name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+			    <name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>lbname</param>
+			</item>
+			<item getparam="true">
+				<name>privateport</name>
+				<param>privateport</param>
+			</item>
+			<item getparam="true">
+				<name>publicport</name>
+				<param>publicport</param>
+			</item>
+			<item>
+				<name>algorithm</name>
+				<value>roundrobin</value>
+			</item>
+			<item getparam="true">
+			    <name>publicipid</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>assignToLoadBalancerRule</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineids</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<!-- Test case #991 - listLoadBalancerRuleInstances; make sure to return the lb rule after the verification -->
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<testcase>991</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #990 - removeFromLoadBalancerRule -->
+	<command>
+		<name>removeFromLoadBalancerRule</name>
+		<testcase>990</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+			<item getparam="true">
+			    <name>virtualmachineids</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listLoadBalancerRuleInstances</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>lbid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!--  PORT FORWARDING RULES SECTION -->
+	
+<!-- ADD TEST CASES FOR IP FORWARDING HERE!!! -->
+	
+	
+	<!-- Test case #16 - rebootVirtualMachine command; verfiy that machine is in Running state after it's rebooted -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>16</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #17 - stopVirtualMachine command; verify that machine is in Stopped state after it's stopped -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>17</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!-- VOLUME COMMANDS -->	
+
+<!--  listVolumes command -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!--  Detach volume command - detach volume from the vm and make sure that you don't see it in the list of volumes for this vm -->
+	<command>
+		<name>detachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Create volume command - create a volume and make sure that it appeared in the list -->
+	<command>
+		<name>createVolume</name>
+		<testcase>1026</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!--  Attach volume command - attach volume from to the vm and make sure that you see it in the list of volumes for this vm -->
+	<command>
+		<name>attachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Delete volume command - delete volume and make sure that you don't see it in the list of volumes any more -->
+	<command>
+		<name>createVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>deleteVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+
+<!--  SNAPSHOT COMMANDS -->	
+	<!-- Test case #<> - createSnapshot command; verify that snapshot got created -->
+	<command>
+		<name>createSnapshot</name>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listSnapshots</name>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #24 - deleteSnapshot command; verify that you got true, and listSnapshots doesn't display anything -->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase>24</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #26 - listSnapshots command -->
+	<command>
+		<name>listSnapshots</name>
+		<testcase>26</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #958 - createTemplate command -->
+	<command>
+		<name>createSnapshot</name>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snapshotid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>958</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>snapshotid1</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase>27</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplate</name>
+		<testcase>Update template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>lalala</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>blah</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<testcase>List updated template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>displaytext</name>
+				<value>lalala</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case - listTemplatePermissions command -->
+	<command>
+		<name>listTemplatePermissions</name>
+		<testcase>list template permissions command</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case - updateTemplate command -->
+	<command>
+		<name>updateTemplatePermissions</name>
+		<testcase>update template permissions</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<testcase>List template with updated permission</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>ispublic</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #959 - deleteTemplate command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>959</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listTemplates</name>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+	</command>
+	
+
+	
+	<!-- Test case #20 - changeServiceOffering command; make sure that vm has correct service offering assigned -->
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase>20</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #19 - resetpassword for virtual machine; make sure the machine is in Running state after it comes back -->
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>19</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>password</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #18 - stop vm than start it; verify that VM status is Running -->
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>18</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>serviceofferingid</name>
+				<value>2</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #21- enable/disable HA for the VM; verify that HA is enabled -->
+	<command>
+		<name>updateVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>updateVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>21</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+	<!-- Test case #547- list IP addresses for the account -->
+	<command>
+		<name>listPublicIpAddresses</name>
+		<testcase>547</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #548- disassociate ip address -->
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>548</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #36- reboot router -->
+	<command>
+		<name>rebootRouter</name>
+		<testcase>36</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #37- stop router -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>37</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #38- start router -->
+	<command>
+		<name>startRouter</name>
+		<testcase>38</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item getparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>routername</param>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item getparam="true">
+				<name>publicmacaddress</name>
+				<param>routerpublicmacaddress</param>
+			</item>
+			<item getparam="true">
+				<name>guestipaddress</name>
+				<param>routeripaddress</param>
+			</item>
+			<item getparam="true">
+				<name>guestmacaddress</name>
+				<param>routermacaddress</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #40- list events -->
+	<command>
+		<name>listEvents</name>
+		<testcase>40</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #14- destroy virtualMachine and verify its state -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>14</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Destroyed</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #22- recover destroyed virtualMachine and verify that it's state is Stopped after that -->
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>22</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #549- listConfigurations command -->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>549</testcase>
+		<empty>false</empty>
+	</command>	
+	
+	<!-- Test case #878- listConfiguarations command with category parameter-->
+	<command>
+		<name>listConfigurations</name>
+		<testcase>878</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item>
+				<name>category</name>
+				<value>advanced</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Test case #550- udpateConfiguration and make sure that the value got updated-->
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>550</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listConfigurations</name>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>update.wait</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>value</name>
+				<value>35</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!-- Test case #552- list pods command-->
+	<command>
+		<name>listPods</name>
+		<testcase>552</testcase>
+		<parameters>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>	
+	
+	
+<!-- Test case #951 - updateAccount command -->
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listAccounts</name>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>accountname1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>updateAccount</name>
+		<testcase>951</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true" setparam="true">
+			    <name>newname</name>
+			    <param>updatedname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listAccounts</name>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>updatedname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>updatedname</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!-- Test case #7 - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>7</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+                <name>lock</name>
+                <value>true</value>
+            </item>
+			
+		</parameters>
+	</command>	
+	
+
+<!-- Test case #8 - enableAccount command -->
+	<command>
+		<name>enableAccount</name>
+		<testcase>8</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>account</name>
+				<param>updatedname</param>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>		
+	
+	
+<!-- Test case #953 - createLimit command -->	
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>953</testcase>
+		<parameters>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>max</name>
+				<value>300</value>
+			</item>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	<!-- Test case #956 - listLimits command -->	
+	<command>
+		<name>listResourceLimits</name>
+		<usercommand>true</usercommand>
+		<testcase>956</testcase>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>max</name>
+				<value>300</value>
+			</item>
+		</returnvalue>
+	</command>		
+	
+<!-- Test case #954 - updateResourceLimit command -->	
+	<command>
+		<name>updateResourceLimit</name>
+		<testcase>954</testcase>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>max</name>
+				<value>65</value>
+			</item>
+		</parameters>
+	</command>		
+	
+	<command>
+		<name>listResourceLimits</name>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>resourcetype</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>max</name>
+				<value>65</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<!-- Test case #932 - createDiskOfferings command -->
+	<command>
+		<name>createDiskOffering</name>
+		<testcase>932</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>newdiskname</param>
+			</item>
+			<item>
+			    <name>description</name>
+				<value>newdiskdesc</value>
+			</item>
+			<item>
+			    <name>disksize</name>
+				<value>1024</value>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>diskid</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>volumedisplay</value>
+			</item>
+			<item>
+			    <name>disksize</name>
+				<value>1099511627776</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+		
+		
+	<!-- Test case #934 - listDiskOfferings command -->
+	<command>
+		<name>listDiskOfferings</name>
+		<testcase>934</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>name</name>
+				<value>newdisk</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<!-- Test case # - updateDiskOffering command; verify that name, display name were set -->
+	<command>
+		<name>updateDiskOffering</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>diskid</param>
+			</item>
+			<item random="true" setparam="true">
+			    <name>name</name>
+			    <param>newdiskname</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listDiskOfferings</name>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>name</name>
+				<param>newdiskname</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+	
+	<!-- Test case #933 - deleteDiskOffering command; verify that disk was deleted -->
+	<command>
+		<name>deleteDiskOffering</name>
+		<testcase>933</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listDiskOfferings</name>
+		<empty>true</empty>
+		<parameters>
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+			    <name>id</name>
+				<param>diskid</param>
+			</item>
+		</parameters>
+	</command>	
+
+<!-- Test case #750 - listAlerts command -->
+	<command>
+		<name>listAlerts</name>
+		<testcase>750</testcase>
+		<empty>false</empty>
+	</command>
+	
+<!-- Test case #974 - listCapacity command -->
+	<command>
+		<name>listCapacity</name>
+		<testcase>974</testcase>
+		<empty>false</empty>
+	</command>
+	
+	<!-- Test case #975 - listHosts command -->
+	<command>
+		<name>listHosts</name>
+		<empty>false</empty>
+		<testcase>975</testcase>
+	</command>
+	
+	
+	<!-- Test case #960 - listIsos command -->
+	<command>
+		<name>listIsos</name>
+		<testcase>960</testcase>
+		<empty>true</empty>
+	</command>
+	
+	<!-- Test case #962 - createServiceOffering command -->
+	<command>
+		<name>createServiceOffering</name>
+		<testcase>962</testcase>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+			    <name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+			    <name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+			    <name>memory</name>
+				<value>256</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>id</name>
+				<param>soid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>soid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>newofferingid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newoff</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #964 - updateServiceOffering command -->
+	<command>
+		<name>updateServiceOffering</name>
+		<testcase>964</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+			<item random="true">
+			    <name>name</name>
+			</item>
+			<item>
+			    <name>displaytext</name>
+				<value>display</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>newofferingid</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>display</value>
+			</item>
+			<item>
+				<name>cpunumber</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>cpuspeed</name>
+				<value>200</value>
+			</item>
+			<item>
+				<name>memory</name>
+				<value>256</value>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<!-- Test case #963 - deleteServiceOffering command -->
+	<command>
+		<name>deleteServiceOffering</name>
+		<testcase>963-1</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>963-2</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>newofferingid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case # - register Iso command -->	
+		<command>
+		<name>registerIso</name>
+		<testcase>Register iso</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://172.16.0.220/images/sumita/iso/ubuntu-9.04-server-amd64.iso</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>53</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case # - listIsos command -->	
+		<command>
+		<name>listIsos</name>
+		<testcase>List isos</testcase>
+		<empty>false</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case - register template command -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>Register template</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globaltemplateurl</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>passwordenabled</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Test case - listConsoleProxies -->
+	<command>
+		<name>listSystemVms</name>
+		<testcase>List system vms</testcase>
+		<parameters>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>systemvm</name>
+		    <element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+			<item>
+				<name>publicip</name>
+			</item>
+			<item>
+				<name>zoneid</name>
+			</item>
+			<item>
+				<name>zonename</name>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item>
+				<name>networkdomain</name>
+			</item>
+			<item>
+				<name>gateway</name>
+			</item>
+			<item>
+				<name>name</name>
+			</item>
+			<item>
+				<name>podid</name>
+			</item>
+			<item>
+				<name>privateip</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>privatenetmask</name>
+			</item>
+			<item>
+				<name>publicmacaddress</name>
+			</item>
+			<item>
+				<name>privatemacaddress</name>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>hostid</name>
+			</item>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item>
+				<name>activeviewersessions</name>
+				<value>0</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Test case #- reboot console proxy -->
+	<command>
+		<name>rebootSystemVm</name>
+		<testcase>Reboot system vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #- stop console proxy -->
+	<command>
+		<name>stopSystemVm</name>
+		<testcase>Stop system vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #- start console proxy -->
+	<command>
+		<name>startSystemVm</name>
+		<testcase>Start system vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>consoleid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!--  Delete iso command -->
+	<command>
+		<name>deleteIso</name>
+		<testcase>Delete iso</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listIsos</name>
+		<testcase>List isos</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privateisoid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Delete template command -->
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>Delete template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>listTemplates</name>
+		<testcase>List templates</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>systemtemplateid</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+		    </item>
+		</parameters>
+	</command>
+
+	<!-- Test case - delete account-->
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Deleting account</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+</regression>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/resource_limits.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/resource_limits.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/resource_limits.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/resource_limits.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1894 @@
+<!--
+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.
+-->
+<thirdtest>
+<!-- FIRST USER -->
+<!--Step 1: Create a user-->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>user@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>userlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+<!-- 
+<command>
+            <name>createUser</name>
+            <testcase>Create User Test Case</testcase>
+            <parameters>
+                  <item random="true">
+                      <name>username</name>
+                      <param>usernameparam</param>
+                  </item>
+                  <item>
+                      <name>password</name>
+                        <value>alena123</value>
+                  </item>
+                  <item>
+                        <name>firstname</name>
+                        <value>user</value>
+                  </item>
+                  <item>
+                        <name>lastname</name>
+                        <value>userlastname</value>
+                  </item>
+                  <item>
+                        <name>email</name>
+                        <value>user@gmail.com</value>
+                  </item>
+                  <item>
+                        <name>accounttype</name>
+                        <value>0</value>
+                  </item>
+            </parameters>
+            
+            <returnvalue>
+                  <item setparam="true">
+                        <name>id</name>
+                        <param>userid</param>
+                  </item>
+                  <item setparam="true">
+                        <name>account</name>
+                        <param>accountname</param>
+                  </item>
+            </returnvalue>
+</command>
+-->
+
+
+<!--Step 2(a): Setup VMs limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Setup VMs Limit for Account Test Case</testcase>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>0</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>0</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>2</value>
+                  </item>
+            </returnvalue>
+ </command>        
+
+<!--Step 2(b): Setup Public-IPs limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Setup Public-Ips Limit for Account Test Case</testcase>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>1</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>1</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>1</value>
+                  </item>
+            </returnvalue>
+ </command>        
+ 
+ <!--Step 2(c): Setup Volumes limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Setup Volumes Limit for Account Test Case</testcase>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>2</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>6</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>2</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>6</value>
+                  </item>
+            </returnvalue>
+ </command>        
+
+<!--Step 2(d): Setup Snapshots limit for the account -->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Setup Snapshots Limit for Account Test Case</testcase>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>3</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>3</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>2</value>
+                  </item>
+            </returnvalue>
+ </command> 
+
+<!-- 2(e): Setup Templates limit for the account -->
+<command>
+			<name>updateResourceLimit</name>
+            <testcase>Setup Templates Limit for Account Test Case</testcase>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>4</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>4</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>2</value>
+                  </item>
+            </returnvalue>
+		
+</command> 
+ 
+<!--Step 3:  Register user-->
+      <command>
+            <name>registerUserKeys</name>
+            <testcase>Register User Keys Test Case</testcase>
+            <parameters>
+                  <item getparam="true">
+                      <name>id</name>
+                        <param>userid</param>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item setparam="true">
+                        <name>apikey</name>
+                        <param>apikey</param>
+                  </item>
+                  <item setparam="true">
+                        <name>secretkey</name>
+                        <param>secretkey</param>
+                  </item>
+            </returnvalue>
+   </command>  
+   
+   <command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--Step4(a): Execute command deploy vm as user – deploy 2 vms -->
+
+		<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy vm1 test case</testcase>
+            <usercommand>true</usercommand>
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>ResourceLimits-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</returnvalue>
+		</command>
+
+		<command>
+			<name>deployVirtualMachine</name>   <!--deploy vm 2-->
+            <testcase>deploy vm2 test case</testcase>
+            <usercommand>true</usercommand>
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item>
+				<name>displayname</name>
+				<value>ResourceLimits-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+		</returnvalue>
+		</command>
+		
+<!--Step 4(b): Associate an IP other than the one assigned to the DOMR -->
+
+<command>
+		<name>associateIpAddress</name> 
+		<testcase>Associate second IP Test Case</testcase>
+		<usercommand>true</usercommand>
+		
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipid</param>
+			</item>
+		</returnvalue>
+		
+		
+</command>		
+
+
+<!--Step 4(c): Add fifth and Sixth volume to the existing volumes of one of the VMs -->
+<command>
+		<name>createVolume</name>
+		<testcase>Create Fifth Volume Test Case</testcase>
+		<usercommand>true</usercommand>
+		
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>FifthVolume</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volid1</param>
+			</item>
+		</returnvalue>
+		
+</command>		
+
+<command>
+		<name>attachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volid1</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+</command>
+		
+<command>
+		<name>createVolume</name>
+		<testcase>Create Sixth Volume Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>SixthVolume</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volid2</param>
+			</item>
+		</returnvalue>
+		
+</command>
+
+<command>
+		<name>attachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volid2</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid2</param>
+			</item>
+		</parameters>
+</command>
+		
+<!-- Step 4(d): Create two snapshots for one of the Volumes -->
+<command>
+		<name>createSnapshot</name>
+		<testcase>Create First Snapshot Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snpid</param>
+			</item>
+		</returnvalue>
+</command>
+
+<command>
+		<name>createSnapshot</name>
+		<testcase>Create Second Snapshot Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snpid</param>
+			</item>
+		</returnvalue>
+</command> 
+
+<!--Step 4(e) Register two templates -->
+<command>
+		<name>registerTemplate</name>
+		<testcase>Create First Template Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>FirstTemplate</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>Firsttemplate</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>41</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>							
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>templid1</param>
+			</item>
+		</returnvalue>
+</command>
+
+<command>
+		<name>registerTemplate</name>
+		<testcase>Create Second Template Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>SecondTemplate</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>Secondtemplate</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>41</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>						
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>templid2</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!--Step 5(a): try to deploy third vm:-->
+
+		<command>
+			<name>deployVirtualMachine</name>  <!--deploy vm 3 – should fail-->
+            <testcase>Deploy VM3 Failure test case</testcase>
+            <usercommand>true</usercommand>
+			<error>true</error>
+        <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>templateid</name>
+				<value>2</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>network</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid3</param>
+			</item>
+		</returnvalue>
+         </command>
+         
+<!--Step 5(b): Associate Third IP other than the two assigned -->
+
+<command>
+		<name>associateIpAddress</name> 
+		<testcase>Associate Second IP Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipid</param>
+			</item>
+		</returnvalue>
+		
+		
+</command>
+
+<!--Step 5(c): Add Seventh volume to the existing volumes of one of the VMs -->
+<command>
+		<name>createVolume</name>
+		<testcase>Create Seventh Volume Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>SeventhVolume</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volid3</param>
+			</item>
+		</returnvalue>
+		
+</command>			         
+
+<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid1</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- Step 5(d): Create a third Snapshot of the volume--> 
+<command>
+		<name>createSnapshot</name>
+		<testcase>Create Third Snapshot Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snpid</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- Step 5 (e): Try to create a third template for the same user -->
+
+<command>
+		<name>registerTemplate</name>
+		<testcase>Create Third Template Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>ThirdTemplate</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>Thirdtemplate</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>41</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>							
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>templid3</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- Step 6: Clean Up -->
+<command>
+		<name>deleteAccount</name>
+		<testcase>Clean up account test case</testcase>
+		
+		<parameters>
+				<item getparam="true">
+					<name>id</name>
+					<param>accountname</param>
+				</item>
+		</parameters>
+		
+</command>
+
+<!--  SECOND USER -->
+
+<!--Step 1: Create a user-->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>newadmin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>newadmin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>newadminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+<!-- 
+<command>
+            <name>createUser</name>
+            <testcase>Create Admin Test Case</testcase>
+            <parameters>
+                  <item random="true">
+                      <name>username</name>
+                      <param>usernameparam</param>
+                  </item>
+                  <item>
+                      <name>password</name>
+                        <value>alena123</value>
+                  </item>
+                  <item>
+                        <name>firstname</name>
+                        <value>user</value>
+                  </item>
+                  <item>
+                        <name>lastname</name>
+                        <value>userlastname</value>
+                  </item>
+                  <item>
+                        <name>email</name>
+                        <value>user@gmail.com</value>
+                  </item>
+                  <item>
+                        <name>accounttype</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            
+            <returnvalue>
+                  <item setparam="true">
+                        <name>id</name>
+                        <param>userid</param>
+                  </item>
+                  <item setparam="true">
+                        <name>account</name>
+                        <param>accountname</param>
+                  </item>
+            </returnvalue>
+</command>
+-->
+
+<!--Step 2(a): Setup VMs limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Failure in Setting Up VMs Limit for Admin Account Test Case</testcase>
+            <error>true</error>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>0</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>0</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>2</value>
+                  </item>
+            </returnvalue>
+ </command>        
+
+<!--Step 2(b): Setup Public-IPs limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Failure in Setting Up Public-Ips Limit for Admin Account Test Case</testcase>
+            <error>true</error>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>1</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>1</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>1</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>1</value>
+                  </item>
+            </returnvalue>
+ </command>        
+ 
+ <!--Step 2(c): Setup Volumes limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Failure in Setting Up Volumes Limit for Admin Account Test Case</testcase>
+            <error>true</error>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>2</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>6</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>2</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>6</value>
+                  </item>
+            </returnvalue>
+ </command>        
+
+<!--Step 2(d): Setup Snapshots limit for the account-->
+<command>     
+      		<name>updateResourceLimit</name>
+            <testcase>Failure in Setting up Snapshots Limit for Admin Account Test Case</testcase>
+            <error>true</error>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>3</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>3</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>2</value>
+                  </item>
+            </returnvalue>
+ </command>
+
+<!-- 2(e): Setup Templates limit for the account -->
+<command>
+			<name>updateResourceLimit</name>
+            <testcase>Failure in Seting Up Templates Limit for Admin Account Test Case</testcase>
+            <error>true</error>
+            <parameters>
+                  <item>
+                      <name>resourcetype</name>
+                        <value>4</value>
+                  </item>
+                  <item>
+                      <name>max</name>
+                        <value>2</value>
+                  </item>
+                  <item getparam="true">
+                      <name>account</name>
+                      <param>accountname</param>
+                  </item>
+                  <item>
+                      <name>domainid</name>
+                        <value>1</value>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item>
+                        <name>resourcetype</name>
+                        <value>4</value>
+                  </item>
+                  <item>
+                        <name>max</name>
+                        <value>2</value>
+                  </item>
+            </returnvalue>
+		
+</command> 
+ 
+<!--Step 3:  Register user-->
+      <command>
+            <name>registerUserKeys</name>
+            <testcase>Register User Keys Test Case</testcase>
+            <parameters>
+                  <item getparam="true">
+                      <name>id</name>
+                        <param>userid</param>
+                  </item>
+            </parameters>
+            <returnvalue>
+                  <item setparam="true">
+                        <name>apikey</name>
+                        <param>apikey</param>
+                  </item>
+                  <item setparam="true">
+                        <name>secretkey</name>
+                        <param>secretkey</param>
+                  </item>
+            </returnvalue>
+   </command>  
+
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--Step4(a): Execute command deploy vm as user – deploy 2 vms -->
+
+		<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy vm1 test case</testcase>
+            <usercommand>true</usercommand>
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotTest-Admin-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</returnvalue>
+		</command>
+
+		<command>
+			<name>deployVirtualMachine</name>   <!--deploy vm 2-->
+            <testcase>deploy vm2 test case</testcase>
+            <usercommand>true</usercommand>
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotTest-Admin-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+		</returnvalue>
+		</command>
+		
+<!--Step 4(b): Associate an IP other than the one assigned to the DOMR -->
+
+<command>
+		<name>associateIpAddress</name> 
+		<testcase>Associate second IP Test Case</testcase>
+		<usercommand>true</usercommand>
+		
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipid</param>
+			</item>
+		</returnvalue>				
+</command>		
+
+<!--Step 4(c): Add fifth and Sixth volume to the existing volumes of one of the VMs -->
+<command>
+		<name>createVolume</name>
+		<testcase>Create Fifth Volume Test Case</testcase>
+		<usercommand>true</usercommand>
+		
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>AdminsFifthVolume</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volid1</param>
+			</item>
+		</returnvalue>
+		
+</command>		
+		
+<command>
+		<name>attachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volid1</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+</command>		
+		
+<command>
+		<name>createVolume</name>
+		<testcase>Create Sixth Volume Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>AdminsSixthVolume</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volid2</param>
+			</item>
+		</returnvalue>
+		
+</command>
+
+<command>
+		<name>attachVolume</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volid2</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid2</param>
+			</item>
+		</parameters>
+</command>
+		
+<!--Step 4(d): Create two snapshots for one of the Volumes-->
+<command>
+		<name>createSnapshot</name>
+		<testcase>Create First Snapshot Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snpid</param>
+			</item>
+		</returnvalue>
+</command>
+
+<command>
+		<name>createSnapshot</name>
+		<testcase>Create Second Snapshot Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volid2</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snpid</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!--Step 4(e) Register two templates -->
+<command>
+		<name>registerTemplate</name>
+		<testcase>Create First Template Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>AdminsFirstTemplate</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>AdminsFirsttemplate</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>41</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>						
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>templid1</param>
+			</item>
+		</returnvalue>
+</command>
+
+<command>
+		<name>registerTemplate</name>
+		<testcase>Create Second Template Test Case</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>AdminsSecondTemplate</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>AdminsSecondtemplate</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value></value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>41</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>						
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>templid2</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!--Step 5(a): try to deploy third vm:-->
+
+		<command>
+			<name>deployVirtualMachine</name>  <!--deploy vm 3 – should fail-->
+            <testcase>Deploy VM3 Failure Avoidance test case</testcase>
+            <usercommand>true</usercommand>
+			
+        <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotTest-Admin-VM-3</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid3</param>
+			</item>
+		</returnvalue>
+         </command>
+         
+<!--Step 5(b): Associate Third IP other than the two assigned -->
+
+<command>
+		<name>associateIpAddress</name> 
+		<testcase>Associate Second IP Failure Avoidance Test Case</testcase>
+		<usercommand>true</usercommand>
+	
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipid</param>
+			</item>
+		</returnvalue>
+		
+		
+</command>
+
+<!--Step 5(c): Add Seventh volume to the existing volumes of one of the VMs -->
+<command>
+		<name>createVolume</name>
+		<testcase>Create Seventh Volume Failure Avoidance Test Case</testcase>
+		<usercommand>true</usercommand>
+	
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>AdminsSeventhVolume</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+			    <param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountname</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>	
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volid3</param>
+			</item>
+		</returnvalue>
+		
+</command>			         
+
+<!-- Step 5(d): Create a third Snapshot of the volume--> 
+<command>
+		<name>createSnapshot</name>
+		<testcase>Create Third Snapshot Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>snpid</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- Step 5 (e): Try to create a third template for the same user -->
+
+<command>
+		<name>registerTemplate</name>
+		<testcase>Create Third Template Failure Avoidance Test Case</testcase>
+		<usercommand>true</usercommand>
+
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>AdminsThirdTemplate</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>AdminsThirdtemplate</value>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://192.168.10.231/templates/routing/latest/systemvm.vhd.bz2</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>41</value>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>	
+						
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>templid3</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- Step 6: Clean Up -->
+<command>
+		<name>deleteAccount</name>
+		<testcase>Clean up admin account test case</testcase>
+		
+		<parameters>
+				<item getparam="true">
+					<name>id</name>
+					<param>accountid</param>
+				</item>
+		</parameters>
+		
+</command>
+</thirdtest>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/roughflatstress.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/roughflatstress.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/roughflatstress.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/roughflatstress.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,691 @@
+<!--
+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.
+-->
+<flatnetworkstress>
+	
+	<command>
+	<name>createAccount</name>
+	<testcase>    [Create the Account and a User for the account]</testcase>
+	<parameters>
+		<item setparam="true" random="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item getparam="true">
+			<name>accounttype</name>
+			<param>globalaccttype</param>
+		</item>
+		<item getparam="true">
+			<name>domainid</name>
+			<param>globaldomainid</param>
+		</item>
+		<item>
+			<name>email</name>
+			<value>firstuser@gmail.com</value>
+		</item>
+		<item>
+			<name>firstname</name>
+			<value>firstuser</value>
+		</item>
+		<item>
+			<name>lastname</name>
+			<value>firstuserlastname</value>
+		</item>
+		<item random="true" setparam="true">
+			<name>username</name>
+			<param>getusernameparam1</param>
+		</item>
+		<item>
+			<name>password</name>
+			<value>password</value>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getaccountid</param>
+		</item>
+		<item>
+			<name>state</name>
+			<value>enabled</value>
+		</item>
+	</returnvalue>
+	</command>
+	
+	<command>
+	<name>listUsers</name>
+	<testcase>    [List the User of the account]</testcase>
+	<parameters>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item getparam="true">
+			<name>accounttype</name>
+			<param>globalaccttype</param>
+		</item>
+		<item getparam="true">
+			<name>domainid</name>
+			<param>globaldomainid</param>
+		</item>
+		<item getparam="true">
+			<name>username</name>
+			<param>getusernameparam1</param>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getuserid1</param>
+		</item>
+		<item>
+			<name>state</name>
+			<value>enabled</value>
+		</item>
+	</returnvalue>
+	</command>
+			
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the First User</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>getuserid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createSecurityGroup</name>
+		<usercommand>true</usercommand>
+		<testcase>Creating First Security group for the Account</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>name</name>
+				<param>getsecuritygroupname1</param>
+			</item>
+			<item random="true">
+				<name>description</name>
+			</item>
+<!-- 		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>getsecuritygroupid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>authorizeSecurityGroupIngress</name>
+		<usercommand>true</usercommand>
+		<testcase>Authorizing First network group ingress rule for the First Security Group</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>securitygroupid</name>
+				<param>getsecuritygroupid1</param>
+			</item>
+			<item getparam="true">
+				<name>cidrlist</name>
+				<param>globalcidrlist</param>
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+<!--		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+	</command>
+	
+	<command>
+		<name>listSecurityGroups</name>
+		<usercommand>true</usercommand>
+		<testcase> List the Security group and get the ingress rule ID </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>securitygroupid</name>
+				<param>getsecuritygroupid1</param>
+			</item>
+<!--		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ruleid</name>
+				<param>getingressruleid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploying VM for the First Account</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneId</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>
+			<item getparam="true">
+				<name>templateId</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceOfferingId</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>securitygroupids</name>
+				<param>getsecuritygroupid1</param>
+			</item>
+<!-- 		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>	
+-->			</parameters>
+			<returnvalue>
+				<item setparam="true">
+					<name>id</name>
+					<param>getvmid1</param>
+				</item>
+				<item setparam="true">
+					<name>ipaddress</name>
+					<param>getvmip1</param>
+				</item>		
+			</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>getvmip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 1 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>revokeSecurityGroupIngress</name>
+		<usercommand>true</usercommand>
+		<testcase>Revoking network group igress</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getingressruleid1</param>
+			</item>
+		</parameters>
+	</command>
+<!-- 		
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail as network group is revoked</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>getvmip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+-->	
+
+<!-- SECOND GROUP -->
+	
+	<command>
+		<name>createSecurityGroup</name>
+		<usercommand>true</usercommand>
+		<testcase>Creating a Second Security group for the Account</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>name</name>
+				<param>getsecuritygroupname2</param>
+			</item>
+			<item random="true">
+				<name>description</name>
+			</item>
+<!-- 		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>getsecuritygroupid2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>authorizeSecurityGroupIngress</name>
+		<usercommand>true</usercommand>
+		<testcase>Authorizing network group ingress for the second Security group</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>securitygroupid</name>
+				<param>getsecuritygroupid2</param>
+			</item>
+			<item getparam="true">
+				<name>usersecuritygrouplist[0].account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>usersecuritygrouplist[0].group</name>
+				<param>getsecuritygroupname1</param>
+			</item>			
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+<!--		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+	</command>
+	
+		
+	<command>
+		<name>authorizeSecurityGroupIngress</name>
+		<usercommand>true</usercommand>
+		<testcase>Authorizing one more network group ingress rule for the Second Security Group </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>securitygroupid</name>
+				<param>getsecuritygroupid2</param>
+			</item>
+			<item getparam="true">
+				<name>cidrlist</name>
+				<param>globalcidrlist</param>
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+<!--		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+	</command>
+	
+	<command>
+		<name>listSecurityGroups</name>
+		<usercommand>true</usercommand>
+		<testcase> List the Security group and get the first ingress rule ID </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>securitygroupid</name>
+				<param>getsecuritygroupid2</param>
+			</item>
+<!--		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ruleid</name>
+				<param>getingressruleid2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploying Second VM for the First Account</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneId</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>hypervisor</name>
+				<param>globalhypervisortype</param>
+			</item>
+			<item getparam="true">
+				<name>templateId</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceOfferingId</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>securitygroupids</name>
+				<param>getsecuritygroupid2</param>
+			</item>
+<!-- 		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>	
+-->			</parameters>
+			<returnvalue>
+				<item setparam="true">
+					<name>id</name>
+					<param>getvmid2</param>
+				</item>
+				<item setparam="true">
+					<name>ipaddress</name>
+					<param>getvmip2</param>
+				</item>		
+			</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>getvmip2</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 1 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>revokeSecurityGroupIngress</name>
+		<usercommand>true</usercommand>
+		<testcase>Revoking Second Network group's First ingress rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getingressruleid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listSecurityGroups</name>
+		<usercommand>true</usercommand>
+		<testcase> List the Security group and get the second ingress rule ID </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>securitygroupid</name>
+				<param>getsecuritygroupid2</param>
+			</item>
+<!--		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+-->		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ruleid</name>
+				<param>getingressruleid2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>revokeSecurityGroupIngress</name>
+		<usercommand>true</usercommand>
+		<testcase>Revoking Second network group's second ingress rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getingressruleid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- 		
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail as network group is revoked</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>getvmip2</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+-->	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Destroying virutal machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 1 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Destroying virutal machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getvmid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 1 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+		
+	
+<!--  Delete user as a part of cleanup -->	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>getuserid1</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+	<name>deleteAccount</name>
+	<testcase> Delete Account </testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getaccountid</param>
+	</item>
+	</parameters>
+	
+</command>	
+</flatnetworkstress>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/roughregression.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/roughregression.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/roughregression.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/roughregression.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,6012 @@
+<!--
+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.
+-->
+<regression>
+<command>
+	<name>listDomains</name>
+	<testcase>    [List Domains]</testcase>
+	<parameters>
+		<item getparam="true">
+			<name>id</name>
+			<param>globaldomainid</param>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>name</name>
+			<param>getdomainname1</param>
+		</item>
+	</returnvalue>
+</command>
+
+<!--CREATE AN ACCOUNT-->
+<command>
+	<name>createAccount</name>
+	<testcase>    [Create the Account and a User for the account]</testcase>
+	<parameters>
+		<item setparam="true" random="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item getparam="true">
+			<name>accounttype</name>
+			<param>globalaccttype</param>
+		</item>
+		<item getparam="true">
+			<name>domainid</name>
+			<param>globaldomainid</param>
+		</item>
+		<item>
+			<name>email</name>
+			<value>firstuser@gmail.com</value>
+		</item>
+		<item>
+			<name>firstname</name>
+			<value>firstuser</value>
+		</item>
+		<item>
+			<name>lastname</name>
+			<value>firstuserlastname</value>
+		</item>
+		<item random="true" setparam="true">
+			<name>username</name>
+			<param>getusernameparam1</param>
+		</item>
+		<item>
+			<name>password</name>
+			<value>password</value>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getaccountid</param>
+		</item>
+		<item>
+			<name>state</name>
+			<value>enabled</value>
+		</item>
+	</returnvalue>
+</command>
+
+<command>
+	<name>registerIso</name>
+	<testcase>[] registerIsotestcase </testcase>
+	<parameters>
+        <item>
+                <name>name</name>
+                <value>CentOS-5-5-ISO</value>
+        </item>
+        <item>
+                <name>displayText</name>
+                <value>CentOS-5-5-ISO</value>
+        </item>
+        <item>
+                <name>url</name>
+                <value>http://nfs1.lab.vmops.com/isos_64bit/CentOS-5.5-x86_64-bin-DVDs/CentOS-5.5-x86_64-bin-DVD-1of2.iso</value>
+        </item>
+        <item>
+                <name>zoneId</name>
+                <value>-1</value>
+        </item>
+        <item>
+                <name>isPublic</name>
+                <value>true</value>
+        </item>
+        <item>
+                <name>bootable</name>
+                <value>true</value>
+        </item>
+        <item>
+                <name>osTypeId</name>
+                <value>112</value>
+        </item>
+        <item>
+                <name>isfeatured</name>
+                <value>true</value>
+        </item>
+		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+		</item>
+		<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+		</item>
+        </parameters>
+		<returnvalue>
+		<item setparam="true">
+				<name>id</name>
+				<param>getisoid1</param>
+		</item>
+		</returnvalue>
+</command>
+
+<command>
+		<name>listIsos</name>
+		<testcase>[] listIsosTestCase </testcase>
+		<parameters>
+        <item>
+                <name>isofilter</name>
+                <value>self</value>
+        </item>
+        <item getparam="true">
+                <name>id</name>
+                <param>getisoid1</param>
+        </item>
+        <item>
+                <name>zoneid</name>
+                <value>1</value>
+        </item>
+        </parameters>
+		<returnvalue>
+		<item getparam="true">
+				<name>id</name>
+				<param>getisoid1</param>
+		</item>
+		<item>
+                <name>name</name>
+                <value>CentOS-5-5-ISO</value>
+        </item>
+        <item>
+                <name>displayText</name>
+                <value>CentOS-5-5-ISO</value>
+        </item>
+        <item>
+                <name>zoneId</name>
+                <value>1</value>
+        </item>
+        <item>
+                <name>isPublic</name>
+                <value>true</value>
+        </item>
+        <item>
+                <name>bootable</name>
+                <value>true</value>
+        </item>
+        <item>
+                <name>osTypeId</name>
+                <value>112</value>
+        </item>
+        <item>
+                <name>isfeatured</name>
+                <value>true</value>
+        </item>
+		<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+		</item>
+		<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+		</item>
+		<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+		</item>
+		</returnvalue>		
+</command>
+
+
+
+
+
+	<!-- Create default network-->
+	<command>
+	<name>createNetwork</name>
+	<testcase>	[Creating default network]</testcase>
+	<parameters>
+		<item getparam="true">
+		    <name>zoneid</name>
+		    <param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+		    <name>networkOfferingId</name>
+		    <param>globalnetworkofferingid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item getparam="true">
+			<name>domainid</name>
+			<param>globaldomainid</param>
+		</item>
+		<item>
+			<name>name</name>
+			<value>defaultregressionnetwork</value>
+		</item>
+		<item>
+			<name>displaytext</name>
+			<value>defaultregressionnetwork</value>
+		</item>
+		</parameters>
+		<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getnetworkid1</param>
+		</item>
+		</returnvalue>
+	</command>
+	
+
+<!-- Test case #950 - listAccounts -->
+<command>
+	<name>listAccounts</name>
+	<testcase>950 [List the Account of the User created in (3)]</testcase>
+	<parameters>
+		<item getparam="true">
+			<name>name</name>
+			<param>accountname</param>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item getparam="true">
+			<name>id</name>
+			<param>getaccountid</param>
+		</item>
+		<item getparam="true">
+			<name>name</name>
+			<param>accountname</param>
+		</item>
+		<item getparam="true">
+			<name>accounttype</name>
+			<param>globalaccttype</param>
+		</item>
+		<item getparam="true">
+			<name>domainid</name>
+			<param>globaldomainid</param>
+		</item>
+		<item>
+			<name>domain</name>
+			<param>getdomainname1</param>
+		</item>
+		<item>
+			<name>receivedbytes</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>sentbytes</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>vmlimit</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>vmtotal</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>vmavailable</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>ipavailable</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>iptotal</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>iplimit</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>volumelimit</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>volumetotal</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>volumeavailable</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>snapshotlimit</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>snapshottotal</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>snapshotavailable</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>templatelimit</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>templatetotal</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>templateavailable</name>
+			<value>Unlimited</value>
+		</item>
+		<item>
+			<name>vmstopped</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>vmrunning</name>
+			<value>0</value>
+		</item>
+		<item>
+			<name>state</name>
+			<value>enabled</value>
+		</item>
+		</returnvalue>
+</command>
+
+<!-- Test case #5 - listUsers command -->
+<command>
+	<name>listUsers</name>
+	<testcase>  5 [List the Created User in (3)]</testcase>
+	<parameters>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getuserid1</param>
+		</item>
+		<item setparam="true">
+			<name>username</name>
+			<param>getusernameparam1</param>
+		</item>
+	</returnvalue>
+</command>
+		
+	<!-- Test case # 3 - Create a User -->
+<command>
+	<name>createUser</name>
+	<testcase>  3 [Create User Command]</testcase>
+	<parameters>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item getparam="true">
+			<name>accounttype</name>
+			<param>globalaccttype</param>
+		</item>
+		<item random="true" setparam="true">
+			<name>username</name>
+			<param>getusernameparam2</param>
+		</item>
+		<item>
+			<name>password</name>
+			<value>password</value>
+		</item>
+		<item>
+			<name>firstname</name>
+			<value>seconduser</value>
+		</item>
+		<item>
+			<name>lastname</name>
+			<value>seconduserlastname</value>
+		</item>
+		<item>
+			<name>email</name>
+			<value>seconduser@gmail.com</value>
+		</item>
+		<item getparam="true">
+			<name>domainid</name>
+			<param>globaldomainid</param>
+		</item>		
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getuserid2</param>
+		</item>
+	</returnvalue>
+</command>
+
+
+<!-- Test case #6 - updateUser command -->
+<command>
+	<name>updateUser</name>
+	<testcase>  6 [Update the User created in (3)]</testcase>
+	<parameters>
+		<item getparam="true">
+			<name>id</name>
+			<param>getuserid1</param>
+		</item>
+		<item random="true" setparam="true">
+			<name>username</name>
+			<param>getusernameparam3</param>
+		</item>
+		<item>
+			<name>password</name>
+			<value>password</value>
+		</item>
+		<item>
+			<name>firstname</name>
+			<value>updatedfirstuser</value>
+		</item>
+		<item>
+			<name>lastname</name>
+			<value>updatedfirstuserlastname</value>
+		</item>
+		<item>
+			<name>email</name>
+			<value>updatedfirstuser@gmail.com</value>
+		</item>
+		<item>
+			<name>timezone</name>
+			<value>PST</value>
+		</item>
+<!--		<item random="true" setparam="true">
+			<name>apikey</name>
+			<param>getuserapikey</param>
+		</item>
+		<item random="true" setparam="true">
+			<name>secretkey</name>
+			<param>getusersecretkey</param>
+		</item>
+-->	</parameters>
+	<returnvalue>
+		<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>getusernameparam3</param>
+			</item>
+<!--			<item getparam="true">
+				<name>apikey</name>
+				<param>getuserapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>getusersecretkey</param>
+			</item>
+-->	</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Updated User updated in (6)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>getusernameparam3</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+<!--			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+-->		</returnvalue>
+	</command>
+
+	<!-- Test case #428 - disableUser command -->
+	<command>
+		<name>disableUser</name>
+		<testcase>428 [Disable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>getusernameparam3</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatedfirstuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatedfirstuserlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatedfirstuser@gmail.com</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+<!--			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+-->		</returnvalue>
+	</command>
+
+	<!-- Test case #9 - enableUser command -->
+	<command>
+		<name>enableUser</name>
+		<testcase>  9 [Enable the User created in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getuserid1</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>getusernameparam3</param>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>updatednimbus</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>updatednimbuslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>updatednimbus@gmail.com</value>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>createtimestamp</param>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>timezone</name>
+				<value>PST</value>
+			</item>
+<!--			<item getparam="true">
+				<name>apikey</name>
+				<param>userapikey</param>
+			</item>
+			<item getparam="true">
+				<name>secretkey</name>
+				<param>usersecretkey</param>
+			</item>
+-->		</returnvalue>
+	</command>
+
+	<!-- Test case # - disableAcount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Disable the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getaccountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>locked</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getaccountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - disableAccount command -->
+	<command>
+		<name>disableAccount</name>
+		<testcase>    [Lock the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item>
+				<name>lock</name>
+				<value>false</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getaccountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>domain</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>	
+						<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>disabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+	<!-- Test case # - enableAccount command -->
+		<command>
+		<name>enableAccount</name>
+		<testcase>    [Enable the Locked Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getaccountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>accounttype</name>
+				<param>globalaccttype</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>receivedbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>sentbytes</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmtotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>ipavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>iptotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>iplimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>volumetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>volumeavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshotlimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>snapshottotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>snapshotavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatelimit</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>templatetotal</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>templateavailable</name>
+				<value>Unlimited</value>
+			</item>
+			<item>
+				<name>vmstopped</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>vmrunning</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>state</name>
+				<value>enabled</value>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!-- Test case #10 - createDomain command -->
+
+<command>
+	<name>createDomain</name>
+	<testcase>    [Create Domain]</testcase>
+	<parameters>
+		<item random="true" setparam="true">
+			<name>name</name>
+			<param>getdomainname2</param>
+		</item>
+		<item getparam="true">
+			<name>parentdomainid</name>
+			<param>globaldomainid</param>
+		</item>
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getdomainid1</param>
+		</item>
+	</returnvalue>
+</command>
+
+	<!-- Test case #11 - listDomains command -->
+	<command>
+		<name>listDomains</name>
+		<testcase> 11 [List Domains]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>getdomainname2</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item getparam="true">
+				<name>id</name>
+				<param>getdomainid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>getdomainname2</param>
+			</item>
+			<item setparam="true">
+				<name>level</name>
+				<param>getcurrentlevel1</param>
+			</item>
+			<item getparam="true">
+				<name>parentdomainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>parentdomainname</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--
+		Test case #952 - updateDomain command - edit domain name and verify
+		that it was really updated
+	-->
+	<command>
+		<name>updateDomain</name>
+		<testcase>952 [Update the Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getdomainid1</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>getdomainname2</param>
+			</item>
+		</parameters>
+		<returnvalues>
+			<item getparam="true">
+				<name>id</name>
+				<param>getdomainid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>getdomainname2</param>
+			</item>
+			<item getparam="true">
+				<name>level</name>
+				<param>getcurrentlevel1</param>
+			</item>
+			<item getparam="true">
+				<name>parentdomainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item getparam="true">
+				<name>parentdomainname</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>	
+	
+	<!-- Test case # - listDomainChildren command -->
+
+	<command>
+		<name>listDomainChildren</name>
+		<testcase> -  [List One of the Children of the Parent Domain] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>globaldomainid</param>
+			</item>
+		</parameters>
+		
+		<returnvalues list="true">
+			<name>domain</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>getdomainid1</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>getdomainname2</param>
+			</item>
+			<item getparam="true">
+				<name>level</name>
+				<param>getcurrentlevel1</param>
+			</item>
+			<item getparam="true">
+				<name>parentdomainid</name>
+				<param>globaldomainid</param>
+			</item>
+			<item>
+				<name>parentdomainname</name>
+				<param>getdomainname1</param>
+			</item>
+			<item>
+				<name>haschild</name>
+				<value>false</value>
+			</item>
+		</returnvalues>
+	</command>
+	
+	<!-- Test case #654 - deleteDomain command -->
+	<command>
+		<name>deleteDomain</name>
+		<testcase>654 [Delete Domain created in (10)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>getdomainid1</param>
+			</item>
+			<item>
+				<name>cleanup</name>
+				<value>true</value>
+			</item>
+		</parameters>
+		
+		<returnvalues>
+			<item>
+				<name>success</name>
+				<value>true</value>
+			</item>
+		</returnvalues>
+	</command>
+
+	<!-- Test case #27 - listTemplates command -->
+	<command>
+		<name>listTemplates</name>
+		<testcase> 27 [List Templates - List System Template]</testcase>
+		<parameters>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+			<item>
+				<name>id</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item setparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item setparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item setparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item setparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item setparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>				
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!--
+
+	<command>
+		<name>listTemplates</name>
+		<testcase> -   Verify All the Parameters of the Listed Template -</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item>
+				<name>templatefilter</name>
+				<value>self</value>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>template</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>debian50templateid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>debian50templatename</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>debian50templatedisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>ispublic</name>
+				<param>debian50templateispublic</param>
+			</item>
+			<item getparam="true">
+				<name>created</name>
+				<param>debian50templatecreated</param>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item getparam="true">
+				<name>passwordenabled</name>
+				<param>debian50templatepasswordenabled</param>
+			</item>
+			<item>
+				<name>crossZones</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>VHD</value>
+			</item>
+			<item getparam="true">
+				<name>ostypeid</name>
+				<param>debian50templateostypeid</param>
+			</item>
+			<item getparam="true">
+				<name>ostypename</name>
+				<param>debian50templateostypename</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>system</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domain</name>
+				<value>ROOT</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>zonename</name>
+				<param>globalzonename</param>
+			</item>
+			<item>
+				<name>status</name>
+				<value>Download Complete</value>
+			</item>
+			<item getparam="true">
+				<name>size</name>
+				<param>debian50templatesize</param>
+			</item>
+			<item>
+				<name>templatetype</name>
+				<value>SYSTEM</value>
+			</item>
+			<item>
+				<name>hypervisor</name>
+				<value>XenServer</value>
+			</item>
+		</returnvalue>
+	</command>
+-->
+
+	<!-- Test case #28 - listServiceOffering command -->
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase> 28 [List the Small Instance Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalserviceofferingid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item setparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item setparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item setparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item setparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+<!--			<item setparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+-->			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>listServiceOfferings</name>
+		<testcase>876 [Verify the First Service Offering] </testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+		</parameters>
+		<returnvalue list="true">
+			<name>serviceoffering</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>smallofferingname</param>
+			</item>
+			<item getparam="true">
+				<name>displaytext</name>
+				<param>smallofferingdisplaytext</param>
+			</item>
+			<item getparam="true">
+				<name>cpunumber</name>
+				<param>smallofferingcpunumber</param>
+			</item>
+			<item getparam="true">
+				<name>cpuspeed</name>
+				<param>smallofferingcpuspeed</param>
+			</item>
+			<item getparam="true">
+				<name>memory</name>
+				<param>smallofferingmemory</param>
+			</item>
+<!--			<item getparam="true">
+				<name>created</name>
+				<param>smallofferingcreatetime</param>
+			</item>
+-->			<item setparam="true">
+				<name>storagetype</name>
+				<param>smallofferingstoragetype</param>
+			</item>
+			<item>
+				<name>offerha</name>
+				<value>false</value>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+	<!-- Test case #39 - listZones command -->
+	<command>
+		<name>listZones</name>
+		<testcase> 39 [List the Global Zone with id-2]</testcase>
+		<returnvalue list="true">
+			<name>zone</name>
+			<element>0</element>
+			<item getparam="true">
+				<name>id</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>globalzonename</param>
+			</item>
+			<item getparam="true">
+				<name>dns1</name>
+				<param>dns1</param>
+			</item>
+			<item getparam="true">
+				<name>dns2</name>
+				<param>dns2</param>
+			</item>
+			<item getparam="true">
+				<name>internaldns1</name>
+				<param>internaldns1</param>
+			</item>
+			<item>
+				<name>vlan</name>
+			</item>
+			<item>
+				<name>guestcidraddress</name>				
+			</item>
+			<item>
+				<name>networktype</name>
+				<value>Advanced</value>
+			</item>
+		</returnvalue>
+	</command>
+			
+<!--List the User-->
+
+<!--Create Service Offering-->
+
+<command>
+	<name>createServiceOffering</name>
+	<testcase>[1] createServiceOffering-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>issystem</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LittleInstance</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>LittleInstance</value>
+	</item>
+	<item>
+		<name>storagetype</name>
+		<value>shared</value>
+	</item>
+	<item>
+		<name>cpuNumber</name>
+		<value>1</value>
+	</item>
+	<item>
+		<name>cpuSpeed</name>
+		<value>100</value>
+	</item>
+	<item>
+		<name>memory</name>
+		<value>128</value>
+	</item>
+	<item>
+		<name>offerha</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>limitcpuuse</name>
+		<value>false</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>servofferid</param>
+	</item>
+	</returnvalue>
+</command>
+
+<!-- Create a New Disk Offering -->
+
+<command>
+<name>createDiskOffering</name>
+	<testcase>[1] createDiskOffering-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>isMirrored</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>name</name>
+		<value>Little</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>LittleDisk1GB</value>
+	</item>
+	<item>
+		<name>customized</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>disksize</name>
+		<value>1</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>diskofferid</param>
+	</item>
+	</returnvalue>
+</command>
+
+<!-- Deploy A Virtual Machine -->
+ 
+<command>
+	<name>deployVirtualMachine</name>
+	<testcase>[2] deployVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneId</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>hypervisor</name>
+		<param>globalhypervisortype</param>
+	</item>
+	<item getparam="true">
+		<name>templateId</name>
+		<param>globaltemplateid</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>servofferid</param>
+	</item>
+	<item getparam="true">
+		<name>networkIds</name>
+		<param>getnetworkid1</param>
+	</item>
+	<item getparam="true">
+		<name>diskOfferingId</name>
+		<param>diskofferid</param>
+	</item>
+	<item>
+		<name>displayname</name>
+		<value>FirstVM</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>FirstVM</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>	
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getvmid1</param>
+		</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>updateVirtualMachine</name>
+	<testcase>[3] updateVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>displayName</name>
+		<value>First-VM</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>First-VM</value>
+	</item>
+	<item>
+		<name>haenable</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	</parameters>
+</command>
+ 
+ <!-- Network Rule Section BEGIN -->
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[4] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>enableStaticNat</name>
+	<testcase>[5] enableStaticNat-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createIpForwardingRule</name>
+	<testcase>[6] createIpForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>startPort</name>
+		<value>1</value>
+	</item>
+	<item>
+		<name>endPort</name>
+		<value>100</value>
+	</item>
+	<item>
+		<name>protocol</name>
+		<value>TCP</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getipfwdruleid1</param>
+	</item>	
+	</returnvalue>
+</command>
+ 
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+		    <name>h</name>
+			<param>getipaddress1</param>
+		</item>
+		<item>
+		    <name>p</name>
+			<value>password</value>
+		</item>
+		</parameters>
+	</command>
+ 
+<command>
+	<name>deleteIpForwardingRule</name>
+	<testcase>[7] deleteIpForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getipfwdruleid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disableStaticNat</name>
+	<testcase>[8] disableStaticNat-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[9] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[10] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createPortForwardingRule</name>
+	<testcase>[11] createPortForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>cidrlist</name>
+		<value>0.0.0.0/0</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>22</value>
+	</item>
+	<item>
+		<name>publicendport</name>
+		<value>30</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>22</value>
+	</item>
+	<item>
+		<name>privateendport</name>
+		<value>30</value>
+	</item>
+	<item>
+		<name>protocol</name>
+		<value>TCP</value>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getportfwdruleid1</param>
+	</item>
+	
+	</returnvalue>
+</command>
+
+<!-- SSH TEST NEEDS TO BE DONE HERE -->
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+		    <name>h</name>
+			<param>getipaddress1</param>
+		</item>
+		<item>
+		    <name>p</name>
+			<value>password</value>
+		</item>
+		</parameters>
+	</command>
+ 
+<command>
+	<name>deletePortForwardingRule</name>
+	<testcase>[12] deletePortForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getportfwdruleid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[13] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[14] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createLoadBalancerRule</name>
+	<testcase>[15] createLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>publicipid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRule-1</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[16] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!--
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[17] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid2</param>
+	</item>
+	</parameters>
+</command>
+ -->
+<command>
+	<name>removeFromLoadBalancerRule</name>
+	<testcase>[18] removeFromLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>updateLoadBalancerRule</name>
+	<testcase>[19] updateLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRuleUpdated-1</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[20] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[14] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</returnvalue>
+</command> 
+ 
+<command>
+	<name>createLoadBalancerRule</name>
+	<testcase>[21] createLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>publicipid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRule-2</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[22] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<!-- 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[23] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid2</param>
+	</item>
+	</parameters>
+</command>
+-->
+
+<command>
+	<name>deleteLoadBalancerRule</name>
+	<testcase>[24] deleteLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[25] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!-- Network Rule Section END -->
+<command>
+	<name>listVolumes</name>
+	<testcase>[26] listROOTVolumes-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>type</name>
+		<value>ROOT</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createSnapshot</name>
+	<testcase>[26] createSnapshotofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getsnapshotid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>listSnapshots</name>
+	<testcase>[27] listROOTVolumeSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <command>
+	<name>listVolumes</name>
+	<testcase>[26] listDATADISKVolumes-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>type</name>
+		<value>DATADISK</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	</returnvalue>
+</command>
+
+<command>
+	<name>createSnapshot</name>
+	<testcase>[28] createSnapshotofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getsnapshotid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>listSnapshots</name>
+	<testcase>[29] listDATADISKVolumeSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[30] createTemplateFromSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromSnapshot-1</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>TemplateFromSnapshot-1</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>isfeatured</name>
+		<value>true</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[31] createTemplateFromSnapshotTakenofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid2</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromSnapshot-2</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>TemplateFromSnapshot-2</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>isfeatured</name>
+		<value>true</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createVolume</name>
+	<testcase>[32] createVolumeFromSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>VlmfromSnapshot-1</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createVolume</name>
+	<testcase>[33] createVolumeFromSnapshotTakenofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid2</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>VlmfromSnapshot-2</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</returnvalue>
+
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[34] attachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[35] attachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!--create a blank Volume and try to attach it -->
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[36] detachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[37] detachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[34] attachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[35] attachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[40] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>updateVirtualMachine</name>
+	<testcase>[41] updateVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>displayName</name>
+		<value>First-VM-1-1</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>First-VM-1-1</value>
+	</item>
+	<item>
+		<name>haenable</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[36] detachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[37] detachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[44] createTemplateFromROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeId</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromRootVolume-3</value>
+	</item>
+	<item>
+		<name>displayText</name>
+		<value>TemplateFromRootVolume-3</value>
+	</item>
+	<item>
+		<name>osTypeId</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid3</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[45] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[46] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[47] createHOURLYSnapshotPolicyForRootVolume-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>hourly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>11</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[48] createDAILYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>daily</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>13:07</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[49] createWEEKLYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>weekly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>16:07:4</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[50] createMONTHLYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>monthly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>18:19:1</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getmonthlysnapshotpolicyid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>deleteSnapshotPolicies</name>
+	<testcase>[51] deleteMONTHLYSnapshotPolicies-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getmonthlysnapshotpolicyid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteVolume</name>
+	<testcase>[52] deleteVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteVolume</name>
+	<testcase>[53] deleteVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+
+<!-- ONE MORE VOLUME NEEDS TO BE DELETE, AFTER ADDING THE CREATION PART -->
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[54] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>recoverVirtualMachine</name>
+	<testcase>[55] recoverVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[56] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[57] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[58] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[59] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>recoverVirtualMachine</name>
+	<testcase>[60] recoverVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>changeServiceForVirtualMachine</name>
+	<testcase>[61] changeServiceForVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>globalchangeservoff</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[62] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[63] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[64] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[65] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deployVirtualMachine</name>
+	<testcase>[66] deployVirtualMachineFromTemplateCreatedFromSnapshotofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneId</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>hypervisor</name>
+		<param>globalhypervisortype</param>
+	</item>
+	<item getparam="true">
+		<name>templateId</name>
+		<param>gettemplateid1</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>servofferid</param>
+	</item>
+	<item getparam="true">
+		<name>networkIds</name>
+		<param>getnetworkid1</param>
+	</item>
+	<item getparam="true">
+		<name>diskOfferingId</name>
+		<param>diskofferid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</returnvalue>
+</command>
+
+<command>
+	<name>deleteTemplate</name>
+	<testcase>[67] deleteTemplateofSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>gettemplateid1</param>
+	</item>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteTemplate</name>
+	<testcase>[68] deleteTemplateofSnapshotTakenofDATAVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>gettemplateid2</param>
+	</item>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteTemplate</name>
+	<testcase>[69] deleteTemplateCreatedFromROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>gettemplateid3</param>
+	</item>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteSnapshot</name>
+	<testcase>[70] deleteSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getsnapshotid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteSnapshot</name>
+	<testcase>[71] deleteSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getsnapshotid2</param>
+	</item>
+	</parameters>
+</command>
+
+<!-- START -->
+<!-- Start of tests for VM created From Template created From a Snapshot-->
+
+<command>
+	<name>updateVirtualMachine</name>
+	<testcase>[3] updateVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>displayName</name>
+		<value>First-VM</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>First-VM</value>
+	</item>
+	<item>
+		<name>haenable</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	</parameters>
+</command>
+ 
+ <!-- Network Rule Section BEGIN -->
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[4] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>enableStaticNat</name>
+	<testcase>[5] enableStaticNat-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createIpForwardingRule</name>
+	<testcase>[6] createIpForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>startPort</name>
+		<value>1</value>
+	</item>
+	<item>
+		<name>endPort</name>
+		<value>100</value>
+	</item>
+	<item>
+		<name>protocol</name>
+		<value>TCP</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getipfwdruleid1</param>
+	</item>	
+	</returnvalue>
+</command>
+ 
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+		    <name>h</name>
+			<param>getipaddress1</param>
+		</item>
+		<item>
+		    <name>p</name>
+			<value>password</value>
+		</item>
+		</parameters>
+	</command>
+ 
+<command>
+	<name>deleteIpForwardingRule</name>
+	<testcase>[7] deleteIpForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getipfwdruleid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disableStaticNat</name>
+	<testcase>[8] disableStaticNat-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[9] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[10] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createPortForwardingRule</name>
+	<testcase>[11] createPortForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>cidrlist</name>
+		<value>0.0.0.0/0</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>22</value>
+	</item>
+	<item>
+		<name>publicendport</name>
+		<value>30</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>22</value>
+	</item>
+	<item>
+		<name>privateendport</name>
+		<value>30</value>
+	</item>
+	<item>
+		<name>protocol</name>
+		<value>TCP</value>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getportfwdruleid1</param>
+	</item>
+	
+	</returnvalue>
+</command>
+
+<!-- SSH TEST NEEDS TO BE DONE HERE -->
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+		    <name>h</name>
+			<param>getipaddress1</param>
+		</item>
+		<item>
+		    <name>p</name>
+			<value>password</value>
+		</item>
+		</parameters>
+	</command>
+ 
+<command>
+	<name>deletePortForwardingRule</name>
+	<testcase>[12] deletePortForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getportfwdruleid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[13] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[14] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createLoadBalancerRule</name>
+	<testcase>[15] createLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>publicipid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRule-1</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[16] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!--
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[17] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid2</param>
+	</item>
+	</parameters>
+</command>
+ -->
+<command>
+	<name>removeFromLoadBalancerRule</name>
+	<testcase>[18] removeFromLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item>
+		<name>virtualmachineids</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>updateLoadBalancerRule</name>
+	<testcase>[19] updateLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRuleUpdated-1</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[20] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[14] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</returnvalue>
+</command> 
+ 
+<command>
+	<name>createLoadBalancerRule</name>
+	<testcase>[21] createLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>publicipid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRule-2</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[22] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<!-- 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[23] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid2</param>
+	</item>
+	</parameters>
+</command>
+--> 
+<command>
+	<name>deleteLoadBalancerRule</name>
+	<testcase>[24] deleteLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[25] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!-- Network Rule Section END -->
+<command>
+	<name>listVolumes</name>
+	<testcase>[26] listROOTVolumes-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>type</name>
+		<value>ROOT</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createSnapshot</name>
+	<testcase>[26] createSnapshotofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getsnapshotid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>listSnapshots</name>
+	<testcase>[27] listROOTVolumeSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <command>
+	<name>listVolumes</name>
+	<testcase>[26] listDATADISKVolumes-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>type</name>
+		<value>DATADISK</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	</returnvalue>
+</command>
+
+<command>
+	<name>createSnapshot</name>
+	<testcase>[28] createSnapshotofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getsnapshotid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>listSnapshots</name>
+	<testcase>[29] listDATADISKVolumeSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[30] createTemplateFromSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromSnapshot-4</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>TemplateFromSnapshot-4</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>isfeatured</name>
+		<value>true</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[31] createTemplateFromSnapshotTakenofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid2</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromSnapshot-5</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>TemplateFromSnapshot-5</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>isfeatured</name>
+		<value>true</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createVolume</name>
+	<testcase>[32] createVolumeFromSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>VlmfromSnapshot-1</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createVolume</name>
+	<testcase>[33] createVolumeFromSnapshotTakenofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid2</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>VlmfromSnapshot-2</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</returnvalue>
+
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[34] attachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[35] attachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!--create a blank Volume and try to attach it -->
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[36] detachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[37] detachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[34] attachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[35] attachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[40] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>updateVirtualMachine</name>
+	<testcase>[41] updateVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	<item>
+		<name>displayName</name>
+		<value>First-VM-1-1</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>First-VM-1-1</value>
+	</item>
+	<item>
+		<name>haenable</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[36] detachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[37] detachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[44] createTemplateFromROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeId</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromRootVolume-6</value>
+	</item>
+	<item>
+		<name>displayText</name>
+		<value>TemplateFromRootVolume-6</value>
+	</item>
+	<item>
+		<name>osTypeId</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid3</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[45] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[46] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[47] createHOURLYSnapshotPolicyForRootVolume-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>hourly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>11</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[48] createDAILYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>daily</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>13:07</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[49] createWEEKLYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>weekly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>16:07:4</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[50] createMONTHLYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>monthly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>18:19:1</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getmonthlysnapshotpolicyid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>deleteSnapshotPolicies</name>
+	<testcase>[51] deleteMONTHLYSnapshotPolicies-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getmonthlysnapshotpolicyid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteVolume</name>
+	<testcase>[52] deleteVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteVolume</name>
+	<testcase>[53] deleteVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+
+<!-- ONE MORE VOLUME NEEDS TO BE DELETE, AFTER ADDING THE CREATION PART -->
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[54] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>recoverVirtualMachine</name>
+	<testcase>[55] recoverVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[56] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[57] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[58] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[59] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>recoverVirtualMachine</name>
+	<testcase>[60] recoverVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>changeServiceForVirtualMachine</name>
+	<testcase>[61] changeServiceForVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>globalchangeservoff</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[62] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[63] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[64] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[65] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<!-- End of tests for VM created From Template created From a Snapshot-->
+<!-- END -->
+
+<!-- START -->
+<!-- Start of tests for VM created from ISO -->
+
+<!-- Deploy A Virtual Machine -->
+ 
+ <!--
+<command>
+	<name>deployVirtualMachine</name>
+	<testcase>[2] deployVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneId</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>hypervisor</name>
+		<param>globalhypervisortype</param>
+	</item>
+	<item getparam="true">
+		<name>templateId</name>
+		<param>getisoid1</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>servofferid</param>
+	</item>
+	<item getparam="true">
+		<name>networkIds</name>
+		<param>getnetworkid1</param>
+	</item>
+	<item getparam="true">
+		<name>diskOfferingId</name>
+		<param>diskofferid</param>
+	</item>
+	<item>
+		<name>displayname</name>
+		<value>ISO-ThirdVM</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>ISO-ThirdVM</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>	
+	</parameters>
+	<returnvalue>
+		<item setparam="true">
+			<name>id</name>
+			<param>getvmid1</param>
+		</item>
+	</returnvalue>
+</command>
+ -->
+<command>
+	<name>updateVirtualMachine</name>
+	<testcase>[3] updateVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	<item>
+		<name>displayName</name>
+		<value>ISO-Third-VM</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>ISO-Third-VM</value>
+	</item>
+	<item>
+		<name>haenable</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>112</value>
+	</item>
+	</parameters>
+</command>
+ 
+ <!-- Network Rule Section BEGIN -->
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[4] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>enableStaticNat</name>
+	<testcase>[5] enableStaticNat-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createIpForwardingRule</name>
+	<testcase>[6] createIpForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>startPort</name>
+		<value>1</value>
+	</item>
+	<item>
+		<name>endPort</name>
+		<value>100</value>
+	</item>
+	<item>
+		<name>protocol</name>
+		<value>TCP</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getipfwdruleid1</param>
+	</item>	
+	</returnvalue>
+</command>
+ 
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+		    <name>h</name>
+			<param>getipaddress1</param>
+		</item>
+		<item>
+		    <name>p</name>
+			<value>password</value>
+		</item>
+		</parameters>
+	</command>
+ 
+<command>
+	<name>deleteIpForwardingRule</name>
+	<testcase>[7] deleteIpForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getipfwdruleid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disableStaticNat</name>
+	<testcase>[8] disableStaticNat-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[9] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[10] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createPortForwardingRule</name>
+	<testcase>[11] createPortForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>ipaddressid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>cidrlist</name>
+		<value>0.0.0.0/0</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>22</value>
+	</item>
+	<item>
+		<name>publicendport</name>
+		<value>30</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>22</value>
+	</item>
+	<item>
+		<name>privateendport</name>
+		<value>30</value>
+	</item>
+	<item>
+		<name>protocol</name>
+		<value>TCP</value>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getportfwdruleid1</param>
+	</item>
+	
+	</returnvalue>
+</command>
+
+<!-- SSH TEST NEEDS TO BE DONE HERE -->
+ 	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+		    <name>h</name>
+			<param>getipaddress1</param>
+		</item>
+		<item>
+		    <name>p</name>
+			<value>password</value>
+		</item>
+		</parameters>
+	</command>
+ 
+<command>
+	<name>deletePortForwardingRule</name>
+	<testcase>[12] deletePortForwardingRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getportfwdruleid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[13] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[14] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item setparam="true">
+		<name>ipaddress</name>
+		<param>getipaddress1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createLoadBalancerRule</name>
+	<testcase>[15] createLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>publicipid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRule-1</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[16] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!--
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[17] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid2</param>
+	</item>
+	</parameters>
+</command>
+ -->
+<command>
+	<name>removeFromLoadBalancerRule</name>
+	<testcase>[18] removeFromLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>updateLoadBalancerRule</name>
+	<testcase>[19] updateLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRuleUpdated-1</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[20] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>associateIpAddress</name>
+	<testcase>[14] associateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</returnvalue>
+</command> 
+ 
+<command>
+	<name>createLoadBalancerRule</name>
+	<testcase>[21] createLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>publicipid</name>
+		<param>getpublicipid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>LBRule-2</value>
+	</item>
+	<item>
+		<name>publicport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>privateport</name>
+		<value>80</value>
+	</item>
+	<item>
+		<name>algorithm</name>
+		<value>roundrobin</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[22] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<!-- 
+<command>
+	<name>assignToLoadBalancerRule</name>
+	<testcase>[23] assignToLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	<item getparam="true">
+		<name>virtualmachineids</name>
+		<param>getvmid2</param>
+	</item>
+	</parameters>
+</command>
+-->
+
+<command>
+	<name>deleteLoadBalancerRule</name>
+	<testcase>[24] deleteLoadBalancerRule-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getldblcrule1</param>
+	</item>	
+	</parameters>
+</command>
+ 
+<command>
+	<name>disassociateIpAddress</name>
+	<testcase>[25] disassociateIpAddress-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getpublicipid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!-- Network Rule Section END -->
+<command>
+	<name>listVolumes</name>
+	<testcase>[26] listROOTVolumes-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>globalisovmid1</param>
+	</item>
+	<item>
+		<name>type</name>
+		<value>ROOT</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createSnapshot</name>
+	<testcase>[26] createSnapshotofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getsnapshotid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>listSnapshots</name>
+	<testcase>[27] listROOTVolumeSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <command>
+	<name>listVolumes</name>
+	<testcase>[26] listDATADISKVolumes-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>virtualmachineid</name>
+		<param>globalisovmid1</param>
+	</item>
+	<item>
+		<name>type</name>
+		<value>DATADISK</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	</returnvalue>
+</command>
+
+<command>
+	<name>createSnapshot</name>
+	<testcase>[28] createSnapshotofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getsnapshotid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>listSnapshots</name>
+	<testcase>[29] listDATADISKVolumeSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getdatavolumeid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[30] createTemplateFromSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromSnapshot-1</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>TemplateFromSnapshot-1</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>isfeatured</name>
+		<value>true</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[31] createTemplateFromSnapshotTakenofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid2</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromSnapshot-2</value>
+	</item>
+	<item>
+		<name>displaytext</name>
+		<value>TemplateFromSnapshot-2</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>isfeatured</name>
+		<value>true</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createVolume</name>
+	<testcase>[32] createVolumeFromSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>VlmfromSnapshot-1</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>createVolume</name>
+	<testcase>[33] createVolumeFromSnapshotTakenofDATADISKVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>snapshotid</name>
+		<param>getsnapshotid2</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>VlmfromSnapshot-2</value>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</returnvalue>
+
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[34] attachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[35] attachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+ <!--create a blank Volume and try to attach it -->
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[36] detachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[37] detachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[34] attachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>attachVolume</name>
+	<testcase>[35] attachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	<item getparam="true">
+		<name>virtualMachineId</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[40] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>updateVirtualMachine</name>
+	<testcase>[41] updateVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	<item>
+		<name>displayName</name>
+		<value>First-VM-1-1</value>
+	</item>
+	<item>
+		<name>group</name>
+		<value>First-VM-1-1</value>
+	</item>
+	<item>
+		<name>haenable</name>
+		<value>false</value>
+	</item>
+	<item>
+		<name>ostypeid</name>
+		<value>12</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[36] detachVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>detachVolume</name>
+	<testcase>[37] detachVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createTemplate</name>
+	<testcase>[44] createTemplateFromROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>volumeId</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>name</name>
+		<value>TemplateFromRootVolume-3</value>
+	</item>
+	<item>
+		<name>displayText</name>
+		<value>TemplateFromRootVolume-3</value>
+	</item>
+	<item>
+		<name>osTypeId</name>
+		<value>12</value>
+	</item>
+	<item>
+		<name>isPublic</name>
+		<value>true</value>
+	</item>
+	<item>
+		<name>passwordEnabled</name>
+		<value>false</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>gettemplateid3</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[45] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[46] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[47] createHOURLYSnapshotPolicyForRootVolume-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>hourly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>11</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[48] createDAILYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>daily</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>13:07</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[49] createWEEKLYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>weekly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>16:07:4</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>createSnapshotPolicy</name>
+	<testcase>[50] createMONTHLYSnapshotPolicy-TestCase</testcase>
+	<parameters>
+	<item>
+		<name>intervaltype</name>
+		<value>monthly</value>
+	</item>
+	<item>
+		<name>schedule</name>
+		<value>18:19:1</value>
+	</item>
+	<item getparam="true">
+		<name>volumeid</name>
+		<param>getrootvolumeid1</param>
+	</item>
+	<item>
+		<name>maxsnaps</name>
+		<value>8</value>
+	</item>
+	<item>
+		<name>timezone</name>
+		<value>America%2FLos_Angeles</value>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getmonthlysnapshotpolicyid1</param>
+	</item>
+	</returnvalue>
+</command>
+ 
+<command>
+	<name>deleteSnapshotPolicies</name>
+	<testcase>[51] deleteMONTHLYSnapshotPolicies-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getmonthlysnapshotpolicyid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteVolume</name>
+	<testcase>[52] deleteVolume1-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid2</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteVolume</name>
+	<testcase>[53] deleteVolume2-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getdatavolumeid3</param>
+	</item>
+	</parameters>
+</command>
+
+<!-- ONE MORE VOLUME NEEDS TO BE DELETE, AFTER ADDING THE CREATION PART -->
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[54] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>recoverVirtualMachine</name>
+	<testcase>[55] recoverVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[56] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[57] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[58] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[59] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>recoverVirtualMachine</name>
+	<testcase>[60] recoverVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>changeServiceForVirtualMachine</name>
+	<testcase>[61] changeServiceForVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>globalchangeservoff</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>startVirtualMachine</name>
+	<testcase>[62] startVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>rebootVirtualMachine</name>
+	<testcase>[63] rebootVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>stopVirtualMachine</name>
+	<testcase>[64] stopVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>destroyVirtualMachine</name>
+	<testcase>[65] destroyVirtualMachine-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>globalisovmid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deployVirtualMachine</name>
+	<testcase>[66] deployVirtualMachineFromTemplateCreatedFromSnapshotofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>zoneId</name>
+		<param>globalzoneid</param>
+	</item>
+	<item getparam="true">
+		<name>hypervisor</name>
+		<param>globalhypervisortype</param>
+	</item>
+	<item getparam="true">
+		<name>templateId</name>
+		<param>gettemplateid1</param>
+	</item>
+	<item getparam="true">
+		<name>serviceOfferingId</name>
+		<param>servofferid</param>
+	</item>
+	<item getparam="true">
+		<name>networkIds</name>
+		<param>getnetworkid1</param>
+	</item>
+	<item getparam="true">
+		<name>diskOfferingId</name>
+		<param>diskofferid</param>
+	</item>
+	<item getparam="true">
+		<name>account</name>
+		<param>accountname</param>
+	</item>
+	<item getparam="true">
+		<name>domainid</name>
+		<param>globaldomainid</param>
+	</item>
+	</parameters>
+	<returnvalue>
+	<item setparam="true">
+		<name>id</name>
+		<param>getvmid1</param>
+	</item>
+	</returnvalue>
+</command>
+
+<command>
+	<name>deleteTemplate</name>
+	<testcase>[67] deleteTemplateofSnapshotTakenofROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>gettemplateid1</param>
+	</item>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteTemplate</name>
+	<testcase>[68] deleteTemplateofSnapshotTakenofDATAVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>gettemplateid2</param>
+	</item>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteTemplate</name>
+	<testcase>[69] deleteTemplateCreatedFromROOTVolume-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>gettemplateid3</param>
+	</item>
+	<item getparam="true">
+		<name>zoneid</name>
+		<param>globalzoneid</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteSnapshot</name>
+	<testcase>[70] deleteSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getsnapshotid1</param>
+	</item>
+	</parameters>
+</command>
+ 
+<command>
+	<name>deleteSnapshot</name>
+	<testcase>[71] deleteSnapshot-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getsnapshotid2</param>
+	</item>
+	</parameters>
+</command>
+
+
+<!-- End of tests for VM created from ISO -->
+<!-- END -->
+
+<command>
+		<name>extractIso</name>
+		<testcase>[] extractIsoTestCase </testcase>
+		<parameters>
+        <item getparam="true">
+                <name>id</name>
+                <param>getisoid1</param>
+        </item>
+        <item>
+                <name>zoneid</name>
+                <value>1</value>
+        </item>
+        <item>
+                <name>mode</name>
+                <value>HTTP_DOWNLOAD</value>
+        </item>
+        </parameters>
+</command>
+
+<command>
+		<name>deleteIso</name>
+		<testcase>[] deleteIsoTestCase </testcase>
+		<parameters>
+        <item getparam="true">
+                <name>id</name>
+                <param>getisoid1</param>
+        </item>
+        <item>
+                <name>zoneid</name>
+                <value>1</value>
+        </item>
+        </parameters>
+</command>
+
+<command>
+	<name>deleteAccount</name>
+	<testcase>[72] deleteAccount-TestCase</testcase>
+	<parameters>
+	<item getparam="true">
+		<name>id</name>
+		<param>getaccountid</param>
+	</item>
+	</parameters>
+</command>	
+</regression> 
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/sanity.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/sanity.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/sanity.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/sanity.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,378 @@
+<!--
+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.
+-->
+<sanity>
+
+	<!-- 
+		STEPS/TEST CASES COVERED:
+		1. Create an Account
+		2. Create a User in that Account
+		3. Deploy a VM in the account
+		4. Acquire an IP Address
+		5. Release the IP Address
+		6. Reboot the VM
+		7. Stop the VM
+		8. Start the VM 
+		9. List Routers
+		10. Stop Router
+		11.	List Router
+		12. Start Router
+		13. Destroy VM
+		14. Verify that vm is destroyed
+		15.	Recover virtual machine
+		16. Verify that vm is destroyed
+		17. Delete Account
+		
+	 -->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Create default network-->
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy a Virtual Machine under the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>	[Acquire an IP Address (Non-Source NAT*)]</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>  
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>	[Release the IP Address (Non-Source NAT*)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicipid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>	[Reboot Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>	[Stop virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>	[Start virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listRouters</name>
+		<testcase>	[List Routers]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<command>
+		<name>stopRouter</name>
+		<testcase>	[Stop router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>startRouter</name>
+		<testcase>	[Start router]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>	[Destroy virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>	[Verify that vm was destroyed]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Destroyed</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>	[Recover virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>	[Verify that machine was recovered]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>	[Delete account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+</sanity>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/securitygroups.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/securitygroups.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/securitygroups.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/securitygroups.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,770 @@
+<!--
+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.
+-->
+<securitygroups>
+<!-- 
+		STEPS/TEST CASES COVERED:
+		2. Create a User and its Account
+		2. Register User Keys
+		3. Deploy a VM in the account
+		4. Acquire an IP Address
+		5. Release the IP Address
+		6. Reboot the VM
+		7. Stop the VM
+		8. Start the VM 
+		9. List Routers
+		10. Stop Router
+		11.	List Router
+		12. Start Router
+		13. Destroy VM
+		14. Verify that vm is destroyed
+		15.	Recover virtual machine
+		16. Verify that vm is destroyed
+		17. Delete Account
+		
+-->
+
+	<command>
+		<name>createUser</name>
+		<testcase>Create User and Account</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the User</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createNetworkGroup</name>
+		<usercommand>true</usercommand>
+		<testcase>Create a Network Group</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>name</name>
+				<param>networkgrp-1</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- FIRST INGRESS RULE -->
+	
+	<command>
+		<name>authorizeNetworkGroupIngress</name>
+		<testcase>Add the First Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.131.171/32</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploy a VM with the Network Group Assigned</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkgrouplist</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh access test for the VM</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 1 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Stopping VM</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Starting VM</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Rebooting VM</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>revokeNetworkGroupIngress</name>
+		<testcase>Revoke The First Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.131.171/32</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+			
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh access test for the vm - should fail as ingress rule is revoked</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- SECOND INGRESS RULE -->
+	
+	<command>
+		<name>authorizeNetworkGroupIngress</name>
+		<testcase>Add the Second Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.131.172/32</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploy a VM with the Network Group Assigned</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkgrouplist</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail as no access provided by ingress rule</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>revokeNetworkGroupIngress</name>
+		<testcase>Revoke The Second Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.131.172/32</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>22</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- THIRD INGRESS RULE -->
+	
+	<command>
+		<name>authorizeNetworkGroupIngress</name>
+		<testcase>Add the Third Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.131.0/24</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploy a VM with the Network Group Assigned</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkgrouplist</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail as no access provided by ingress rule</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>revokeNetworkGroupIngress</name>
+		<testcase>Revoke The Third Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.131.0/24</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- FOURTH INGRESS RULE -->
+	
+	<command>
+		<name>authorizeNetworkGroupIngress</name>
+		<testcase>Add the Fourth Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.130.0/24</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Deploy a VM with the Network Group Assigned</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>flatnetworkserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkgrouplist</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail as no access provided by ingress rule</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>revokeNetworkGroupIngress</name>
+		<testcase>Revoke The Fourth Ingress Rule</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>networkgroupname</name>
+				<param>networkgrp-1</param>
+			</item>
+			<item>
+				<name>cidrlist</name>
+				<value>192.168.130.0/24</value>		<!-- CHANGE IF REQUIRED -->
+			</item>
+			<item>
+				<name>endport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>startport</name>
+				<value>80</value>
+			</item>
+			<item>
+				<name>protocol</name>
+				<value>tcp</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Clean Up -->
+	<command>
+		<name>deleteNetworkGroup</name>
+		<usercommand>true</usercommand>
+		<testcase>Delete First network group</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>name</name>
+				<param>networkgrp-1</param>
+			</item>
+		</parameters>
+	</command>
+		
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>Destroying virutal machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 2 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!--  Delete user as a part of cleanup -->	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>			
+
+</securitygroups>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/sharedstorage_volume_test.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/sharedstorage_volume_test.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/sharedstorage_volume_test.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/sharedstorage_volume_test.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1374 @@
+<!--
+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.
+-->
+<volumes>
+<!--  Test case 1028 - attach volume to the running vm -->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+
+<!-- <command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>sharedstoragevolumeregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>sharedstoragevolumeregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1028</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!--  Test case 1029 - attach volume to stopped vm -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1029</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1030 - verify that type of the volume is DATADISK always-->
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1030</testcase>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+<!--  Test case 1031 - verify that you can detach DataDisk from the vm-->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1031</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!--  Test case 1033 - verify that you can't detach RootDisk from the vm-->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1033</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1035 - attach 5 volumes to Running vm-->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>		
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-3</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volume1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volume2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volume3</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volume4</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volume5</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volume1</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volume2</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volume3</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volume4</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1035</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volume5</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!--  Test case 1036 - reboot the vm after attaching 5 volumes to it -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1036</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 1037 - stop and start the vm after attaching 5 volumes to it -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1037</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1037</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1039 - try to attach 6th volume to the vm - should fail -->
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volume6</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<testcase>1039</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volume6</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!--  Test case 1038 - destroy the vm and make sure that all attached volumes got destroyed -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1038</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<testcase>1038</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Test case 1040 - detach all data disks from the vm and reboot -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-4</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1040</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 1041 - detach all disks from the vm and stop/start -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<testcase>1041</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+
+<!--  Test case 1044 - detach volume from Running vm -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-5</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1044</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<testcase>1044</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 1045 - detach volume from Stopped vm -->
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1045</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<empty>true</empty>
+		<testcase>1045</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Test case 1046 - try to attach the same volume twice -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-6</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>account</name>
+				<param>accountvar</param>
+			</item>	
+			<item>
+			    <name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SharedStorage-VM-7</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<testcase>1046</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Try to attach volume to destroyed vm - negative case-->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createVolume</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1081</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Try to detach volume from the vm in Destroyed state - negative case -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid2</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>DATADISK</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>detachVolume</name>
+		<usercommand>true</usercommand>
+		<testcase>1082</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>datavolumeid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Execute cleanup -->	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Deleting Account as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+</volumes>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/snapshot_iso.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/snapshot_iso.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/snapshot_iso.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/snapshot_iso.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,646 @@
+<!--
+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.
+-->
+<snapshots>
+
+<!-- 
+	  STEPS + TEST CASES COVERED:
+	1.Creating a Normal User
+	2.Register that User
+	3.Deploy a Smaller Disk Offering VM(Small VM)from an ISO image
+		a.List the Root Disk of the Small VM
+		b.List the Data Disk of the Small VM
+	4.Wait for some time for the management server to respond	
+	5.Create a Snapshot from the root disk of the Small VM (create from ISO)
+	6.Create a Snapshot from the data disk of the Small VM (create from ISO)
+	7.Create a Template from the snapshot taken of the root disk of the Small VM (create from ISO)
+	8.Deploy a VM from the template created from the snapshot taken of the root disk of the Small VM(create from ISO)
+	9.Create a Volume from the snapshot taken of the root disk of the Small VM(create from ISO)
+	10.Create a Volume from the snapshot taken of the data disk of the Small VM(create from ISO)
+	
+	11.Attach the volume created from the snapshot taken of the root disk of the Small VM to the VM created from the template created from the snapshot taken of the root disk of the Small VM(create from ISO)
+	12.Attach the volume created from the snapshot taken of the root disk of the Small VM to a different VM(create from ISO).
+	13.Reboot,start,stop VM created from the template created from the snapshot taken of the root disk of the Small VM(create from ISO).
+	14.Delete a Snapshot taken of an attached Volume
+	
+	15.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM(create from ISO).
+	16.Create a Snapshot from the root disk of the VM(create from ISO) immediately after its destruction. 
+ 	17.Create a Snapshot from the destroyed root disk of the VM(create from ISO) after expunge delay time duration.
+ 	18.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM(create from ISO).
+ 	19.Execute the cleanup - Delete a user 
+-->
+
+<!-- 1. Create a Normal User -->
+<command> 
+		<name>createUser</name>
+		<testcase>Create a user</testcase>
+		
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 2.Register that User -->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- Test case # - register Iso command -->	
+		<command>
+		<name>registerIso</name>
+		<testcase>Register iso</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>isoname</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>isodisplay</param>
+			</item>
+			<item>
+				<name>url</name>
+				<value>http://nfs1.lab.vmops.com/isos_64bit/Ubuntu-10.04/ubuntu-10.04-desktop-amd64.iso</value>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>59</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privateisoid</param>
+			</item>
+			<item>
+				<name>created</name>
+			</item>
+			<item>
+				<name>ispublic</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>bootable</name>
+				<value>true</value>
+			</item>
+			<item>
+				<name>isready</name>
+				<value>false</value>
+			</item>
+			<item>
+				<name>isfeatured</name>
+				<value>false</value>
+			</item>
+			<item param="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item param="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!-- 3.Deploy a Smaller Disk Offering VM(Small VM) -->	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying VM from small diskOffering</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privateisoid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- a.List the Root Disk of the Small VM -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+<!-- b.List the Data Disk of the Small VM -->	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>datadisk</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalldatavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 4.Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>200</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!-- 5.Create a Snapshot from the root disk of the Small VM -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of ROOT disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 6.Create a Snapshot from the data disk of the Small VM -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of Data disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smalldatavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalldatasnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 7.Create a Template from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>createTemplate</name>
+		<testcase>Creating template of ROOT snapshot of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smallrootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>59</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalltemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 8.Deploy a VM from the template created from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy a vm from template created from snapshot of ROOT disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>smalltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>smallsnpshtVM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 9.Create a Volume from the snapshot taken of the root disk of the Small VM -->	
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume from smaller disk snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smallrootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 10.Create a Volume from the snapshot taken of the data disk of the Small VM -->	
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume from smaller disk snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smalldatasnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 11.Attach the volume created from the snapshot taken of the root disk of the Small VM to the VM created from the template created from the snapshot taken of the root disk of the Small VM-->
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach small volume to the vm created from small snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- 12.Attach the volume created from the snapshot taken of the root disk of the Small VM to a different VM. -->
+	
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach small volume to a different VM</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+		</parameters>
+	</command>
+		
+	<command>
+		<name>listConfiguration</name>
+		<testcase>Getting value of the expunge.delay configuration parameter</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<value>expunge.delay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>value</name>
+				<param>expunge.delay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 13.Reboot,start,stop VM created from the template created from the snapshot taken of the root disk of the Small VM -->		
+<!-- Reboot small vm, start/stop medium vm -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>Reboot small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>stop medium vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>stop medium vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- 14.Delete a Snapshot taken of an attached Volume  -->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase>Deleting a snapshot taken of an attached Volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- 15.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+	
+<!-- 16.Create a Snapshot from the root disk of the VM immediately after destruction-->
+
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of root disk immediately after destroying VM.</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge delayed interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.delay</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another expunge delayed interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.delay</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- 17.Create a Snapshot from the destroyed root disk of the VM after expunge delay time duration -->
+
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of Destroyed root disk after expunge delay Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 18.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- 19. Execute the cleanup - Delete a user -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting a user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+		
+</snapshots>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/snapshots_contd.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/snapshots_contd.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/snapshots_contd.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/snapshots_contd.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,626 @@
+<!--
+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.
+-->
+<snapshots>
+
+<!-- 
+	  STEPS + TEST CASES COVERED:
+	1.Creating a Normal User
+	2.Register that User
+	3.Deploy a Smaller Disk Offering VM(Small VM)
+		a.List the Root Disk of the Small VM
+		b.List the Data Disk of the Small VM
+	4.Wait for some time for the management server to respond	
+	5.Create a Snapshot from the root disk of the Small VM
+	6.Create a Snapshot from the data disk of the Small VM
+	7.Create a Template from the snapshot taken of the root disk of the Small VM
+	8.Deploy a VM from the template created from the snapshot taken of the root disk of the Small VM
+	9.Create a Volume from the snapshot taken of the root disk of the Small VM
+	10.Create a Volume from the snapshot taken of the data disk of the Small VM
+	11.Create the snapshot of a detached Volume
+	12.Attach the volume created from the snapshot taken of the root disk of the Small VM to the VM created from the template created from the snapshot taken of the root disk of the Small VM
+	13.Attach the volume created from the snapshot taken of the root disk of the Small VM to a different VM.
+	14.Reboot,start,stop VM created from the template created from the snapshot taken of the root disk of the Small VM
+	15.Delete a Snapshot taken of an attached Volume
+	16.Delete a Snapshot taken of an detached Volume
+	17.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM 
+	18.Create a Snapshot from the root disk of the VM immediately after destruction 
+ 	19.Create a Snapshot from the destroyed root disk of the VM after expunge delay time duration
+ 	20.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM
+ 	21.Execute the cleanup - Delete a user 
+-->
+
+<!-- 1. Create a Normal User -->
+<command> 
+		<name>createUser</name>
+		<testcase>Create a user</testcase>
+		
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 2.Register that User -->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!-- 3.Deploy a Smaller Disk Offering VM(Small VM) -->	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying VM from small diskOffering</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- a.List the Root Disk of the Small VM -->
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+<!-- b.List the Data Disk of the Small VM -->	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>datadisk</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalldatavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 4.Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>200</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!-- 5.Create a Snapshot from the root disk of the Small VM -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of ROOT disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 6.Create a Snapshot from the data disk of the Small VM -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of Data disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smalldatavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalldatasnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 7.Create a Template from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>createTemplate</name>
+		<testcase>Creating template of ROOT snapshot of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smallrootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalltemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 8.Deploy a VM from the template created from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy a vm from template created from snapshot of ROOT disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>smalltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>smallsnpshtVM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 9.Create a Volume from the snapshot taken of the root disk of the Small VM -->	
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume from smaller disk snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smallrootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 10.Create a Volume from the snapshot taken of the data disk of the Small VM -->	
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume from smaller disk snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smalldatasnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 11.Create the snapshot of a detached Volume -->	
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of Detached Volume</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>detachsnapshotid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 12.Attach the volume created from the snapshot taken of the root disk of the Small VM to the VM created from the template created from the snapshot taken of the root disk of the Small VM-->
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach small volume to the vm created from small snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- 13.Attach the volume created from the snapshot taken of the root disk of the Small VM to a different VM. -->
+	
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach small volume to a different VM</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+		
+<!-- 14.Reboot,start,stop VM created from the template created from the snapshot taken of the root disk of the Small VM -->		
+<!-- Reboot small vm, start/stop medium vm -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>Reboot small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>stop medium vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>stop medium vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- 15.Delete a Snapshot taken of an attached Volume  -->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase>Deleting a snapshot taken of an attached Volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- 16.Delete a Snapshot taken of an detached Volume  -->
+	<command>
+		<name>deleteSnapshot</name>
+		<testcase>Deleting a snapshot taken of a detached Volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>detachsnapshotid</param>
+			</item>
+		</parameters>
+	</command>
+
+	
+<!-- 17.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+	
+<!-- 18.Create a Snapshot from the root disk of the VM immediately after destruction-->
+
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of root disk immediately after destroying VM.</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge delayed interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.delay</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another expunge delayed interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.delay</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- 19.Create a Snapshot from the destroyed root disk of the VM after expunge delay time duration -->
+
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of Destroyed root disk after expunge delay Failure Test Case</testcase>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 20.Destroy VM created from the template created from the snapshot taken of the root disk of the Small VM -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listConfiguration</name>
+		<testcase>Getting value of the expunge.delay configuration parameter</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<value>expunge.delay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>value</name>
+				<param>expunge.delay</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listConfiguration</name>
+		<testcase>Getting value of the expunge.delay configuration parameter</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<value>expunge.delay</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>value</name>
+				<param>expunge.delay</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+<!-- 21. Execute the cleanup - Delete a user -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting a user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+		
+</snapshots>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/snapshots.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/snapshots.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/snapshots.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/snapshots.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,827 @@
+<!--
+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.
+-->
+<snapshots>
+<!-- STEPS + TEST CASES COVERED:
+	1.Creating a Normal User
+	2.Register that User
+	3.Deploy a Smaller Disk Offering VM(Small VM)
+	4.Deploy a Medium Disk Offering VM (Medium VM)
+		a.List the Root Disk of the Small VM
+		b.List the Data Disk of the Small VM
+		c.List the Root Disk of the Medium VM
+		d.List the Data Disk of the Medium VM
+	5.Create a Snapshot from the root disk of the Small VM
+	6.Create a Snapshot from the data disk of the Small VM
+	7.Create a Snapshot from the root disk of the Medium VM 
+	8.Create a Snapshot from the data disk of the Medium VM
+	9.Create a Template from the snapshot taken of the root disk of the Small VM
+	10.Create a Template from the snapshot taken of the root disk of the Medium VM
+	11.Deploy a VM from the template created from the snapshot taken of the root disk of the Small VM
+	12.Deploy a VM from the template created from the snapshot taken of the root disk of the Medium VM
+	13.Create a Volume from the snapshot taken of the root disk of the Small VM
+	14.Create a Volume from the snapshot taken of the root disk of the Medium VM
+	15.Attach the volume created from the snapshot taken of the root disk of the Small VM to the VM created from the template created from the snapshot taken of the root disk of the Small VM
+	16.Attach the volume created from the snapshot taken of the root disk of the Medium VM to the VM created from the template created from the snapshot taken of the root disk of the Medium VM
+	17.Reboot,start,stop,destroy VM created from the template created from the snapshot taken of the root disk of the Small VM 
+ 	18.Reboot,start,stop,destroy VM created from the template created from the snapshot taken of the root disk of the Medium VM 
+	19.Clean Up 
+ -->
+<!-- 1. Create a Normal User -->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuserlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountvar</param>
+			</item>
+
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+<!-- 
+<command> 
+		<name>createUser</name>
+		<testcase>Create a user</testcase>
+		
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying vm from small diskOffering</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotsTest-VM-1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+		<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying vm from Medium disk offering</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>mediumglobaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotsTest-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largevmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>datadisk</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalldatavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>largevmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largerootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listVolumes</name>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>largevmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>datadisk</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largedatavolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>200</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!--  Create a snapshot from Root and DataDisk volumes of user vms (Small vm and Large vm) -->
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of ROOT disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smallrootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallrootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of Data disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>smalldatavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalldatasnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of ROOT disk of medium vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>largerootvolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largerootsnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createSnapshot</name>
+		<testcase>Creating snapshot of DATA disk of medium vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>largedatavolumeid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largedatasnapshot</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!--  Create templates from root snapshots and start vms from them -->
+	<command>
+		<name>createTemplate</name>
+		<testcase>Creating template of ROOT snapshot of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smallrootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smalltemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Creating template of ROOT snapshot of large vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>largerootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy a vm from template created from snapshot of ROOT disk of small vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>smalltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotsTest-VM-3</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy a vm from template created from snapshot of ROOT disk of medium vm</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>mediumglobaldiskofferinigid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>largetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountvar</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>SnapshotsTest-VM-4</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largevmid1</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!--  Create volumes from snapshots and attach them to the running vms -->
+<!-- Create Volumes From Snapshots of a Smaller and a Larger Disk -->
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume from smaller disk snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>smallrootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume from larger disk snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>snapshotid</name>
+				<param>largerootsnapshot</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>largevolumeid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach small volume to the vm created from small snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>attachVolume</name>
+		<testcase>Attach medium volume to the vm created from medium snapshot</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>largevolumeid</param>
+			</item>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>largevmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Reboot small vm, start/stop medium vm -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>Reboot small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>stop medium vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>largevmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>stop medium vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>largevmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!-- Destroy small and medium vms  -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy small vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>smallvmid1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy large vm</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>largevmid1</param>
+			</item>
+		</parameters>
+	</command>
+
+	
+<!--  Execute the cleanup - Delete a user -->
+
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Deleting a user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+
+<!-- 
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting a user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>	
+-->
+	
+	
+</snapshots>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/srxstresswithportfwd.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/srxstresswithportfwd.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/srxstresswithportfwd.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/srxstresswithportfwd.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,595 @@
+<!--
+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.
+-->
+<srxstresswithportfwd>
+
+	<command>
+		<name>createAccount</name>
+		<testcase>Creating account</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>srxstress@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>srxstress</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>srxstresslastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Create default network-->
+	<command>
+		<name>createNetwork</name>
+		<testcase>Creating default network</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>srxstressnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>srxstressnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>deploying virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+		
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>deploying virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname1</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress1</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+		
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>Associating first public ip address</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip1id</param>
+			</item> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>associateIpAddress</name>
+		<testcase>Associating second public ip address</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		<item getparam="true">
+			<name>account</name>
+			<param>accountname</param>
+		</item>
+		<item>
+			<name>domainid</name>
+			<value>1</value>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip2id</param>
+			</item> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>enableStaticNat</name>
+		<testcase>Enable Static NAT - 1</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item> 
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>		
+		</parameters>
+	</command>
+
+	<command>
+		<name>enableStaticNat</name>
+		<testcase>Enable Static NAT - 2</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip2id</param>
+		</item> 
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid1</param>
+		</item>		
+		</parameters>
+	</command>
+	
+	<!-- IP FORWARDING SECTION -->	
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 1</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 2</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>33</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>35</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 3</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>44</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>55</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule3</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleeping for 2 mins to ensure that vm comes up for ssh test</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>120</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+			<item>
+			    <name>u</name>
+				<value>http://yahoo.com</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteIpForwardingRule</name>
+		<testcase>Delete Ip forwarding rule - 1</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>id</name>
+				<param>ipfwdrule1</param>
+		</item>
+		</parameters>		
+	</command>
+		
+	<command>
+		<name>deleteIpForwardingRule</name>
+		<testcase>Delete Ip forwarding rule - 2</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>id</name>
+				<param>ipfwdrule2</param>
+		</item>
+		</parameters>		
+	</command>
+	
+	
+	<command>
+		<name>deleteIpForwardingRule</name>
+		<testcase>Delete Ip forwarding rule - 3</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>id</name>
+				<param>ipfwdrule3</param>
+		</item>
+		</parameters>		
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleeping for 1 min </testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 4</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip2id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 5</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip2id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>33</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>35</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<testcase>Creating Ip forwarding rule - 6</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip3id</param>
+		</item>
+		<item>
+			<name>startPort</name>
+			<value>44</value>
+		</item>
+		<item>
+			<name>endPort</name>
+			<value>55</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>TCP</value>
+		</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>ipfwdrule3</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>disableStaticNat</name>
+		<testcase>Disable Static NAT - 2</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip2id</param>
+		</item>	
+		</parameters>
+	</command>
+
+
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>Dissociating second public ip address</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip2id</param>
+			</item>
+		</parameters>
+	</command>	
+			
+	<command>
+		<name>disableStaticNat</name>
+		<testcase>Disable Static NAT - 1</testcase>
+		<parameters>
+		<item getparam="true">
+				<name>ipaddressid</name>
+				<param>nonsourcenatpublicip1id</param>
+		</item>	
+		</parameters>
+	</command>
+
+	<command>
+		<name>disassociateIpAddress</name>
+		<testcase>Dissociating first public ip address</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>nonsourcenatpublicip1id</param>
+			</item>
+		</parameters>
+	</command>
+		
+	<command>
+		<name>deleteAccount</name>
+		<testcase>Delete account</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+
+
+
+</srxstresswithportfwd>
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/static_nat.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/static_nat.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/static_nat.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/static_nat.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,916 @@
+<!--
+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.
+-->
+<staticnat>
+
+<command> 
+		<name>createUser</name>
+		<testcase>Create a regular user</testcase>	
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>apiuser</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>apiuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>registerUserKeys</name>
+		<testcase>Registering the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+		<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleeping for 60 seconds to ensure that vms boot up</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+	
+		<command>
+		<name>listRouters</name>
+		<testcase>35</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+			<item setparam="true">
+				<name>publicip</name>
+				<param>sourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	
+	<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!-- TRY TO CREATE STATIC NAT RULE FOR SOURCE NAT IP ADDRESS - NEGATIVE CASE-->
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<error>true</error>
+		<testcase>Test case 1134 - try to create static NAT for source nat ip - should fail</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>sourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- CREATE STATIC NAT RULE FOR SOURCE NAT IP ADDRESS -->
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>Test case 1135 - try to create static NAT for non source nat ip</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>ruleid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh test for the vm</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- CREATE STATIC NAT RULE FOR SOURCE NAT IP ADDRESS -->
+	<command>
+		<name>deleteIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>Test case 1136 - delete ip forwarding rule</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>id</name>
+			<param>ruleid</param>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listIpForwardingRules</name>
+		<usercommand>true</usercommand>
+		<testcase>list ip forwarding rules</testcase>
+		<empty>true</empty>
+		<parameters>
+		<item getparam="true">
+			<name>id</name>
+			<param>ruleid</param>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Ssh test for the vm - should fail</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- LIST STATIC NAT RULES -->
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>try to create static NAT for non source nat ip</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>ruleid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listIpForwardingRules</name>
+		<usercommand>true</usercommand>
+		<testcase>Test case 1137-1: list ip forwarding by ip address</testcase>
+		<empty>false</empty>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listIpForwardingRules</name>
+		<usercommand>true</usercommand>
+		<testcase>Test case 1137-2: list ip forwarding by id</testcase>
+		<empty>true</empty>
+		<parameters>
+		<item>
+			<name>id</name>
+			<value>1000000</value>
+		</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>listIpForwardingRules</name>
+		<usercommand>true</usercommand>
+		<testcase>Test case 1137-3: list ip forwarding by virtualmachineid</testcase>
+		<empty>true</empty>
+		<parameters>
+		<item>
+			<name>virtualmachineid</name>
+			<value>1000000</value>
+		</item>
+		</parameters>
+	</command>
+	
+	<!-- RELEASE IP ADDRESS WHEN IT HAS STATIC NAT RULES ASSIGNED AND VERIFY THAT THE RULES ARE REMOVED -->
+	<command>
+		<name>disassociateIpAddress</name>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listIpForwardingRules</name>
+		<usercommand>true</usercommand>
+		<testcase>Test case 1138: static NAT rules should be removed once corresponding ip address is dissassociated</testcase>
+		<empty>false</empty>
+	</command>
+
+	
+	<!-- TRY TO ENABLE STATIC NAT FOR THE SAME IP AND DIFFERENT VMS - SHOULD FAIL FOR THE SECOND ONE -->
+	<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>try to create static NAT for non source nat ip and vm1</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>ruleid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>1139 - try to assign static NAT for the same ip and different vms</testcase>
+		<error>true</error>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid1</param>
+		</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Destroy vm and verify that all corresponding rules got removed -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroying virtual machine...</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listConfigurations</name>
+		<testcase>Getting expunge interval value</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>expunge.interval</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>value</name>
+				<param>expunge.interval</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listIpForwardingRules</name>
+		<usercommand>true</usercommand>
+		<empty>true</empty>
+		<testcase>Test case 1140: static nat rules should be removed once corresponding vm is expunged</testcase>
+	</command>
+	
+
+	<!-- ENABLE STATIC NAT FOR THE SAME VM AND 2 DIFFERENT IPS-->
+		<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+		<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip2</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>try to create static NAT for non source nat1</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid1</param>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>try to create static NAT for non source nat ip2</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid1</param>
+		</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>TestCase 1141-2: ssh to ip1</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>TestCase 1141-2: ssh to ip2</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip2</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- REBOOT DOMR AND VERIFY THAT STATIC NAT RULE STILL WORKS -->
+	<command>
+		<name>rebootRouter</name>
+		<testcase>Rebooting router...</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>TestCase 1142: ssh to the public ip after domR was rebooted</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+
+
+<!-- STOP AND START DOMR AND VERIFY THAT STATIC NAT RULE STILL WORKS -->
+	<command>
+		<name>stopRouter</name>
+		<testcase>Stopping router...</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>		
+	
+	<command>
+		<name>startRouter</name>
+		<testcase>Starting router...</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>routerid</param>
+			</item>
+		</parameters>
+	</command>		
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>TestCase 1143: ssh to the public ip after domR was stopped and started</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip1</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!-- CREATE PORT FORWARDING RULE AND STATIC NAT RULE FOR THE SAME IP/VM; THEN DELETE STATIC NAT -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying virtual machine</testcase>
+		<usercommand>true</usercommand>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item>
+			    <name>diskofferingid</name>
+				<value>5</value>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>namefordisplay</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress1</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleeping for 60 seconds to ensure that vm boots up</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>associateIpAddress</name>
+		<usercommand>true</usercommand>
+		<parameters>
+		<item getparam="true">
+			<name>zoneid</name>
+			<param>globalzoneid</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>createPortForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>Create port forwarding rule for ports 22/22</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>privateip</name>
+			<param>vmipaddress</param>
+		</item>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item>
+			<name>privateport</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>publicport</name>
+			<value>22</value>
+		</item>
+		<item>
+			<name>protocol</name>
+			<value>tcp</value>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid</param>
+		</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh to the vm after Port forwarding rule was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>try to create static NAT for non source nat ip2</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>ipaddress</name>
+			<param>nonsourcenatpublicip</param>
+		</item>
+		<item getparam="true">
+			<name>virtualmachineid</name>
+			<param>vmid1</param>
+		</item>
+		</parameters>
+		<returnvalue> 
+			<item setparam="true">
+				<name>id</name>
+				<param>ruleid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh to the vm after static NAT rule was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteIpForwardingRule</name>
+		<usercommand>true</usercommand>
+		<testcase>delete ip forwarding rule</testcase>
+		<parameters>
+		<item getparam="true">
+			<name>id</name>
+			<param>ruleid</param>
+		</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ssh.sh</name>
+		<script>true</script>
+		<testcase>Ssh to the vm after static NAT rule was deleted</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>nonsourcenatpublicip</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>password</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!--  Delete user as a part of cleanup -->	
+	<command>
+		<name>deleteUser</name>
+		<testcase>Deleting the user</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>		
+
+
+</staticnat>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/templatedwnldstress.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/templatedwnldstress.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/templatedwnldstress.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/templatedwnldstress.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,757 @@
+<!--
+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.
+-->
+<templatedwnldstress>
+
+	<!-- 
+		STEPS/TEST CASES COVERED:
+		1. Create an Account and a User
+		2. Create a Network for that Account
+		3. Deploy a VM in the account
+			a. List the Root Volume
+		4. Stop the VM
+		5. Start the VM 
+		6. Reboot the VM
+		7. Destroy VM
+		8. Verify that vm is destroyed
+		9. Delete Account		
+	 -->
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<!-- Create default network-->
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>defaultregressionnetwork</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy a Virtual Machine under the Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+		
+	<command>
+		<name>listVolumes</name>
+		<testcase>	[List the ROOT Volume of the VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>virtualmachineid</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>type</name>
+				<value>ROOT</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>rootvolumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>	[Stop virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createTemplate</name>
+		<testcase>	[Create template from root volume]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>rootvolumeid</param>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+		
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploying virtual machine from the Private Template]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMcreatedfrmTemplate</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>vm_hostid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host where vm is running</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vm_hostid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select install_path from template_spool_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting private template vdi from the db</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_uuid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for template on the xen host before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>template_uuid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine created from the private template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>	
+		
+	<!-- SLEEP TIME BEGINS-->	
+	<command>
+		<name>listConfigurations</name>
+		<testcase>Getting expunge interval value</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>expunge.interval</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>value</name>
+				<param>expunge.interval</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>updateConfiguration</name>
+		<testcase>Updating storage.cleanup.interval</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>storage.cleanup.interval</value>
+			</item>
+			<item>
+				<name>value</name>
+				<value>60</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listConfigurations</name>
+		<testcase>Getting expunge interval value</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>storage.cleanup.interval</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>value</name>
+				<param>storage.cleanup.interval</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for Storage CleanUp interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>storage.cleanup.interval</param>
+			</item>
+		</parameters>
+	</command>	
+		
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another Storage CleanUp interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>storage.cleanup.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- SLEEP TIME ENDS-->
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for template on the xen host after vm using template is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>template_uuid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Second VM -->
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploying virtual machine from the private template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMcreatedfrmTemplate</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>vm_hostid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listHosts</name>
+		<testcase>List host where vm is running</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vm_hostid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select install_path from template_spool_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting private template vdi from the db</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_uuid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>listvdi.sh</name>
+		<script>true</script>
+		<testcase>List VDI for template on the xen host before vm is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>template_uuid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine created from the private template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid1</param>
+			</item>
+		</parameters>
+	</command>	
+		
+	<!-- SLEEP TIME BEGINS-->	
+	<command>
+		<name>listConfigurations</name>
+		<testcase>Getting expunge interval value</testcase>
+		<parameters>
+			<item>
+				<name>name</name>
+				<value>expunge.interval</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>value</name>
+				<param>expunge.interval</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another expunge interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>expunge.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for Storage CleanUp interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>storage.cleanup.interval</param>
+			</item>
+		</parameters>
+	</command>	
+		
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for another Storage CleanUp interval</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>s</name>
+				<param>storage.cleanup.interval</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- SLEEP TIME ENDS-->
+	
+	<command>
+		<name>listvdi.sh</name>
+		<error>true</error>
+		<script>true</script>
+		<testcase>List VDI for template on the xen host after vm using template is destroyed</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>vmhost_ipaddress</param>
+			</item>
+			<item getparam="true">
+			    <name>u</name>
+				<param>template_uuid</param>
+			</item>
+		</parameters>
+	</command>
+
+	<!-- Clean Up Section -->
+		
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>	[Start virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>	[Reboot Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>	[Destroy virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>	[Verify that vm was destroyed]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Destroyed</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deleteTemplate</name>
+		<testcase>Delete private template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteAccount</name>
+		<testcase>	[Delete account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+</templatedwnldstress>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/templates_sync.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/templates_sync.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/templates_sync.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/templates_sync.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1389 @@
+<!--
+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.
+-->
+<templatesync>
+
+<!-- MAKE SURE THAT THE OSTYPE OF TEMPLATES ARE CHANGED IN CASE OF USING TEMPLATE OTHER THAN THE DEFAULT CENTOS 5.3 64bit TEMPLATE -->
+<!--  Make some preparations - create a couple of private templates -->
+	<!-- 
+	<command>
+		<name>createVolume</name>
+		<testcase>Create a volume</testcase>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item random="true">
+				<name>name</name>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	-->
+		
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy a VM </testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>TempSyncVM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select id from volumes</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume id for the VM created</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>instance_id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>id</name>
+				<param>volumeid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>Stop the Virtual Machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!--  Create template, delete it and restart management server -->	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>select install_path from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting install_path from the template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_path</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<testcase>List template directory after it was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>removetemplate.sh</name>
+		<script>true</script>
+		<testcase>Removing template file from secondary storage</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 4 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Checking download state of the template in the DB after the template was deleted on secondary storage and management server process was restarted</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOAD_ERROR</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+<!--  Create template, corrupt it by removing lines from templates.properties file and restart management server -->	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>select install_path from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting install_path from the template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_path</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<testcase>List template directory after it was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>corrupttemplate.sh</name>
+		<script>true</script>
+		<testcase>Corrupting template file on secondary storage</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+				<name>i</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>a</name>
+				<value>2</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 4 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Checking download state of the template in the DB after the template was deleted on secondary storage and management server process was restarted</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOAD_ERROR</value>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Verify that template got removed from the secondary storage by template sync</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+		
+		
+<!--  Create a template directory on the secondary storage, reboot management server and make sure that template directory got cleanedup -->
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>select install_path from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting install_path from the template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_path</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<testcase>List template directory after it was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>createfaketemplate.sh</name>
+		<script>true</script>
+		<testcase>Corrupting template file on secondary storage</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+				<name>i</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>a</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>dir</name>
+				<value>300556</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 4 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<error>true</error>
+		<testcase>Verify that template got removed from the secondary storage by template sync</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item>
+			    <name>p</name>
+				<value>/template/tmpl/1/300556/template.properties</value>
+			</item>
+		</parameters>
+	</command>	
+
+		
+<!--  Create template, delete it and stop/start management server -->	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>select install_path from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting install_path from the template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_path</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<testcase>List template directory after it was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>removetemplate.sh</name>
+		<script>true</script>
+		<testcase>Removing template file from secondary storage</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Stopping management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>stop</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Stopping management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>stop</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Starting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>start</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Starting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>start</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 4 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Checking download state of the template in the DB after the template was deleted on secondary storage and management server process was restarted</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOAD_ERROR</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	
+<!--  Create template, don't delete it and restart management server. Make sure that the template is still available, and you can stat a vm from it -->	
+	<command>
+		<name>createTemplate</name>
+		<testcase>Create template</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>volumeid</name>
+				<param>volumeid</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>privatetemplatename</param>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>newtext</value>
+			</item>
+			<item>
+				<name>osTypeId</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>select install_path from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting install_path from the template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_path</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<testcase>List template directory after it was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Restarting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>restart</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 4 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>240</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Checking download state of the template in the DB after the template was deleted on secondary storage and management server process was restarted</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>Deploy vm from private template after management server was rebooted</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>privatetemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>PrivateTempSyncVM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group2</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>			
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+<!--  Register template, delete it from the secondary storage and restart management server. Make sure that template download started again -->
+	<command>
+		<name>registerTemplate</name>
+		<testcase>Register template</testcase>
+		<parameters>
+			<item random="true" setparam="true">
+				<name>name</name>
+				<param>registername</param>
+			</item>
+			<item random="true" setparam="true">
+				<name>displaytext</name>
+				<param>registerdisplay</param>
+			</item>
+			<item getparam="true">
+				<name>url</name>
+				<param>globaltemplateurl</param>
+			</item>
+			<item>
+				<name>ostypeid</name>
+				<value>12</value>
+			</item>
+			<item>
+				<name>format</name>
+				<value>vhd</value>
+			</item>
+			<item getparam="true">
+				<name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</returnvalue>
+	</command>		
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 5 min</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting volume path for the vm DATADISK volume</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOADED</value>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>select install_path from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Getting install_path from the template</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>install_path</name>
+				<param>template_path</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	
+	<command>
+		<name>listtemplate.sh</name>
+		<script>true</script>
+		<testcase>List template directory after it was created</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>removetemplate.sh</name>
+		<script>true</script>
+		<testcase>Removing template file from secondary storage</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>secondary_storage_ip</param>
+			</item>
+			<item getparam="true">
+			    <name>s</name>
+				<param>secondary_storage_dir</param>
+			</item>
+			<item getparam="true">
+			    <name>p</name>
+				<param>template_path</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Stopping management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>stop</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Stopping management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>stop</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Starting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms1</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>start</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>ms.sh</name>
+		<script>true</script>
+		<testcase>Starting management server</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>h</name>
+				<param>ms2</param>
+			</item>
+			<item>
+			    <name>o</name>
+				<value>start</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for 15 seconds</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>15</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>select download_state from template_host_ref</name>
+		<mysql>true</mysql>
+		<testcase>Checking download state of the template in the DB after the template was deleted on secondary storage and management server process was restarted</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>template_id</name>
+				<param>privatetemplateid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+			    <name>download_state</name>
+				<value>DOWNLOAD_IN_PROGRESS</value>
+			</item>
+		</returnvalue>
+	</command>
+				
+
+<!--  Execute a cleanup -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy virtual machine as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+</templatesync>
+
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/userapi.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/userapi.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/userapi.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/userapi.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1293 @@
+<!--
+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.
+-->
+<userapi>
+
+<!-- Test case #   - Create the Account and a User -->
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  5 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>						
+		</returnvalue>
+	</command>
+		
+	<!-- Test case # 3 - Create a User -->
+	<command>
+		<name>createUser</name>
+		<testcase>    [Create the Same User Again Should Fail]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>		
+		</parameters>
+	</command>
+	
+	
+<!-- Test case #53- try to 2 users with the same name and no account specified - Negative test-->
+<!-- 	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>user123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernamevar</param>
+			</item>
+		</returnvalue>
+	</command>
+
+	<command>
+		<name>createUser</name>
+		<testcase>53</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>username</name>
+			    <param>usernamevar</param>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>user123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+	</command>
+-->	
+
+<!-- Test case #54- create 2 users with the same name and different accounts specified in the same domain - should fail - Negative case-->
+
+	<command>
+		<name>createAccount</name>
+		<testcase> 54 [Create a Different Account with an Existing User's Name]</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+				<name>account</name>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>		
+	</command>
+
+<!-- 	<command>
+		<name>createUser</name>
+		<testcase>54</testcase>
+		<error>true</error>
+		<parameters>
+			<item param="true">
+			    <name>username</name>
+				<param>usernamevar</param>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>user123</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>usernewaccount</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+	</command>
+-->	
+<!-- Test case #593- try update user with the userName that already exists in the system - Negative test-->
+<command>
+		<name>createUser</name>
+		<testcase>593 [Create a Different User in the Same Account]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item random="true">
+				<name>username</name>				
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>		
+		</parameters>
+	</command>
+	<returnvalue>
+			<item setparam="true">
+			    <name>id</name>
+				<param>seconduserid</param>
+			</item>
+	</returnvalue>
+		
+	<command>
+		<name>updateUser</name>
+		<testcase>593</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>seconduserid</param>
+			</item>
+			<item getparam="true">
+			    <name>username</name>
+				<param>usernameparam</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!-- Test case #56 - try to delete non-existing user - Negative case  -->
+	<command>
+		<name>deleteUser</name>
+		<testcase>56</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>100000000</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #58 - try to delete the same user twice - should fail to do it second time - Negative case  -->
+	<command>
+		<name>deleteUser</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteUser</name>
+		<testcase>58</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #59 - try to get a remove user - Negative case  -->	
+	<command>
+		<name>listUsers</name>
+		<testcase>59</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #60 - try to get non-existing user - Negative case  -->
+	<command>
+		<name>listUsers</name>
+		<testcase>60</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>10000000</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #62 - try to update removed user - Negative case  -->
+	<command>
+		<name>updateUser</name>
+		<testcase>62</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+			<item random="true">
+				<name>username</name>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #63 - try to update non-existing user - Negative case  -->
+	<command>
+		<name>updateUser</name>
+		<testcase>63</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+			    <name>id</name>
+				<value>2000000000</value>
+			</item>
+			<item random="true">
+				<name>username</name>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #45- try to create user and assign it to non-existing domain - Negative test-->
+	<command>
+		<name>createUser</name>
+		<testcase>45</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>john12345</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1000000</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<!-- Test case #46- create user and specify account in the request - Positive -->
+	<command>
+		<name>createUser</name>
+		<testcase>46</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>john12345</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<!-- Test case #47- try to create user without specifying required parameters in the request - negative case  -->
+	<command>
+		<name>createUser</name>
+		<testcase>47</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+	<command>
+		<name>createUser</name>
+		<testcase>47</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>1234567</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createUser</name>
+		<testcase>47</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>1234567</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createUser</name>
+		<testcase>47</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>1234567</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case #51 and #52. 51 - try to create user and assign it to existing account with non-existing domain; #52 - create a user and assign it to the existing account with the correct domain -->
+	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>name</name>
+				<param>domainname</param>
+			</item>
+			<item setparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+		<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User in the New Domain]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>2</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>newdomainid</param>
+			</item>
+			<item>
+				<name>email</name>
+				<value>nimbus-user@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>nimbus-user</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>nimbus-userlastname</value>
+			</item>
+			<item random="true" setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname1</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>  52 [List the Created User in (3)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+		</parameters>		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item getparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>						
+		</returnvalue>
+	</command>
+
+<!--  
+	<command>
+		<name>createUser</name>
+		<testcase>52</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>alena</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>alenaslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>alena@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>			
+		</parameters>		
+	</command>
+-->	
+<!-- 	
+	<command>
+		<name>createUser</name>
+		<testcase>52</testcase>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>alena</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>alenaslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>alena@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>id</name>
+				<param>newdomainid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>alenasaccount</param>
+			</item>
+		</parameters>
+	</command>
+-->	
+	<command>
+		<name>createUser</name>
+		<testcase>51</testcase>
+		<error>true</error>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>password</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>alena</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>alenaslastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>alena@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>300000000</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case #55 - create 2 users with the same name in different domains - Positive case  -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>jane</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jane</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jane</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jane@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>newdomainid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>jane</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>jane</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>jane</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>jane@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname1</param>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>newdomainid</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- Test case #64 - try to create 2 domains with the same name - Negative case  -->	
+	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>domaindomainid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>domaindomainname</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createDomain</name>
+		<testcase>64</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>domaindomainname</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!-- Test case #65 - try to list removed domain - Negative case  -->	
+	<command>
+		<name>deleteDomain</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>domaindomainid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listDomains</name>
+		<testcase>65</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item getparam="true">
+			    <name>name</name>
+				<param>domaindomainname</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case #66 - try to remove domain while it has users assigned to it - Negative case  -->
+<!-- 	<command>
+		<name>createDomain</name>
+		<parameters>
+			<item random="true">
+			    <name>name</name>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>testcase66domainid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>user66</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>user66</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>user66</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>user66@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>testcase66domainid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+	</command>
+-->	
+	<command>
+		<name>deleteDomain</name>
+		<testcase>66</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>domainid</name>
+				<param>newdomainid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>
+	
+<!-- Test case #140 - verify that root domain exists in the system  -->
+	<command>
+		<name>listDomains</name>
+		<testcase>140</testcase>
+		<parameters>
+			<item>
+			    <name>name</name>
+				<value>root</value>
+			</item>
+		</parameters>
+		<returnvalue>
+		</returnvalue>
+	</command>	
+	
+<!-- Test case #601 - verify that you can see events of removed user  -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>testcase601</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>admin@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid601</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>username601</param>
+			</item>
+			<item setparam="true">
+				<name>account</name>
+				<param>account601</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>account601</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>DomainTest-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>deleteUser</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid601</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listEvents</name>
+		<testcase>601</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>account601</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!-- Test case #75 - verify regular user can't see VMs of an admin user  -->
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>baduser</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>configuser</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>adminlastname</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>configuser@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>baduserid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>badusername</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>registerUserKeys</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>baduserid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>apikey</name>
+				<param>apikey</param>
+			</item>
+			<item setparam="true">
+				<name>secretkey</name>
+				<param>secretkey</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<usercommand>true</usercommand>
+		<testcase>75</testcase>
+		<empty>true</empty>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!--  Execute a cleanup - delete all domains -->
+	<command>
+		<name>deleteDomain</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>newdomainid</param>
+			</item>
+			<item>
+			    <name>cleanup</name>
+			    <value>true</value>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- 	<command>
+		<name>deleteDomain</name>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+			    <param>testcase66domainid</param>
+			</item>
+			<item>
+			    <name>cleanup</name>
+			    <value>true</value>
+			</item>
+		</parameters>
+	</command>
+-->	
+	<command>
+		<name>deleteAccount</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid</param>				
+			</item>
+		</parameters>
+	</command>	
+	
+	<command>
+		<name>deleteAccount</name>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>accountid1</param>				
+			</item>
+		</parameters>
+	</command>
+	
+</userapi>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/vmapi.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/vmapi.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/vmapi.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/vmapi.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,891 @@
+<!--
+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.
+-->
+<vmapi>	
+
+<!-- 
+		KEEP IN MIND: EXPUNGE INTERVAL, PASSWORD ENABLED TEMPLATE
+	
+		STEPS/TEST CASES COVERED:
+		1. Deploy a Virtual Machine in admin account
+		2. Destroy the Virtual Machine
+		3. List the Destroyed Virtual Machine
+		4. Check that the Destroyed VM cannot be started
+		5. Check that a non-existing VM cannot be listed (Id doesnt exist)
+		6. Create the Account and a User for the account (List VM for a Removed User exercise BEGIN)
+		7. List the Created User
+		8. Creating default network
+		9. Deploy Virtual Machine in the New Account
+		10. Delete User
+		11. Delete Account
+		12. Check that no VMs present under the Account(List VM for a Removed User exercise END)
+		13. updateVirtualMachine api: should deny to update Destroyed vms
+		14. Verify that one can't enable HA for non-existing vm
+		15. Recover the Destroyed VM
+		16. Verify that one can reset password for VM in stopped state
+		17. Verify that one can enable HA for VM in stopped state
+		18. Start Virtual Machine (reset password for VM in running state exercise BEGIN)
+		19. Verify that one can reset password for VM in running state
+		20. Verify that one can disable HA for VM in running state
+		21. Destroy Virtual Machine (reset password on a destroyed VM exercise BEGIN)
+		22. Verify that one can't reset password for VM in destroyed state
+		23. Verify that one can't reboot destroyed VM
+		24. Deploy Virtual Machine to test reset password negative case
+		25. Check whether password can be reset on virtual machine made from password disabled VM
+		26. Try to change service offering for VM in running state
+		27. Stop the Virtual machine to change its Service Offering
+		28. Try to change service offering to the one that VM already has -ve case
+		29. Try to reboot stopped virtual machine - Negative case
+		30. Try to recover stopped virtual machine
+		31. Start the Virtual Machine
+		32. Try to recover running virtual machine
+		33. Try to deploy vm and assign it to non-existing account -ve case
+		34. Try to deploy vm and assign it to removed account -ve case
+		35. Try to send destroy command for non-existing vm -ve case
+		36. Try to send reboot command for non-existing vm -ve case
+		37. Try to send start command for non-existing vm -ve case
+		38. Destroy Virtual Machine as part of Clean up
+		
+	 -->
+
+
+<!-- Test case #72 - verify that listVm command doesn't display VM in expunging state but displays a VM in destroyed state -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy Virtual Machine in Admin Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMapis-VM</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>	[Destroy Virtual Machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>72  [List the Destroyed Virutal Machine]</testcase>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #92 - verify that you can't start destroyed virtual machine -->
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>92  [Check that the Destroyed VM cannot be started]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #73 - verify that listVm returns nothing when id of non-existing VM is specified -->
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>73  [Check that a non-existing VM cannot be listed (Id doesnt exist)]</testcase>
+		<parameters>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>id</name>
+				<value>100000000</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #74 - verify that listVm returns empty response when account=removedAccount is specified -->	
+
+	<command>
+		<name>createAccount</name>
+		<testcase>    [Create the Account and a User for the account (List VM for a Removed User exercise BEGIN)]</testcase>
+		<parameters>
+			<item setparam="true" random="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>testcase74@gmail.com</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>testcase74</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>testcase74lastname</value>
+			</item>
+			<item random="true">
+				<name>username</name>
+			</item>
+			<item>
+				<name>password</name>
+				<value>password</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>accountid</param>
+			</item>
+			<item getparam="true">
+				<name>name</name>
+				<param>accountname</param>
+			</item>			
+		</returnvalue>
+	</command>
+
+	<!-- Test case #5 - listUsers command -->
+	<command>
+		<name>listUsers</name>
+		<testcase>    [List the Created User]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+		</parameters>
+		
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+			<item setparam="true">
+				<name>username</name>
+				<param>usernameparam</param>
+			</item>
+		</returnvalue>
+	</command>
+
+
+<!-- 
+	<command>
+		<name>createUser</name>
+		<parameters>
+			<item random="true">
+			    <name>username</name>
+			</item>
+			<item>
+			    <name>password</name>
+				<value>testcase74</value>
+			</item>
+			<item>
+				<name>firstname</name>
+				<value>testcase74</value>
+			</item>
+			<item>
+				<name>lastname</name>
+				<value>testcase74</value>
+			</item>
+			<item>
+				<name>email</name>
+				<value>testcase74@gmail.com</value>
+			</item>
+			<item>
+				<name>accounttype</name>
+				<value>0</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item verify="false" setparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item verify="false" setparam="true">
+				<name>id</name>
+				<param>userid</param>
+			</item>
+		</returnvalue>
+	</command>
+-->	
+
+	<command>
+		<name>createNetwork</name>
+		<testcase>	[Creating default network for the account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>networkOfferingId</name>
+				<param>globalnetworkofferingid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>name</name>
+				<value>vmapi_network</value>
+			</item>
+			<item>
+				<name>displaytext</name>
+				<value>vmapi_network</value>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>networkid</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>	[Deploy Virtual Machine in the new Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMapis-VM-2</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid2</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>vmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>deleteUser</name>
+		<testcase>    [Delete User]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>userid</param>
+			</item>
+		</parameters>
+	</command>	
+
+	<command>
+		<name>deleteAccount</name>
+		<testcase>    [Delete Account]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>accountid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+		<command>
+		<name>listVirtualMachines</name>
+		<testcase>74  [Check that no VMs present under the Account(List VM for a Removed User exercise END)]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #77 - verify that you can't enable HA for VM in destroyed state -->
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase>77 - Bug 3237 [updateVirtualMachine api: should deny to update Destroyed vms]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	<!-- Test case #592 - verify that you can't enable HA for non-existing vm -->
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase>592 [Verify that you can't enable HA for non-existing vm]</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>1000000</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>	
+	
+
+<!-- Test case #79 - verify that you can reset password for VM in stopped state -->	
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>    [Recover the Destroyed VM]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>79-1 [Verify that one can reset password for VM in stopped state]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- Test case #76 - verify that you can enable HA for VM in stopped state -->	
+
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase>76  [Verify that one can enable HA for VM in stopped state]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+	</command>	
+
+
+<!-- Test case #79 - verify that you can reset password for VM in running state -->	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>    [Start Virtual Machine (reset password for VM in running state exercise BEGIN)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>79-2 [Verify that one can reset password for VM in running state]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+
+<!-- Test case #76 - verify that you can disable HA for VM in running state -->
+	<command>
+		<name>updateVirtualMachine</name>
+		<testcase>76  [Verify that one can disable HA for VM in running state]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>
+		</parameters>
+	</command>	
+	
+	
+<!-- Test case #80 - verify that you can't reset password for VM in destroyed state -->
+		<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>    [Destroy Virtual Machine (reset password on a destroyed VM exercise BEGIN)]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>80  [Verify that one can't reset password for VM in destroyed state]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #89 - verify that you can't reboot destroyed VM -->	
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>89  [Verify that one can't reboot destroyed VM]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid</param>
+			</item>
+		</parameters>
+	</command>
+
+	
+<!-- Test case #81 - resetpassword for virtual machine which was made of template with password disabled - Negative case -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>    [Deploy Virtual Machine to test reset password negative case]</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMapis-VM-3</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>windowsvmname</param>
+			</item>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>windowsvmipaddress</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+	<command>
+		<name>resetPasswordForVirtualMachine</name>
+		<testcase>81  [Check whether password can be reset on virtual machine made from password disabled VM]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #82 - try to change service offering for VM in running state - should fail - Negative case -->
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase>82 [Try to change service offering for VM in running state]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<param>mediumglobalserviceofferingid</param>
+			</item>
+		</parameters>
+	</command>
+
+<!-- Test case #83 - try to change service offering to the one that VM already has - should fail - Negative case -->
+	<command>
+		<name>stopVirtualMachine</name>
+		<testcase>    [Stop the Virtual machine to change its Service Offering]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>changeServiceForVirtualMachine</name>
+		<testcase>83  [Try to change service offering to the one that VM already has -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+			<item getparam="true">
+				<name>serviceofferingid</name>
+				<value>globalserviceofferingid</value>
+			</item>
+		</parameters>
+	</command>
+	
+	
+<!-- Test case #90 - try to reboot stopped vitrual machine - should fail - Negative case -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>90  [Try to reboot stopped vitrual machine - Negative case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+		
+
+<!-- Test case #95 - try to recover stopped/running virtual machine - should fail -->
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>813 [Try to recover stopped virtual machine]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>    [Start virtual machine]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	<command>
+		<name>recoverVirtualMachine</name>
+		<testcase>813 [Try to recover running virtual machine]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+
+
+<!-- Test case #84 - try to deploy vm and assign it to non-existing account - should fail - Negative case -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>84  [Try to deploy vm and assign it to non-existing account -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>		
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item>
+				<name>account</name>
+				<value>blahblah-invaliduser</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMapis-VM-4</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- Test case #85 - try to deploy vm and assign it to removed account - should fail - Negative case -->
+	<command>
+		<name>deployVirtualMachine</name>
+		<testcase>85  [Try to deploy vm and assign it to removed account -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+				<name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+				<name>account</name>
+				<param>accountname</param>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>VMapis-VM-5</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>networkid</param>
+			</item>
+		</parameters>
+	</command>	
+	
+<!-- Test case #87 - try to send destroy command for non-existing vm - should fail - Negative case -->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>87  [Try to send destroy command for non-existing vm -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>100000</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #88 - try to send reboot command for non-existing vm - should fail - Negative case -->
+	<command>
+		<name>rebootVirtualMachine</name>
+		<testcase>88  [Try to send reboot command for non-existing vm -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>100000</value>
+			</item>
+		</parameters>
+	</command>
+	
+<!-- Test case #91 - try to send start command for non-existing vm - should fail - Negative case -->
+	<command>
+		<name>startVirtualMachine</name>
+		<testcase>88  [Try to send start command for non-existing vm -ve case]</testcase>
+		<error>true</error>
+		<parameters>
+			<item>
+				<name>id</name>
+				<value>100000</value>
+			</item>
+		</parameters>
+	</command>
+
+<!-- Execute cleanup - destroy the VM-->
+	<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>    [Destroy Virtual Machine as part of Clean up]</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>windowsvmid</param>
+			</item>
+		</parameters>
+	</command>
+	
+	
+</vmapi>		
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/vmsync.xml ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/vmsync.xml
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/metadata/func/vmsync.xml	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/metadata/func/vmsync.xml	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,407 @@
+<!--
+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.
+-->
+<vmsynctest>
+
+<!-- 1. Deploy two VMs, One HA enabled, One HA disabled -->
+<!-- 1.1 Deploy HA enabled VM -->
+<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy HA enabled VM test case</testcase>
+            
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item>
+				<name>displayname</name>
+				<value>HAenabledVM</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid_en</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname_en</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_en</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 1.2 Deploy the HA disabled VM -->
+<command>
+		    <name>deployVirtualMachine</name>  <!--deploy vm 1-->
+            <testcase>deploy HA disabled VM test case</testcase>
+            
+         <parameters>
+			<item getparam="true">
+			    <name>diskofferingid</name>
+				<param>globaldiskofferingid</param>
+			</item>	
+			<item getparam="true">
+			    <name>serviceofferingid</name>
+				<param>globalserviceofferingid</param>
+			</item>
+			<item getparam="true">
+			    <name>templateid</name>
+				<param>globaltemplateid</param>
+			</item>
+			<item getparam="true">
+			    <name>zoneid</name>
+				<param>globalzoneid</param>
+			</item>	
+			<item>
+				<name>displayname</name>
+				<value>HAdisabledVM</value>
+			</item>
+			<item>
+				<name>account</name>
+				<value>admin</value>
+			</item>
+			<item>
+				<name>domainid</name>
+				<value>1</value>
+			</item>
+			<item>
+				<name>group</name>
+				<value>group1</value>
+			</item>
+			<item getparam="true">
+				<name>networkids</name>
+				<param>globalnetworkid</param>
+			</item>	
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>id</name>
+				<param>vmid_db</param>
+			</item>
+			<item setparam="true">
+				<name>name</name>
+				<param>vmname_db</param>
+			</item>
+			<item setparam="true">
+				<name>hostid</name>
+				<param>hostid_db</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 2. Enable and disable HA on the VMs respectively -->
+<!-- 2.1 Enable HA -->
+<command>
+		<name>updateVirtualMachine</name>
+		<testcase>HA enable virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_en</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>HAenabledVirtualMachine</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>true</value>
+			</item>
+		</parameters>
+</command>
+
+<!-- 2.2 Disable HA -->
+<command>
+		<name>updateVirtualMachine</name>
+		<testcase>HA disable virtual machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_db</param>
+			</item>
+			<item>
+				<name>displayname</name>
+				<value>HAdisabledVirtualMachine</value>
+			</item>
+			<item>
+				<name>haenable</name>
+				<value>false</value>
+			</item>			
+		</parameters>
+</command>
+
+<!--  3. Obtain the Host IP addresses for the Hosts accommodating the VMs -->
+<!-- 3.1 Obtains the Host IP address of the HA enabled VM's Host machine -->
+<command>
+		<name>listHosts</name>
+		<testcase>Obtain IP address of ha disabled VM's Host Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_db</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_db</param>
+			</item>
+		</returnvalue>
+	</command>
+	
+<!-- 3.2 Obtains the Host IP address of the HA disabled VM's Host machine -->
+
+<command>
+		<name>listHosts</name>
+		<testcase>Obtain IP address of ha enabled VM's Host Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_en</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_en</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 4. Get VM instance name of the VMs from the db -->
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Obtaining the internal instance name for the ha disabled VM Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_db</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name_db</param>
+			</item>
+		</returnvalue>
+	</command>	
+	
+	<command>
+		<name>select instance_name from vm_instance</name>
+		<mysql>true</mysql>
+		<testcase>Obtaining the internal instance name for the ha enabled VM Test Case</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_en</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+			    <name>instance_name</name>
+				<param>instance_name_en</param>
+			</item>
+		</returnvalue>
+	</command>	
+
+<!-- 5. Kill the two VMs -->
+
+<command>
+	<name>killvm.sh</name>
+	<testcase>Kill the HA enabled VM</testcase>
+	<script>true</script>
+	
+	<parameters>
+		<item getparam="true">
+			<name>n</name>
+			<param>instance_name_en</param>
+		</item>
+		
+		<item getparam="true">
+			<name>h</name>
+			<param>ipaddress_en</param>
+		</item>
+	</parameters>
+</command>
+
+
+<command>
+	<name>killvm.sh</name>
+	<testcase>Kill the HA disabled VM</testcase>
+	<script>true</script>
+	
+	<parameters>
+		<item getparam="true">
+			<name>n</name>
+			<param>instance_name_db</param>
+		</item>
+		
+		<item getparam="true">
+			<name>h</name>
+			<param>ipaddress_db</param>
+		</item>
+	</parameters>
+</command>
+
+<!--6. Wait for some time for the management server to respond -->
+	<command>
+		<name>sleep.sh</name>
+		<script>true</script>
+		<testcase>Sleep for some time</testcase>
+		<parameters>
+			<item>
+			    <name>s</name>
+				<value>300</value>
+			</item>
+		</parameters>
+	</command>	
+
+<!--  Check that States of the vms at the database and at the agents - verify both api and backend  -->
+<!-- 7. Check the Management Server Database for the states of the killed VMs -->
+
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>List virtual machine with ha disabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_db</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Stopped</value>
+			</item>			
+		</returnvalue>
+	</command>		
+	
+	<command>
+		<name>listVirtualMachines</name>
+		<testcase>List virtual machine with ha enabled</testcase>
+		<parameters>
+			<item getparam="true">
+			    <name>id</name>
+				<param>vmid_en</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item>
+				<name>state</name>
+				<value>Running</value>
+			</item>
+			<item setparam="true">			<!-- HA enabled VM may be restarted on any hosts -->
+				<name>hostid</name>
+				<param>hostid_en</param>
+			</item>
+		</returnvalue>
+	</command>
+
+<!-- 9. Find the host IP address of the ha enabled VM -->
+<command>
+		<name>listHosts</name>
+		<testcase>List host with ha enabled machine</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>hostid_en</param>
+			</item>
+		</parameters>
+		<returnvalue>
+			<item setparam="true">
+				<name>ipaddress</name>
+				<param>ipaddress_en</param>
+			</item>
+		</returnvalue>
+</command>
+
+<!-- 10. Verify whether the HA enabled VM is actually running on the host -->
+<command>
+		<name>listvm.sh</name>
+		<script>true</script>
+		<testcase>List ha enabled machine</testcase>
+		<parameters>
+		<item getparam="true">
+			    <name>h</name>
+				<param>ipaddress_en</param>
+			</item>
+			<item getparam="true">
+			    <name>n</name>
+				<param>instance_name_en</param>
+			</item>
+		</parameters>
+</command>
+
+<!--  Cleanup section -->
+<!-- 11. Destroy VMs-->
+<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy ha disabled vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_db</param>
+			</item>
+		</parameters>
+</command>
+	
+<command>
+		<name>destroyVirtualMachine</name>
+		<testcase>Destroy ha enabled vm as a part of cleanup</testcase>
+		<parameters>
+			<item getparam="true">
+				<name>id</name>
+				<param>vmid_en</param>
+			</item>
+		</parameters>
+</command>
+</vmsynctest>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/.project ./vogxn-asf-marvin-updates-f66caa0/test/.project
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/.project	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/.project	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,37 @@
+<?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.
+-->
+<projectDescription>
+	<name>test</name>
+	<comment></comment>
+	<projects>
+		<project>thirdparty</project>
+		<project>utils</project>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/bootstrap-regression.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/bootstrap-regression.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/bootstrap-regression.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/bootstrap-regression.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,37 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+
+set -e
+set -x
+
+
+mypwd=`dirname $0`
+cd "$mypwd"/regression  # now my PWD is /root/artifacts/regression or wherever I was copied
+
+unzip test.zip
+tar zxvmf ../cloud-management-dist.tar.gz
+cd scripts
+./cleanparallel.sh
+./deploy.sh  -b ../cloud-management-dist -d -r
+sleep 300
+./regression.sh
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/build-env.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/build-env.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/build-env.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/build-env.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+PATHSEP=':'
+if [[ $OSTYPE == "cygwin" ]] ; then
+  PATHSEP=';'
+fi
+
+CP=commons-httpclient-3.1.jar${PATHSEP}commons-logging-1.1.1.jar${PATHSEP}commons-codec-1.3.jar${PATHSEP}testclient.jar${PATHSEP}log4j-1.2.15.jar${PATHSEP}utils.jar${PATHSEP}./conf
+java -cp $CP com.vmops.test.longrun.BuildGuestNetwork $*
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/certDeleteEC2.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/certDeleteEC2.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/certDeleteEC2.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/certDeleteEC2.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+set -e
+DST='src/'
+
+java -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.4.jar:${DST}cloud-test.jar:${DST}log4j-1.2.15.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:./conf com.cloud.test.utils.SubmitCert -action DeleteCertificate $*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/certSubmitEC2.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/certSubmitEC2.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/certSubmitEC2.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/certSubmitEC2.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+set -e
+DST='src/'
+
+java -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.4.jar:${DST}cloud-test.jar:${DST}log4j-1.2.15.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:./conf com.cloud.test.utils.SubmitCert $*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/checkLog.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/checkLog.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/checkLog.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/checkLog.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,69 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+
+#set -x
+
+rm -rf log.out
+
+dir=$(dirname "$0")
+if [ -f $dir/../deploy.properties ]; then
+  . "$dir/../deploy.properties"
+fi
+
+
+echo "Starting checking the logs for errors...."
+
+  for i in $SERVER
+  do
+    echo -ne "Log from Management server $i: \n=====================================================================================\n" >> log.out
+    ssh root@$i "grep -i -E 'error|exce|fail|unable|leak' /var/log/vmops/vmops.log" >> log.out
+    echo -e "\n" >> log.out
+  done
+
+  for i in $COMPUTE
+  do
+    echo -ne "Log from Computing host $i: \n=====================================================================================\n" >> log.out
+    ssh root@$i "grep -i -E 'error|exce|fail|timed out|unable' /var/log/vmops/agent.log" >> log.out
+    echo -e "\n\n" >> log.out
+  done
+
+  for i in $ROUTER
+  do
+    echo -ne "Log from Routing host $i: \n=====================================================================================\n" >> log.out
+    ssh root@$i "grep -i -E 'error|exce|fail|timed out|unable' /var/log/vmops/agent.log" >> log.out
+    echo -e "\n" >> log.out
+  done
+
+  for i in $STORAGE
+  do
+    echo -ne "Log from Storage host $i: \n=====================================================================================\n" >> log.out
+    ssh root@$i "grep -i error /var/log/vmops/agent.log" >> log.out
+    ssh root@$i "grep -i fail /var/log/vmops/agent.log" >> log.out
+    ssh root@$i "grep -i exce /var/log/vmops/agent.log" >> log.out
+    ssh root@$i "grep -i unable /var/log/vmops/agent.log" >> log.out
+	ssh root@$i "grep -i \'timed out\' /var/log/vmops/agent.log" >> log.out
+    echo -e "\n" >> log.out
+  done
+
+
+echo "Done! Check log.out file for the results"
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/checkOutOfMemory.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/checkOutOfMemory.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/checkOutOfMemory.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/checkOutOfMemory.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,37 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+
+while true
+do
+sleep 600
+pid=`ps -ef | grep 'management.jmxremote' | grep -v 'cloud-management' | grep -v grep | awk '{print \$2}'`
+if grep -q java.lang.OutOfMemoryError /var/log/vmops/vmops.log
+then
+while true
+do
+t=$(date  +"%h%d_%H_%M_%S")
+jmap -dump:format=b,file=/root/dump/heap.bin.$t $pid
+sleep 1800
+done
+fi
+done
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/cleanparallel.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/cleanparallel.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/cleanparallel.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/cleanparallel.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,115 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+
+. /etc/rc.d/init.d/functions
+
+set -x
+
+kill_server() {
+ssh root@$1 "service cloud-management stop && service cloud-usage stop 2>&1 &"
+}
+
+
+
+cleanup_server() {
+  kill_server $1 $2
+t=$(date  +"%h%d_%H_%M_%S")
+ssh root@$1 "mkdir $2/logs.$t; mv $2/management-server.log $2/logs.$t/management-server.log.$t  "
+ssh root@$1 "mkdir $2/logs.$t; mv $2/catalina.out $2/logs.$t/catalina.out.$t"
+  return 0
+}
+
+
+cleanup_linux(){
+ssh root@$1 "for vm in \`xe vm-list | grep name-label | grep -v Control | awk '{print \$4}'\`; do uuid=\`xe vm-list name-label=\$vm | grep uuid | awk '{print \$5}'\`; echo \$uuid; xe vm-shutdown --force uuid=\$uuid; xe vm-destroy uuid=\$uuid; done"
+
+ssh root@$1 "for vlan in \`xe vlan-list | grep uuid | awk '{print \$5}'\`; do pif=\`xe pif-list VLAN=\$vlan | grep ^uuid | awk '{print \$5}'\`; xe pif-unplug uuid=\$pif;  xe vlan-destroy uuid=\$vlan; done"
+
+ssh root@$1 "for vlan in \`xe network-list | grep name-label | grep VLAN| awk '{print \$4}'\`; do echo \$vlan; uuid=\`xe network-list name-label=\$vlan | grep uuid | awk '{print \$5}'\`; xe network-destroy uuid=\$uuid; done"
+
+ssh root@$1 "for sr in \`xe sr-list type=nfs name-description=storage | grep uuid | awk '{print \$5}'\`; do pbd=\`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; xe sr-forget uuid=\$sr; done"
+
+ssh root@$1 "for sr in \`xe sr-list type=iso name-description=iso | grep uuid | awk '{print \$5}'\`; do echo \$sr; for vdi in \`xe vdi-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$vdi; xe vdi-destroy uuid=\$vdi; done; for pbd in \`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; done; done"
+
+ssh root@$1 "xentoolsiso=\$(xe sr-list name-label='XenServer Tools' | grep uuid | awk '{print \$5}'); for sr in \`xe sr-list type=iso content-type=iso | grep uuid | awk '{print \$5}' | grep -v \$xentoolsiso \`; do echo \$sr; for vdi in \`xe vdi-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$vdi; xe vdi-destroy uuid=\$vdi; done; for pbd in \`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; done;  done"
+
+ssh root@$1 "for sr in \`xe sr-list type=nfs | grep uuid | awk '{print \$5}'\`; do echo \$sr;  for pbd in \`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; done; xe sr-forget uuid=\$sr; done"
+
+ssh root@$1 "for sr in \`xe sr-list type=lvmoiscsi | grep uuid | awk '{print \$5}'\`; do echo \$sr; for vdi in \`xe vdi-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$vdi; xe vdi-destroy uuid=\$vdi; done; for pbd in \`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; done; xe sr-forget uuid=\$sr; done"
+
+ssh root@$1 "for sr in \`xe sr-list type=lvm | grep uuid | awk '{print \$5}'\`; do echo \$sr; for vdi in \`xe vdi-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$vdi; xe vdi-destroy uuid=\$vdi; done; done"
+
+ssh root@$1 "for mount in \`mount | grep '/var/run/sr-mount' | awk '{print \$3}'\`; do echo \$mount; umount \$mount; done"
+ssh root@$1 "cd /opt/xensource/bin/ && rm -rf heartbeat"
+}
+
+
+cleanup_storage(){
+echo 'Deleting snapshot directory'
+ssh root@$1 "cd $2/ &&  rm -rf snapshots"
+echo 'Deleteing private directories'
+ssh root@$1 "cd $2/template/tmpl && for dir in \`ls | grep -v 1\$\`; do rm -rf \$dir; done"
+echo 'Deleting system templates except for 1,2 and 3'
+ssh root@$1 "cd $2/template/tmpl/1 && for dir in \`ls | grep -v \^1\$ | grep -v \^2\$ | grep -v \^3\$\`; do rm -rf \$dir; done"
+}
+
+
+dir=$(dirname "$0")
+if [ -f $dir/../deploy.properties ]; then
+  . "$dir/../deploy.properties"
+fi
+
+if [ "$USER" == "" ]; then
+  printf "ERROR: Need tospecify the user\n"
+  exit 4
+fi
+
+
+#Delete all active users and kill the management server
+for h in "$SERVER"
+do
+  kill_server $h $VMOPSDIR
+done
+
+#Kill vms and delete vlans on all computing hosts
+for i in $COMPUTE
+do
+  cleanup_linux $i
+done
+
+#Cleanup management server
+for i in $SERVER
+do
+  echo "Starting cleanup on $i";
+  cleanup_server $i $LOGDIR
+done
+
+#Cleanup secondary storage
+for i in $SECONDARY_STORAGE
+do
+  echo "Starting cleanup on secondary storage $i";
+  cleanup_storage $i $SECONDARY_STORAGE_DIR
+done
+
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/deploy-and-run-regression.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/deploy-and-run-regression.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/deploy-and-run-regression.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/deploy-and-run-regression.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,48 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+
+set -e
+set -x
+
+
+# $1: the dest host where we will run eeeeeeverything
+
+# "${build.schedule.workingDir}/branches/GA-1.0.0-09-11-15/java/test/scripts/deploy-and-run-regression.sh" root@192.168.0.3 "${build.artifactsDir}"  /root/artifacts
+
+dir=`dirname $0`
+r=bootstrap-regression.sh
+
+host="$1"
+src="$2"
+dest="$3"
+
+srcbootstrapper="$dir"/"$r" # that script is launched from this one, remotely via ssh
+destbootstrapper="$dest"/"$r" # this is the path on the remote machine
+
+
+ssh -o BatchMode\ yes $host rm -rf $dest
+scp -o BatchMode\ yes -r $src $host:$dest
+scp -o BatchMode\ yes -r "$srcbootstrapper" $host:$destbootstrapper
+
+ssh -o BatchMode\ yes $host $destbootstrapper
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/deploycluster.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/deploycluster.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/deploycluster.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/deploycluster.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+
+set -x
+
+usage() {
+  printf "Usage: %s: [-f] [-d] [-i] \n" $(basename $0) >&2
+}
+
+
+path=
+db=
+ips=
+
+while getopts 'p:d:i:' OPTION
+do
+  case $OPTION in
+  p)    path="$OPTARG"
+        ;;
+  d)    db="$OPTARG"
+        ;;
+  i)    ips="$OPTARG"
+        ;;
+
+  ?)    usage
+  esac
+done
+
+
+deploy_server() {
+  echo "Deploying management server software on remote machine $1"
+
+  rsync -avzh -e ssh $path/cloudstack-oss root@$1:/root/
+  if [ $? -gt 0 ]; then echo "failed to rsync software between $path/cloudstack-oss and and remote machine $1"; return 2; fi
+
+  ssh root@$1 "cd /root/cloudstack-oss && ant clean build-all deploy-server"
+  if [ $? -gt 0 ]; then echo "failed to deploy cluster on $1"; return 2; fi
+
+
+  ssh root@$1 "dir=\`cat ~/.bashrc  | grep 'export CATALINA_HOME' | awk -F '=' '{ print \$2}'\` && file=\$dir/conf/db.properties && sed '/cluster.node.IP/ d' \$file > db.properties1; dos2unix db.properties1; mv -f db.properties1 \$file; echo \cluster.node.IP=$1 >> \$file && file=\$dir/conf/db.properties && sed '/db.cloud.host/ d' \$file > db.properties1; dos2unix db.properties1; mv -f db.properties1 \$file; echo \db.cloud.host=$db >> \$file && file=\$dir/conf/db.properties && sed '/db.usage.host/ d' \$file > db.properties1; dos2unix db.properties1; mv -f db.properties1 \$file; echo \db.usage.host=$db >> \$file"
+
+if [ $? -gt 0 ]; then echo "failed to setup db.properties file on remote $1"; return 2; fi
+
+#ssh root@$1 "cd /root/cloudstack-oss && nohup ant run &"
+  #if [ $? -gt 0 ]; then echo "failed to start the softare on remote $1"; return 2; fi
+
+  echo "Remote management server is deployed as a part of cluster setup; you have to start it manually by logging in remotely"
+}
+
+export IFS=","
+for ip in $ips; do
+  echo "$ip"
+  deploy_server $ip
+done
+
+
+
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/deploy.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/deploy.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/deploy.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/deploy.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,172 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+
+. /etc/rc.d/init.d/functions
+
+set -x
+
+usage() {
+  printf "Usage: %s: [-d] [-r] \n" $(basename $0) >&2
+}
+
+deploy_server() {
+  ssh root@$1 "yum remove -y \"cloud*\" ; yum clean all ; cd /usr/share/cloud/ && rm -rf * && rm -rf /var/cache/cloud ; yum install -y cloud-client cloud-premium cloud-usage"
+  ssh root@$1 "cloud-setup-databases alena@$2 xenserver"
+  ssh root@$1 "cd /usr/share/cloud/management/conf; sed '/db.cloud.url.params/ d' db.properties > db.properties1; dos2unix db.properties1; mv -f db.properties1 db.properties"
+  ssh root@$1 "cd /usr/share/cloud/management/conf; echo \db.cloud.url.params=includeInnodbStatusInDeadlockExceptions=true\&logSlowQueries=true\&prepStmtCacheSize=517\&cachePrepStmts=true >> db.properties"
+  if [ $? -gt 0 ]; then echo "failed to install on $1"; return 2; fi
+ echo "Management server is deployed successfully"
+}
+
+deploy_db() {
+  echo "Deploying database on $1"
+ # ssh root@$1 "cp $CONFIGDIR/conf/templates.sql /usr/share/cloud/setup/templates.xenserver.sql "
+ssh root@$1 "cloud-setup-databases alena@$1 --deploy-as=root xenserver"
+  if [ $? -gt 0 ]; then echo "failed to deploy db on $1"; return 2; fi
+  echo "Database is deployed successfully"
+}
+
+run_server() {
+  ssh root@$1 "service cloud-management start; service cloud-usage start 2>&1 &"
+}
+
+stop_server() {
+  ssh root@$1 "service cloud-management stop; service cloud-usage stop 2>&1 &"
+}
+
+dir=$(dirname "$0")
+if [ -f $dir/../deploy.properties ]; then
+  . "$dir/../deploy.properties"
+fi
+
+if [ "$USER" == "" ]; then
+  printf "ERROR: Need tospecify the user\n"
+  exit 4
+fi
+
+if [ "$SERVER" == "" ]; then
+  printf "ERROR: Need to specify the management server\n"
+  exit 1
+fi
+
+installflag=
+deployflag=
+runflag=
+killflag=
+setupflag=
+mgmtIp=
+mode=expert
+distdir=dist
+
+while getopts 'idkrsb:D' OPTION
+do
+  case $OPTION in
+  i)    installflag=1
+        ;;
+  d)    deployflag=1
+        ;;
+  k)    killflag=1
+        ;;
+  r)    runflag=1
+        ;;
+  b)    distdir="$OPTARG"
+        ;;
+  s)    setupflag=1
+        mode=setup
+        ;;
+  D)    developer=1; distdir=dist/developer;;
+
+  ?)    usage
+  esac
+done
+
+
+if [ "$setupflag$deployflag$installflag$killflag$runflag" == "" ]
+then
+  usage
+  exit
+fi
+
+
+if [ "$installflag" == "1" ]
+then
+    echo "Deploying server...."
+
+    for i in $SERVER
+    do
+      echo -n "$i: "
+      deploy_server $i $DB
+      if [ $? -gt 0 ]; then  failure ; else success;fi
+      echo
+    done
+fi
+
+if [ "$deployflag" == "1" ]
+then
+    echo "Deploying database..."
+    for i in $DB
+    do
+      echo -n "$i: "
+      deploy_db $i
+      if [ $? -gt 0 ]; then  failure ; else success;fi
+      echo
+    done
+fi
+
+
+if [ "$runflag" == "1" ]
+then
+   echo "Starting Management server"
+   for i in $SERVER
+   do
+      run_server $i
+      sleep 30
+   done
+
+
+echo "Setting up configuration values..."
+    for i in $LB
+   do
+      DST='../src/'
+      java -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.4.jar:${DST}cloud-test.jar:${DST}log4j-1.2.15.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:.././conf com.cloud.test.regression.Deploy -h $i -f ../conf/deploy.xml
+      echo "Restarting Management server to apply configuration values"
+   done
+
+echo "Restarting management servers"
+  for i in $SERVER
+   do
+      echo "Restarting Management server to apply configuration values"
+      stop_server $i
+      run_server $i
+      sleep 60
+   done
+
+
+echo "Adding secondary/primary storage/hosts..."
+    for i in $LB
+   do
+      DST='../src/'
+      java -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.4.jar:${DST}cloud-test.jar:${DST}log4j-1.2.15.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:.././conf com.cloud.test.regression.Deploy -h $i -f ../conf/config.xml
+   done
+
+fi
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/executeUserAPI.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/executeUserAPI.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/executeUserAPI.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/executeUserAPI.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+PATHSEP=':'
+if [[ $OSTYPE == "cygwin" ]] ; then
+  PATHSEP=';'
+fi
+
+#directory with jar files
+DST='../src/'
+
+CP=${DST}commons-httpclient-3.1.jar${PATHSEP}${DST}commons-logging-1.1.1.jar${PATHSEP}${DST}commons-codec-1.4.jar${PATHSEP}${DST}testclient.jar${PATHSEP}.././conf
+java -cp $CP com.cloud.sample.UserCloudAPIExecutor
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/invoke.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/invoke.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/invoke.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/invoke.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+cd /root/test/scripts && ./cleanparallel.sh && ./deploy.sh -i -d -r
+if [ $? -ne 0 ]; then exit 2; fi;
+
+echo 'sleeping for 5 min before executing regression test'
+sleep 600
+cd /root/test/scripts && ./regression.sh -type $1
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/regression.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/regression.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/regression.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/regression.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+set -e
+DST='../src/'
+java -Xrunjdwp:transport=dt_socket,address=8789,server=y,suspend=n -ea -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.4.jar:${DST}cloud-test.jar:${DST}log4j.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:.././conf com.cloud.test.regression.TestCaseEngine $*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/run.bat ./vogxn-asf-marvin-updates-f66caa0/test/scripts/run.bat
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/run.bat	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/run.bat	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,18 @@
+rem  Licensed to the Apache Software Foundation (ASF) under one
+rem  or more contributor license agreements.  See the NOTICE file
+rem  distributed with this work for additional information
+rem  regarding copyright ownership.  The ASF licenses this file
+rem  to you under the Apache License, Version 2.0 (the
+rem  "License"); you may not use this file except in compliance
+rem  with the License.  You may obtain a copy of the License at
+rem  
+rem    http://www.apache.org/licenses/LICENSE-2.0
+rem  
+rem  Unless required by applicable law or agreed to in writing,
+rem  software distributed under the License is distributed on an
+rem  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+rem  KIND, either express or implied.  See the License for the
+rem  specific language governing permissions and limitations
+rem  under the License.
+
+java -cp "commons-httpclient-3.1.jar;commons-logging-1.1.1.jar;commons-codec-1.3.jar;testclient.jar;log4j-1.2.15.jar;trilead-ssh2-build213.jar;utils.jar;./conf" com.vmops.test.TestClientWithAPI %*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/run.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/run.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/run.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/run.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+PATHSEP=':'
+if [[ $OSTYPE == "cygwin" ]] ; then
+  PATHSEP=';'
+fi
+
+#directory with jar files
+DST='../src/'
+
+CP=${DST}commons-httpclient-3.1.jar${PATHSEP}${DST}commons-logging-1.1.1.jar${PATHSEP}${DST}commons-codec-1.4.jar${PATHSEP}${DST}cloud-test.jar${PATHSEP}${DST}log4j.jar${PATHSEP}${DST}trilead-ssh2-build213.jar${PATHSEP}${DST}cloud-utils.jar${PATHSEP}.././conf
+java -cp $CP com.cloud.test.stress.TestClientWithAPI $*
+#java -cp $CP com.cloud.test.stress.StressTestDirectAttach $*
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/script_lock_test/test.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/script_lock_test/test.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/script_lock_test/test.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/script_lock_test/test.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,32 @@
+#!/bin/bash
+# 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.
+
+rm /tmp/biglock*
+echo
+
+#Test task A would acquire one lock again and again in little interval
+./test_task.sh A 0.3 &
+
+sleep 1
+#At the same time, task B would try to acquire the lock as well.
+./test_task.sh B 0.5 &
+
+#For the original version, task B would essiental fail, because task A do it
+
+read end
+pkill test_task
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/script_lock_test/test_task.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/script_lock_test/test_task.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/script_lock_test/test_task.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/script_lock_test/test_task.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,35 @@
+#!/bin/bash
+# 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.
+
+source ../../../patches/systemvm/debian/config/root/func.sh
+
+lock="biglock"
+
+for i in `seq 1 100`
+do
+    locked=$(getLockFile $lock)
+    if [ "$locked" != "1" ]
+    then
+        echo WRONG, Task $1 can''t get the lock
+        exit 1
+    fi
+    echo `date +%H:%M:%S.%N` TASK $1 get the lock
+    sleep $2
+    releaseLockFile $lock $locked
+    echo `date +%H:%M:%S.%N` TASK $1 release the lock
+done
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/signEC2.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/signEC2.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/signEC2.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/signEC2.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+set -e
+DST='../src/'
+#java -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.3.jar:${DST}cloud-test.jar:${DST}log4j-1.2.15.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:.././conf com.cloud.test.utils.SignRequest $*
+
+java -cp ${DST}commons-httpclient-3.1.jar:${DST}mysql-connector-java-5.1.7-bin.jar:${DST}commons-logging-1.1.1.jar:${DST}commons-codec-1.3.jar:${DST}cloud-test.jar:${DST}log4j-1.2.15.jar:${DST}trilead-ssh2-build213.jar:${DST}cloud-utils.jar:.././conf com.cloud.test.utils.SignEC2 $*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/sign.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/sign.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/sign.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/sign.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+set -e
+DST='../src/'
+
+java -cp ${DST}cloud-test.jar:${DST}cloud-utils.jar com.cloud.test.utils.SignRequest $*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/allocated.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/allocated.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/allocated.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/allocated.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,86 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+#set -x
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from account;")
+echo "Created/Destroyed for the first VM:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+vm_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select v.name from vm_instance v, user_vm u where v.id=u.id and u.account_id=$i limit 0,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.CREATE' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.DESTROY' and level='INFO';")
+
+
+if [ "$vm_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=2 and description like '%$vm_name%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Running time is missing in cloud_usage table for VM $vm_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in running time for vm $vm_name is $temp"
+else
+echo "Test passed for the first VM belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses the first VM b) VM wasn't destroyed 3) VM Destroy failed "
+fi
+done
+
+echo "Created/Destroyed for the second VM:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+vm_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select v.name from vm_instance v, user_vm u where v.id=u.id and u.account_id=$i limit 1,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.CREATE' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.DESTROY' and level='INFO';")
+
+
+if [ "$vm_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=2 and description like '%$vm_name%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Running time is missing in cloud_usage table for VM $vm_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in running time for vm $vm_name is $temp"
+else
+echo "Test passed for the second vm belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses the second VM b) VM wasn't stopped 3) VM Stop failed "
+fi
+done
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/network.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/network.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/network.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/network.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,71 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+#set -x
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from user_statistics;")
+echo "Bytes received:"
+for ((i=3; i<$iteration; i++))
+do
+cloud_usage=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select SUM(raw_usage) from cloud_usage where account_id=$i and usage_type=5;")
+if [ "$cloud_usage" = "NULL" ]
+then
+cloud_usage=0
+fi
+
+user_stat=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select net_bytes_received+current_bytes_received from user_statistics where account_id=$i;")
+
+if [ "$user_stat" = "" ]
+then
+user_stat=0
+fi
+
+temp=`expr $user_stat - $cloud_usage`
+if [ $temp -ne 0 ]
+then
+echo "For account $i difference in bytes_received is $temp"
+fi
+done
+
+echo "\n"
+echo "Bytes sent:"
+for ((i=3; i<$iteration; i++))
+do
+cloud_usage=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select SUM(raw_usage) from cloud_usage where account_id=$i and usage_type=4;")
+
+if [ "$cloud_usage" = "NULL" ]
+then
+cloud_usage=0
+fi
+
+user_stat=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select net_bytes_sent+current_bytes_sent from user_statistics where account_id=$i;")
+
+if [ "$user_stat" = "" ]
+then
+user_stat=0
+fi
+
+temp=`expr $user_stat - $cloud_usage`
+if [ $temp -ne 0 ]
+then
+echo "For account $i difference in bytes_sent is $temp"
+fi
+done
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/running.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/running.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/running.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/running.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,87 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+#set -x
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from account;")
+echo "Started/Stopped for the first VM:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+vm_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select v.name from vm_instance v, user_vm u where v.id=u.id and u.account_id=$i limit 0,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.START' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.STOP' and level='INFO';")
+
+
+if [ "$vm_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=1 and description like '%$vm_name%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Running time is missing in cloud_usage table for VM $vm_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in running time for vm $vm_name is $temp"
+else
+echo "Test passed for the first VM belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses the first VM b) VM wasn't stopped 3) VM Stop failed "
+fi
+done
+
+
+
+echo "Started/Stopped for the second VM:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+vm_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select v.name from vm_instance v, user_vm u where v.id=u.id and u.account_id=$i limit 1,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.START' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$vm_name%' and type='VM.STOP' and level='INFO';")
+
+
+if [ "$vm_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=1 and description like '%$vm_name%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Running time is missing in cloud_usage table for VM $vm_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in running time for vm $vm_name is $temp"
+else
+echo "Test passed for the second vm belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses the second VM b) VM wasn't stopped 3) VM Stop failed "
+fi
+done
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/volume_usage.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/volume_usage.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usage/volume_usage.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usage/volume_usage.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,161 @@
+#!/bin/bash
+# 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.
+
+
+
+ 
+
+#set -x
+#Check first ROOT volume
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from account;")
+echo "Created/removed for the first ROOT volume:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+volume_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select name from volumes where account_id=$i and volume_type='ROOT' and name like 'i-%' limit 0,1;")
+volume_id=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select id from volumes where account_id=$i and volume_type='ROOT' and name like 'i-%'limit 0,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.CREATE' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.DELETE' and level='INFO';")
+
+
+if [ "$volume_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=6 and description like '%Volume Id: $volume_id%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Allocated time is missing in cloud_usage table for volume $volume_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in time for volume $volume_name is $temp"
+else
+echo "Test passed for the ROOT volume $volume_name belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses root volume $volume_name b) volume wasn't deleted 3) Delete volume failed "
+fi
+done
+
+#Check second ROOT volume
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from account;")
+echo "Created/removed for the second ROOT volume:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+volume_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select name from volumes where account_id=$i and volume_type='ROOT' and name like 'i-%' limit 1,1;")
+volume_id=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select id from volumes where account_id=$i and volume_type='ROOT' and name like 'i-%'limit 1,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.CREATE' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.DELETE' and level='INFO';")
+
+
+if [ "$volume_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=6 and description like '%Volume Id: $volume_id%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Allocated time is missing in cloud_usage table for volume $volume_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in time for volume $volume_name is $temp"
+else
+echo "Test passed for the ROOT volume $volume_name belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses root volume $volume_name b) volume wasn't deleted 3) Delete volume failed "
+fi
+done
+
+
+#Check first DATADISK volume
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from account;")
+echo "Created/removed for the first DATADISK volume:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+volume_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select name from volumes where account_id=$i and volume_type='DATADISK' and name like 'i-%' limit 0,1;")
+volume_id=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select id from volumes where account_id=$i and volume_type='DATADISK' and name like 'i-%'limit 0,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.CREATE' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.DELETE' and level='INFO';")
+
+
+if [ "$volume_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=6 and description like '%Volume Id: $volume_id%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Allocated time is missing in cloud_usage table for volume $volume_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in time for volume $volume_name is $temp"
+else
+echo "Test passed for the DATADISK volume $volume_name belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses root volume $volume_name b) volume wasn't deleted 3) Delete volume failed "
+fi
+done
+
+#Check second DATADISK volume
+iteration=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select count(*) from account;")
+echo "Created/removed for the second DATADISK volume:\n"
+for ((i=3; i<$iteration+1; i++))
+do
+volume_name=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select name from volumes where account_id=$i and volume_type='DATADISK' and name like 'i-%' limit 1,1;")
+volume_id=$(mysql -h $1 --user=root --skip-column-names -U cloud -e "select id from volumes where account_id=$i and volume_type='DATADISK' and name like 'i-%'limit 1,1;")
+created_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.CREATE' and level='INFO';")
+destroyed_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select TIME_TO_SEC(created) from event where description like '%$volume_name%' and type='VOLUME.DELETE' and level='INFO';")
+
+
+if [ "$volume_name" != "" ] && [ "$destroyed_time" != "" ]
+then
+
+event_time=`expr $destroyed_time - $created_time`
+cloud_usage_time=$(mysql -h $1 --user=root --skip-column-names -U cloud_usage -e "select ROUND(SUM(raw_usage*3600)) from cloud_usage where usage_type=6 and description like '%Volume Id: $volume_id%';")
+
+if [ "$cloud_usage_time" = "NULL" ]
+then
+echo "Allocated time is missing in cloud_usage table for volume $volume_name belonging to account $i"
+else
+temp=`expr $event_time - $cloud_usage_time`
+if [ $temp -ne 0 ] && [ $temp != "-86400" ]
+then
+echo "For account $i difference in time for volume $volume_name is $temp"
+else
+echo "Test passed for the DATADISK volume $volume_name belonging to account $i"
+fi
+fi
+else
+echo "Skipping verification for account $i (the account either a) misses root volume $volume_name b) volume wasn't deleted 3) Delete volume failed "
+fi
+done
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usercloud.properties ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usercloud.properties
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/usercloud.properties	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/usercloud.properties	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,21 @@
+# 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.
+
+host=http://localhost:8080/client/api
+apiUrl=command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=2&zoneId=4&displayName=Test
+apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ
+secretKey=AdpTvsQMZwv9MNvfqDcQhWSL9pHQvq7z13CFP2SU1iToDkkM3d8iZciWEKsGREhMtV9yLVMxmbbJJgrXo8O5jg
Binary files /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/wget.exe and ./vogxn-asf-marvin-updates-f66caa0/test/scripts/wget.exe differ
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/corrupttemplate.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/corrupttemplate.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/corrupttemplate.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/corrupttemplate.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+host=""
+account=""
+templateid=""
+storage=""
+var=""
+
+while getopts h:s:a:i: OPTION
+do
+  case $OPTION in
+  a)    account="$OPTARG"
+        ;;
+  i)    templateid="$OPTARG"
+                ;;
+  h)    host="$OPTARG"
+                ;;
+  s)    storage="$OPTARG"
+  esac
+done
+
+var=`ssh root@$host "cd $storage &&  mv template/tmpl/$account/$templateid/template.properties template/tmpl/$account/$templateid/template.properties1 && touch template/tmpl/$account/$templateid/template.properties"`
+
+
+if  [ "$var" != "" ]
+then echo "Was unable to corrupt template $path on host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/createfaketemplate.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/createfaketemplate.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/createfaketemplate.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/createfaketemplate.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+host=""
+account=""
+templateid=""
+storage=""
+var=""
+dir=""
+
+while getopts h:s:a:i:d: OPTION
+do
+  case $OPTION in
+  a)    account="$OPTARG"
+        ;;
+  i)    templateid="$OPTARG"
+                ;;
+  h)    host="$OPTARG"
+        ;;
+  s)    storage="$OPTARG"
+  		;;
+  d)	dir="$OPTARG"
+  esac
+done
+
+var=`ssh root@$host "cd $storage &&  cp -rf template/tmpl/$account/$templateid template/tmpl/$account/$dir`
+
+if  [ "$var" != "" ]
+then echo "Was unable to create fake template on host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/killvm.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/killvm.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/killvm.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/killvm.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+uuid=""
+name=""
+host=""
+
+while getopts n:h: OPTION
+do
+  case $OPTION in
+  n)    name="$OPTARG"
+  		;;
+  h)	host="$OPTARG"
+  esac
+done
+
+
+
+if [ "$name" != "" ]
+then
+        uuid=`ssh root@$host "xe vm-list name-label=$name | grep uuid | awk '{print \\$5}'"`
+fi
+
+echo "uuid is $uuid"
+var=`ssh root@$host "xe vm-shutdown uuid=$uuid; xe vm-destroy uuid=$uuid"`
+
+if  [ "$var" != "" ]
+then echo "Was unable to destroy the vm with name $name and uuid $uuid on host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/listtemplate.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/listtemplate.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/listtemplate.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/listtemplate.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+host=""
+path=""
+storage=""
+var=""
+
+while getopts h:s:p: OPTION
+do
+  case $OPTION in
+  p)    path="$OPTARG"
+        ;;
+  h)	host="$OPTARG"
+  		;;
+  s)	storage="$OPTARG"
+  esac
+done
+
+	var=`ssh root@$host "ls -ltr $storage/$path"`
+
+if  [ "$var"  == "" ]
+then echo "Template $path doesn't exist on storage host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/listvdi.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/listvdi.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/listvdi.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/listvdi.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+uuid=""
+name=""
+host=""
+var=""
+
+while getopts u:n:h: OPTION
+do
+  case $OPTION in
+  u)    uuid="$OPTARG"
+        ;;
+  n)    name="$OPTARG"
+  		;;
+  h)	host="$OPTARG"
+  esac
+done
+
+
+
+if [ "$uuid" != "" ]
+then
+        var=`ssh root@$host "xe vdi-list uuid=$uuid"`
+else
+        if [ "$name" != "" ]
+        then
+                var=`ssh root@$host "xe vdi-list name-label=$name"`
+        fi
+fi
+
+
+if  [ "$var" == "" ]
+then echo "VDI $name $uuid doesn't exist on host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/listvm.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/listvm.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/listvm.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/listvm.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+uuid=""
+name=""
+host=""
+var=""
+
+while getopts u:n:h: OPTION
+do
+  case $OPTION in
+  u)    uuid="$OPTARG"
+        ;;
+  n)    name="$OPTARG"
+  		;;
+  h)	host="$OPTARG"
+  esac
+done
+
+
+
+if [ "$uuid" != "" ]
+then
+        var=`ssh root@$host "xe vm-list uuid=$uuid"`
+else
+        if [ "$name" != "" ]
+        then
+                var=`ssh root@$host "xe vm-list name-label=$name"`
+        fi
+fi
+
+
+if  [ "$var" == "" ]
+then echo "VM $name doesn't exist on host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/ms.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/ms.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/ms.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/ms.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+host=""
+operation=""
+
+while getopts h:o: OPTION
+do
+  case $OPTION in
+  h)	host="$OPTARG"
+  ;;
+  o)	operation="$OPTARG"
+  esac
+done
+
+var=`ssh root@$host "service cloud-management $operation"`
+sleep 30
+
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/removetemplate.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/removetemplate.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/removetemplate.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/removetemplate.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+host=""
+path=""
+storage=""
+var=""
+
+while getopts h:s:p: OPTION
+do
+  case $OPTION in
+  p)    path="$OPTARG"
+        ;;
+  h)	host="$OPTARG"
+  		;;
+  s)	storage="$OPTARG"
+  esac
+done
+
+if  [ $path != "" ] 
+then
+	var=`ssh root@$host "cd $storage && rm -rf $path"`
+fi
+
+
+if  [ "$var" != "" ]
+then echo "Was unable to remove template $path from host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/shutdown.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/shutdown.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/shutdown.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/shutdown.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+uuid=""
+name=""
+host=""
+
+while getopts n:h: OPTION
+do
+  case $OPTION in
+  n)    name="$OPTARG"
+  		;;
+  h)	host="$OPTARG"
+  esac
+done
+
+
+
+if [ "$name" != "" ]
+then
+        uuid=`ssh root@$host "xe vm-list name-label=$name | grep uuid | awk '{print \\$5}'"`
+fi
+
+echo "uuid is $uuid"
+var=`ssh root@$host "xe vm-shutdown uuid=$uuid;"`
+
+if  [ "$var" != "" ]
+then echo "Was unable to shutdown the vm with name $name and uuid $uuid on host $host"
+exit 2
+else
+exit 0
+fi
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/sleep.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/sleep.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/sleep.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/sleep.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+sleep=60
+
+while getopts s: OPTION
+do
+  case $OPTION in
+  s)    sleep=$OPTARG
+  esac
+done
+
+sleep $sleep
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/ssh.sh ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/ssh.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/scripts/xen/ssh.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/scripts/xen/ssh.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# 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.
+
+
+
+ 
+
+
+PATHSEP=':'
+if [[ $OSTYPE == "cygwin" ]] ; then
+  PATHSEP=';'
+fi
+
+DST='../src/'
+password=""
+host=""
+url=""
+
+while getopts p:h:u: OPTION
+do
+  case $OPTION in
+  p)    password="$OPTARG"
+  		;;
+  h)	host="$OPTARG"
+  		;;
+  u)    url="$OPTARG"
+  esac
+done
+
+
+CP=${DST}commons-httpclient-3.1.jar${PATHSEP}${DST}commons-logging-1.1.1.jar${PATHSEP}${DST}commons-codec-1.4.jar${PATHSEP}${DST}cloud-test.jar${PATHSEP}${DST}log4j-1.2.15.jar${PATHSEP}${DST}trilead-ssh2-build213.jar${PATHSEP}${DST}cloud-utils.jar${PATHSEP}.././conf
+java -cp $CP com.cloud.test.stress.SshTest $*
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/setup-test-data.sh ./vogxn-asf-marvin-updates-f66caa0/test/setup-test-data.sh
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/setup-test-data.sh	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/setup-test-data.sh	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,77 @@
+#!/bin/bash
+usage() {
+  printf "Usage: %s:\n
+	[-t path to tests ]  \n
+	[-m mgmt-server ] \n
+	[-p hypervisor root password ] \n
+	[-d db node url ]\n" $(basename $0) >&2
+}
+
+failed() {
+	exit $1
+}
+
+#defaults
+TESTDIR="/root/cloudstack/test/"
+MGMT_SVR="localhost"
+DB_SVR="localhost"
+HV_PASSWD="password"
+
+while getopts 't:d:m:p:' OPTION
+do
+  case $OPTION in
+  d)    dflag=1
+		DB_SVR="$OPTARG"
+		;;
+  t)    tflag=1
+		TESTDIR="$OPTARG"
+		;;
+  m)    mflag=1
+		MGMT_SVR="$OPTARG"
+		;;
+  p)    pflag=1
+		HV_PASSWD="$OPTARG"
+		;;
+  ?)	usage
+		failed 2
+		;;
+  esac
+done
+
+#Damn Small Linux ISO type
+ostypeid=$(mysql -uroot -Dcloud -h$DB_SVR -s -N -r -e"select uuid from guest_os where display_name='CentOS 5.3 (64-bit)'")
+if [[ $ostypeid == "" ]]; then
+    echo "Unable to contact DB server @ $DB_SVR"
+    exit 2
+fi
+
+nc -z $MGMT_SVR 8096
+if [[ $? -ne 0 ]]; then
+    echo "$MGMT_SVR doesn't have port 8096 open"
+    exit 2
+fi
+
+if [[ ! -d $TESTDIR ]]; then
+    echo "No directory $TESTDIR found"
+    exit 2
+fi
+for file in `find $TESTDIR -name *.py -type f`
+do
+	old_ostypeid=$(grep ostypeid $file | head -1 | cut -d: -f2 | tr -d " ,'")
+	if [[ $old_ostypeid != "" ]]
+	then
+		echo "replacing:" $old_ostypeid, "with:" $ostypeid,"in " $file
+		sed -i "s/$old_ostypeid/$ostypeid/g" $file
+		#sed -i "s/http:\/\/iso.linuxquestions.org\/download\/504\/1819\/http\/gd4.tuwien.ac.at\/dsl-4.4.10.iso/http:\/\/nfs1.lab.vmops.com\/isos_32bit\/dsl-4.4.10.iso/g" $file
+		sed -i "s/fr3sca/$HV_PASSWD/g" $file
+	fi
+done
+
+#Python version check
+version_tuple=$(python -c 'import sys; print(sys.version_info[:2])')
+if [[ $version_tuple == "(2, 7)" ]]
+then
+    echo "Done"
+else
+    echo "WARN: Python version 2.7 not detected on system."
+fi
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/sample/UserCloudAPIExecutor.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/sample/UserCloudAPIExecutor.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/sample/UserCloudAPIExecutor.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/sample/UserCloudAPIExecutor.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,188 @@
+// 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.sample;
+
+import java.io.FileInputStream;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+
+/**
+ *
+ *
+ *
+ *
+ *
+ * 
+ * 
+ * 
+ * 
+ */
+
+/**
+ * Sample CloudStack Management User API Executor.
+ * 
+ * Prerequisites: - Edit usercloud.properties to include your host, apiUrl, apiKey, and secretKey - Use ./executeUserAPI.sh to
+ * execute this test class
+ * 
+ * 
+ */
+public class UserCloudAPIExecutor {
+    public static void main(String[] args) {
+        // Host
+        String host = null;
+
+        // Fully qualified URL with http(s)://host:port
+        String apiUrl = null;
+
+        // ApiKey and secretKey as given by your CloudStack vendor
+        String apiKey = null;
+        String secretKey = null;
+
+        try {
+            Properties prop = new Properties();
+            prop.load(new FileInputStream("usercloud.properties"));
+
+            // host
+            host = prop.getProperty("host");
+            if (host == null) {
+                System.out.println("Please specify a valid host in the format of http(s)://:/client/api in your usercloud.properties file.");
+            }
+
+            // apiUrl
+            apiUrl = prop.getProperty("apiUrl");
+            if (apiUrl == null) {
+                System.out.println("Please specify a valid API URL in the format of command=&param1=&param2=... in your usercloud.properties file.");
+            }
+
+            // apiKey
+            apiKey = prop.getProperty("apiKey");
+            if (apiKey == null) {
+                System.out.println("Please specify your API Key as provided by your CloudStack vendor in your usercloud.properties file.");
+            }
+
+            // secretKey
+            secretKey = prop.getProperty("secretKey");
+            if (secretKey == null) {
+                System.out.println("Please specify your secret Key as provided by your CloudStack vendor in your usercloud.properties file.");
+            }
+
+            if (apiUrl == null || apiKey == null || secretKey == null) {
+                return;
+            }
+
+            System.out.println("Constructing API call to host = '" + host + "' with API command = '" + apiUrl + "' using apiKey = '" + apiKey + "' and secretKey = '" + secretKey + "'");
+
+            // Step 1: Make sure your APIKey is URL encoded
+            String encodedApiKey = URLEncoder.encode(apiKey, "UTF-8");
+
+            // Step 2: URL encode each parameter value, then sort the parameters and apiKey in
+            // alphabetical order, and then toLowerCase all the parameters, parameter values and apiKey.
+            // Please note that if any parameters with a '&' as a value will cause this test client to fail since we are using
+            // '&' to delimit
+            // the string
+            List<String> sortedParams = new ArrayList<String>();
+            sortedParams.add("apikey=" + encodedApiKey.toLowerCase());
+            StringTokenizer st = new StringTokenizer(apiUrl, "&");
+            String url = null;
+            boolean first = true;
+            while (st.hasMoreTokens()) {
+                String paramValue = st.nextToken();
+                String param = paramValue.substring(0, paramValue.indexOf("="));
+                String value = URLEncoder.encode(paramValue.substring(paramValue.indexOf("=") + 1, paramValue.length()), "UTF-8");
+                if (first) {
+                    url = param + "=" + value;
+                    first = false;
+                } else {
+                    url = url + "&" + param + "=" + value;
+                }
+                sortedParams.add(param.toLowerCase() + "=" + value.toLowerCase());
+            }
+            Collections.sort(sortedParams);
+
+            System.out.println("Sorted Parameters: " + sortedParams);
+
+            // Step 3: Construct the sorted URL and sign and URL encode the sorted URL with your secret key
+            String sortedUrl = null;
+            first = true;
+            for (String param : sortedParams) {
+                if (first) {
+                    sortedUrl = param;
+                    first = false;
+                } else {
+                    sortedUrl = sortedUrl + "&" + param;
+                }
+            }
+            System.out.println("sorted URL : " + sortedUrl);
+            String encodedSignature = signRequest(sortedUrl, secretKey);
+
+            // Step 4: Construct the final URL we want to send to the CloudStack Management Server
+            // Final result should look like:
+            // http(s)://://client/api?&apiKey=&signature=
+            String finalUrl = host + "?" + url + "&apiKey=" + apiKey + "&signature=" + encodedSignature;
+            System.out.println("final URL : " + finalUrl);
+
+            // Step 5: Perform a HTTP GET on this URL to execute the command
+            HttpClient client = new HttpClient();
+            HttpMethod method = new GetMethod(finalUrl);
+            int responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                // SUCCESS!
+                System.out.println("Successfully executed command");
+            } else {
+                // FAILED!
+                System.out.println("Unable to execute command with response code: " + responseCode);
+            }
+
+        } catch (Throwable t) {
+            System.out.println(t);
+        }
+    }
+
+    /**
+     * 1. Signs a string with a secret key using SHA-1 2. Base64 encode the result 3. URL encode the final result
+     * 
+     * @param request
+     * @param key
+     * @return
+     */
+    public static String signRequest(String request, String key) {
+        try {
+            Mac mac = Mac.getInstance("HmacSHA1");
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");
+            mac.init(keySpec);
+            mac.update(request.getBytes());
+            byte[] encryptedBytes = mac.doFinal();
+            return URLEncoder.encode(Base64.encodeBase64String(encryptedBytes), "UTF-8");
+        } catch (Exception ex) {
+            System.out.println(ex);
+        }
+        return null;
+    }
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/BuildGuestNetwork.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/BuildGuestNetwork.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/BuildGuestNetwork.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/BuildGuestNetwork.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,128 @@
+// 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.test.longrun;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+
+import org.apache.log4j.Logger;
+
+
+public class BuildGuestNetwork {
+
+	public static final Logger s_logger= Logger.getLogger(BuildGuestNetwork.class.getClass());
+	private static final int _apiPort=8096;
+	private static final int _developerPort=8080;
+	private static final String _apiUrl = "/client/api";
+	private static int numVM=1;
+	private static long zoneId=-1L; 
+	private static long templateId=3;
+	private static long serviceOfferingId=1;
+	
+
+
+		public static void main (String[] args){
+			
+			List<String> argsList = Arrays.asList(args);
+			Iterator<String> iter = argsList.iterator();
+			String host = "http://localhost";
+			int numThreads = 1;
+			
+			while (iter.hasNext()){
+				String arg = iter.next();
+				if (arg.equals("-h")){
+					host="http://"+iter.next();
+				}
+				if (arg.equals("-t")){
+					numThreads=Integer.parseInt(iter.next());
+				}	
+				if (arg.equals("-n")){
+					numVM=Integer.parseInt(iter.next());
+				}
+				if (arg.equals("-z")){
+					zoneId=Integer.parseInt(iter.next());
+				}
+				
+				if (arg.equals("-e")){
+					templateId=Integer.parseInt(iter.next());
+				}
+				
+				if (arg.equals("-s")){
+					serviceOfferingId=Integer.parseInt(iter.next());
+				}
+			}
+			
+			final String server = host + ":" + _apiPort + "/";
+			final String developerServer = host + ":" + _developerPort + _apiUrl;
+			s_logger.info("Starting test in "+numThreads+" thread(s). Each thread is launching "+numVM+" VMs");
+			
+			for (int i=0; i<numThreads; i++){
+				new Thread(new Runnable() {
+					public  void run() {
+						try{
+
+						String username = null;
+						String singlePrivateIp=null;
+						Random ran = new Random();
+						username = Math.abs(ran.nextInt())+ "-user";
+						
+						//Create User
+						User myUser = new User(username,username, server, developerServer);
+						try{
+							myUser.launchUser();
+							myUser.registerUser();
+						}catch (Exception e){
+							s_logger.warn("Error code: ", e);
+						}
+						
+						if (myUser.getUserId()!=null){
+							s_logger.info("User "+myUser.getUserName()+" was created successfully, starting VM creation");
+							//create VMs for the user
+							for (int i=0; i<numVM; i++){
+								//Create a new VM, add it to the list of user's VMs
+								VirtualMachine myVM = new VirtualMachine(myUser.getUserId());
+								myVM.deployVM(zoneId, serviceOfferingId, templateId, myUser.getDeveloperServer(), myUser.getApiKey(), myUser.getSecretKey());
+								myUser.getVirtualMachines().add(myVM);
+								singlePrivateIp=myVM.getPrivateIp();
+								
+								if (singlePrivateIp!=null){
+									s_logger.info("VM with private Ip "+singlePrivateIp+" was successfully created");
+								}
+								else{
+									s_logger.info("Problems with VM creation for a user"+myUser.getUserName());
+									s_logger.info("Deployment failed");
+									break;
+								}			
+							}
+							
+							s_logger.info("Deployment done..."+numVM+" VMs were created.");
+						}
+
+						}catch (Exception e){
+							s_logger.error(e);
+						}
+					}
+				}).start();
+		
+			}
+		}
+	
+	
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/guestNetwork.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/guestNetwork.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/guestNetwork.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/guestNetwork.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,107 @@
+// 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.test.longrun;
+import java.util.ArrayList;
+import java.util.Random;
+import org.apache.log4j.Logger;
+import org.apache.log4j.NDC;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.Session;
+
+
+public class guestNetwork implements Runnable{
+	public static final Logger s_logger= Logger.getLogger(guestNetwork.class.getClass());
+	
+	private String publicIp;
+	private ArrayList<VirtualMachine> virtualMachines;
+	private int retryNum;
+	
+	public guestNetwork(String publicIp, int retryNum){
+		this.publicIp=publicIp;
+		this.retryNum=retryNum;	
+	}
+	
+	public ArrayList<VirtualMachine> getVirtualMachines() {
+		return virtualMachines;
+	}
+
+	public void setVirtualMachines(ArrayList<VirtualMachine> virtualMachines) {
+		this.virtualMachines = virtualMachines;
+	}
+
+	public void run(){
+		NDC.push("Following thread has started"+Thread.currentThread().getName());
+		int retry = 0;
+					
+				//Start copying files between machines in the network
+				s_logger.info("The size of the array is " + this.virtualMachines.size());
+				while (true) {
+					try {
+					if (retry > 0) {
+						s_logger.info("Retry attempt : " + retry
+								+ " ...sleeping 120 seconds before next attempt");
+						Thread.sleep(120000);
+					}
+					for (VirtualMachine vm: this.virtualMachines ){
+						
+							s_logger.info("Attempting to SSH into linux host " + this.publicIp
+									+ " with retry attempt: " + retry);
+							Connection conn = new Connection(this.publicIp);
+							conn.connect(null, 600000, 600000);
+
+							s_logger.info("SSHed successfully into linux host " + this.publicIp);
+
+							boolean isAuthenticated = conn.authenticateWithPassword("root",
+									"password");
+
+							if (isAuthenticated == false) {
+								s_logger.info("Authentication failed");
+							}
+							//execute copy command
+							Session sess = conn.openSession();
+							String fileName;
+							Random ran = new Random();
+							fileName=Math.abs(ran.nextInt())+"-file";
+							String copyCommand = new String ("./scpScript "+vm.getPrivateIp()+" "+fileName);
+							s_logger.info("Executing " + copyCommand);
+							sess.execCommand(copyCommand);
+							Thread.sleep(120000);
+							sess.close();
+							
+							//execute wget command
+							sess = conn.openSession();
+							String downloadCommand = new String ("wget http://172.16.0.220/scripts/checkDiskSpace.sh; chmod +x *sh; ./checkDiskSpace.sh; rm -rf checkDiskSpace.sh");
+							s_logger.info("Executing " + downloadCommand);
+							sess.execCommand(downloadCommand);
+							Thread.sleep(120000);
+							sess.close();
+							
+							//close the connection
+							conn.close();
+						}
+					}catch (Exception ex) {
+							s_logger.error(ex);
+							retry++;
+							if (retry == retryNum) {
+								s_logger.info("Performance Guest Network test failed with error "
+										+ ex.getMessage()) ;
+							}
+					}		
+					}
+
+	}	
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/PerformanceWithAPI.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/PerformanceWithAPI.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/PerformanceWithAPI.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/PerformanceWithAPI.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,209 @@
+// 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.test.longrun;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Random;
+
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+
+import com.cloud.test.stress.TestClientWithAPI;
+
+
+
+public class PerformanceWithAPI {
+	
+public static final Logger s_logger= Logger.getLogger(PerformanceWithAPI.class.getClass());
+private static final int _retry=10;
+private static final int _apiPort=8096;
+private static int numVM=2;
+private static final long _zoneId=-1L;
+private static final long _templateId=3;
+private static final long _serviceOfferingId=1;
+private static final String _apiUrl = "/client/api";
+private static final int _developerPort=8080;
+
+
+
+	public static void main (String[] args){
+		
+		List<String> argsList = Arrays.asList(args);
+		Iterator<String> iter = argsList.iterator();
+		String host = "http://localhost";
+		int numThreads = 1;
+		
+		while (iter.hasNext()){
+			String arg = iter.next();
+			if (arg.equals("-h")){
+				host="http://"+iter.next();
+			}
+			if (arg.equals("-t")){
+				numThreads=Integer.parseInt(iter.next());
+			}	
+			if (arg.equals("-n")){
+				numVM=Integer.parseInt(iter.next());
+			}
+		}
+		
+		final String server = host + ":" + _apiPort + "/";
+		final String developerServer = host + ":" + _developerPort + _apiUrl;
+		
+		s_logger.info("Starting test in "+numThreads+" thread(s). Each thread is launching "+numVM+" VMs");
+		
+		for (int i=0; i<numThreads; i++){
+			new Thread(new Runnable() {
+				public  void run() {
+					try{
+
+					String username = null;
+					String singlePrivateIp=null;
+					String singlePublicIp=null;
+					Random ran = new Random();
+					username = Math.abs(ran.nextInt())+ "-user";
+					
+					//Create User
+					User myUser = new User(username,username, server, developerServer);
+					try{
+						myUser.launchUser();
+						myUser.registerUser();
+					}catch (Exception e){
+						s_logger.warn("Error code: ", e);
+					}
+					
+					if (myUser.getUserId()!=null){
+						s_logger.info("User "+myUser.getUserName()+" was created successfully, starting VM creation");
+						//create VMs for the user
+						for (int i=0; i<numVM; i++){
+							//Create a new VM, add it to the list of user's VMs
+							VirtualMachine myVM = new VirtualMachine(myUser.getUserId());
+							myVM.deployVM(_zoneId, _serviceOfferingId, _templateId, myUser.getDeveloperServer(), myUser.getApiKey(), myUser.getSecretKey());
+							myUser.getVirtualMachines().add(myVM);
+							singlePrivateIp=myVM.getPrivateIp();
+							
+							if (singlePrivateIp!=null){
+								s_logger.info("VM with private Ip "+singlePrivateIp+" was successfully created");
+							}
+							else{
+								s_logger.info("Problems with VM creation for a user"+myUser.getUserName());
+								break;
+							}
+							
+							
+						//get public IP address for the User				
+							myUser.retrievePublicIp(_zoneId);
+							singlePublicIp=myUser.getPublicIp().get(myUser.getPublicIp().size()-1);
+							if (singlePublicIp!=null){
+								s_logger.info("Successfully got public Ip "+singlePublicIp+" for user "+myUser.getUserName());
+							}
+							else{
+								s_logger.info("Problems with getting public Ip address for user"+myUser.getUserName());
+								break;
+							}
+							
+							
+						//create ForwardProxy rules for user's VMs
+							int responseCode = CreateForwardingRule(myUser, singlePrivateIp, singlePublicIp, "22", "22");
+							if (responseCode==500)
+								break;
+						}
+						
+						s_logger.info("Deployment successful..."+numVM+" VMs were created. Waiting for 5 min before performance test");
+						Thread.sleep(300000L); // Wait 
+						
+						
+						//Start performance test for the user
+						s_logger.info("Starting performance test for Guest network that has "+myUser.getPublicIp().size()+" public IP addresses");		
+						for (int j=0; j<myUser.getPublicIp().size(); j++){
+							s_logger.info("Starting test for user which has "+myUser.getVirtualMachines().size()+" vms. Public IP for the user is "+myUser.getPublicIp().get(j)+" , number of retries is "+_retry+" , private IP address of the machine is"+myUser.getVirtualMachines().get(j).getPrivateIp());
+							guestNetwork myNetwork =new guestNetwork(myUser.getPublicIp().get(j), _retry);
+							myNetwork.setVirtualMachines(myUser.getVirtualMachines());
+							new Thread(myNetwork).start();
+						}
+						
+					}
+					}catch (Exception e){
+						s_logger.error(e);
+					}
+				}
+			}).start();
+	
+		}
+	}
+
+	private static int CreateForwardingRule(User myUser, String privateIp, String publicIp, String publicPort, String privatePort) throws IOException{
+		String encodedPrivateIp=URLEncoder.encode(""+privateIp, "UTF-8");
+		String encodedPublicIp=URLEncoder.encode(""+publicIp, "UTF-8");
+		String encodedPrivatePort=URLEncoder.encode(""+privatePort, "UTF-8");
+		String encodedPublicPort=URLEncoder.encode(""+publicPort, "UTF-8");
+		String encodedApiKey = URLEncoder.encode(myUser.getApiKey(), "UTF-8");
+		int responseCode=500;
+		
+		
+		String requestToSign = "apiKey=" + encodedApiKey
+		+ "&command=createOrUpdateIpForwardingRule&privateIp="
+		+ encodedPrivateIp + "&privatePort=" + encodedPrivatePort
+		+ "&protocol=tcp&publicIp="
+		+ encodedPublicIp + "&publicPort="+encodedPublicPort;
+		
+		requestToSign = requestToSign.toLowerCase();
+		s_logger.info("Request to sign is "+requestToSign);
+		
+		String signature = TestClientWithAPI.signRequest(requestToSign, myUser.getSecretKey());
+		String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+		String url = myUser.getDeveloperServer() + "?command=createOrUpdateIpForwardingRule"
+		+ "&publicIp=" + encodedPublicIp
+		+ "&publicPort="+encodedPublicPort+"&privateIp=" + encodedPrivateIp
+		+ "&privatePort=" + encodedPrivatePort + "&protocol=tcp&apiKey=" + encodedApiKey
+		+ "&signature=" + encodedSignature;
+		
+		s_logger.info("Trying to create IP forwarding rule: "+url);
+		HttpClient client = new HttpClient();
+		HttpMethod method = new GetMethod(url);
+		responseCode = client.executeMethod(method);
+		s_logger.info("create ip forwarding rule response code: "
+				+ responseCode);
+		if (responseCode == 200) {
+			s_logger.info("The rule is created successfully");
+		} else if (responseCode == 500) {
+			InputStream is = method.getResponseBodyAsStream();
+			Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
+					new String[] { "errorCode", "description" });
+			s_logger
+					.error("create ip forwarding rule (linux) test failed with errorCode: "
+							+ errorInfo.get("errorCode")
+							+ " and description: "
+							+ errorInfo.get("description"));
+		} else {
+			s_logger.error("internal error processing request: "
+					+ method.getStatusText());
+		}
+		return responseCode;
+	}
+	
+
+}
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/User.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/User.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/User.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/User.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,238 @@
+// 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.test.longrun;
+import java.util.ArrayList;
+import java.util.Map;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+
+import com.cloud.test.stress.TestClientWithAPI;
+
+
+
+public class User {
+	public static final Logger s_logger= Logger.getLogger(User.class.getClass());
+	
+	private ArrayList<VirtualMachine> virtualMachines;
+	private ArrayList<String> publicIp;
+	private String server;
+	private String developerServer;
+	private String userName;
+	private String userId;
+	private String apiKey;
+	private String secretKey;
+	private String password;
+	private String encryptedPassword;
+	
+
+	public User(String userName, String password, String server, String developerServer)
+	{
+		this.server=server;
+		this.developerServer=developerServer;
+		this.userName=userName;
+		this.password=password;
+		this.virtualMachines = new ArrayList<VirtualMachine>();
+		this.publicIp = new ArrayList<String>();
+	}
+	
+	public ArrayList<VirtualMachine> getVirtualMachines() {
+		return virtualMachines;
+	}
+
+
+	public void setVirtualMachines(ArrayList<VirtualMachine> virtualMachines) {
+		this.virtualMachines = virtualMachines;
+	}
+
+
+	public String getUserId() {
+		return userId;
+	}
+
+
+	public void setUserId(String userId) {
+		this.userId = userId;
+	}
+	
+
+	public ArrayList<String> getPublicIp() {
+		return publicIp;
+	}
+
+
+	public void setPublicIp(ArrayList<String> publicIp) {
+		this.publicIp = publicIp;
+	}
+
+
+
+	public String getServer() {
+		return server;
+	}
+
+
+
+	public void setServer(String server) {
+		this.server = server;
+	}
+
+
+
+	public String getUserName() {
+		return userName;
+	}
+
+
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+
+	public String getApiKey() {
+		return apiKey;
+	}
+
+	public void setApiKey(String apiKey) {
+		this.apiKey = apiKey;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+	
+	public String getSecretKey() {
+		return secretKey;
+	}
+
+	public void setSecretKey(String secretKey) {
+		this.secretKey = secretKey;
+	}
+	
+	
+
+	public String getDeveloperServer() {
+		return developerServer;
+	}
+
+	public void setDeveloperServer(String developerServer) {
+		this.developerServer = developerServer;
+	}
+
+	public void launchUser() throws IOException {
+		String encodedUsername = URLEncoder.encode(this.getUserName(), "UTF-8");
+		this.encryptedPassword=TestClientWithAPI.createMD5Password(this.getPassword());
+		String encodedPassword = URLEncoder.encode(this.encryptedPassword, "UTF-8");
+		String url = this.server + "?command=createUser&username=" + encodedUsername
+				+ "&password=" + encodedPassword
+				+ "&firstname=Test&lastname=Test&email=alena@vmops.com&domainId=1";
+		String userIdStr=null;
+		HttpClient client = new HttpClient();
+		HttpMethod method = new GetMethod(url);
+		int responseCode = client.executeMethod(method);
+
+		if (responseCode == 200) {
+			InputStream is = method.getResponseBodyAsStream();
+			Map<String, String> userIdValues = TestClientWithAPI.getSingleValueFromXML(is,
+					new String[] { "id" });
+			userIdStr = userIdValues.get("id");
+			if ((userIdStr != null) && (Long.parseLong(userIdStr)!=-1)) {
+				this.setUserId(userIdStr);
+			}
+		}
+	}
+	
+	public void retrievePublicIp(long zoneId) throws IOException{
+		
+		String encodedApiKey = URLEncoder.encode(this.apiKey, "UTF-8");
+		String encodedZoneId=URLEncoder.encode(""+zoneId,"UTF-8");
+		String requestToSign = "apiKey=" + encodedApiKey
+				+ "&command=associateIpAddress" + "&zoneId="+encodedZoneId;
+		requestToSign = requestToSign.toLowerCase();
+		String signature = TestClientWithAPI.signRequest(requestToSign, this.secretKey);
+		String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+		String url = this.developerServer + "?command=associateIpAddress" + "&apiKey="
+				+ encodedApiKey + "&zoneId="+encodedZoneId+"&signature="
+				+ encodedSignature;
+
+		HttpClient client = new HttpClient();
+		HttpMethod method = new GetMethod(url);
+		int responseCode=client.executeMethod(method);
+		if (responseCode == 200) {
+			InputStream is = method.getResponseBodyAsStream();
+			Map<String, String> values = TestClientWithAPI.getSingleValueFromXML(is,
+					new String[] { "ipaddress" });
+			this.getPublicIp().add(values.get("ipaddress"));
+			s_logger.info("Ip address is " + values.get("ipaddress"));
+		} else if (responseCode == 500) {
+			InputStream is = method.getResponseBodyAsStream();
+			Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
+					new String[] { "errorcode", "description" });
+			s_logger.error("associate ip test failed with errorCode: "
+					+ errorInfo.get("errorCode") + " and description: "
+					+ errorInfo.get("description"));
+		} else {
+			s_logger.error("internal error processing request: "
+					+ method.getStatusText());
+		}
+		
+	}
+	
+		public void registerUser()throws HttpException, IOException{
+	 
+			String encodedUsername = URLEncoder.encode(this.userName, "UTF-8");
+			String encodedPassword = URLEncoder.encode(this.password, "UTF-8");
+			String url = server + "?command=register&username=" + encodedUsername
+					+ "&domainid=1";
+			s_logger.info("registering: " + this.userName+" with url "+url);
+			HttpClient client = new HttpClient();
+			HttpMethod method = new GetMethod(url);
+			int responseCode = client.executeMethod(method);
+			if (responseCode == 200) {
+				InputStream is = method.getResponseBodyAsStream();
+				Map<String, String> requestKeyValues = TestClientWithAPI.getSingleValueFromXML(is,
+						new String[] { "apikey", "secretkey" });
+				this.setApiKey(requestKeyValues.get("apikey"));
+				this.setSecretKey(requestKeyValues.get("secretkey"));
+			} else if (responseCode == 500) {
+				InputStream is = method.getResponseBodyAsStream();
+				Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
+						new String[] { "errorcode", "description" });
+				s_logger.error("registration failed with errorCode: "
+						+ errorInfo.get("errorCode") + " and description: "
+						+ errorInfo.get("description"));
+			} else {
+				s_logger.error("internal error processing request: "
+						+ method.getStatusText());
+			}
+		}
+		
+}
+
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/VirtualMachine.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/VirtualMachine.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/longrun/VirtualMachine.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/longrun/VirtualMachine.java	2012-09-09 00:46:31.000000000 -0400
@@ -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.test.longrun;
+
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.util.Map;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+
+import com.cloud.test.stress.TestClientWithAPI;
+
+
+import java.io.IOException;
+
+
+public class VirtualMachine {
+	public static final Logger s_logger= Logger.getLogger(VirtualMachine.class.getClass());
+	
+	private String privateIp;
+	private String userId;
+	
+	
+	public VirtualMachine(String userId){
+		this.userId=userId;
+	}
+	
+	
+	public String getPrivateIp() {
+		return privateIp;
+	}
+
+
+	public void setPrivateIp(String privateIp) {
+		this.privateIp = privateIp;
+	}
+
+
+	public String getUserId() {
+		return userId;
+	}
+
+
+	public void setUserId(String userId) {
+		this.userId = userId;
+	}
+
+
+	public void deployVM(long zoneId, long serviceOfferingId, long templateId, String server, String apiKey, String secretKey) throws IOException{
+
+		String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
+		String encodedServiceOfferingId = URLEncoder.encode(""
+				+ serviceOfferingId, "UTF-8");
+		String encodedTemplateId = URLEncoder.encode("" + templateId,
+		"UTF-8");
+		String encodedApiKey=URLEncoder.encode(apiKey, "UTF-8");
+		String requestToSign = "apiKey=" + encodedApiKey
+		+ "&command=deployVirtualMachine&serviceOfferingId="
+		+ encodedServiceOfferingId + "&templateId="
+		+ encodedTemplateId + "&zoneId=" + encodedZoneId;
+		
+		requestToSign = requestToSign.toLowerCase();
+		String signature = TestClientWithAPI.signRequest(requestToSign, secretKey);
+		String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+		String url = server + "?command=deployVirtualMachine"
+		+ "&zoneId=" + encodedZoneId + "&serviceOfferingId="
+		+ encodedServiceOfferingId + "&templateId="
+		+ encodedTemplateId + "&apiKey=" + encodedApiKey
+		+ "&signature=" + encodedSignature;
+		
+		s_logger.info("Sending this request to deploy a VM: "+url);
+		HttpClient client = new HttpClient();
+		HttpMethod method = new GetMethod(url);
+		int responseCode = client.executeMethod(method);
+		s_logger.info("deploy linux vm response code: " + responseCode);
+		if (responseCode == 200) {
+			InputStream is = method.getResponseBodyAsStream();
+			Map<String, String> values = TestClientWithAPI.getSingleValueFromXML(is,
+					new String[] { "id", "ipaddress" });
+			long linuxVMId = Long.parseLong(values.get("id"));
+			s_logger.info("got linux virtual machine id: " + linuxVMId);
+			this.setPrivateIp(values.get("ipaddress"));
+
+		} else if (responseCode == 500) {
+			InputStream is = method.getResponseBodyAsStream();
+			Map<String, String> errorInfo = TestClientWithAPI.getSingleValueFromXML(is,
+					new String[] { "errorcode", "description" });
+			s_logger.error("deploy linux vm test failed with errorCode: "
+					+ errorInfo.get("errorCode") + " and description: "
+					+ errorInfo.get("description"));
+		} else {
+			s_logger.error("internal error processing request: "
+					+ method.getStatusText());
+		}
+	}
+	
+		
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/ApiCommand.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/ApiCommand.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/ApiCommand.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/ApiCommand.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,858 @@
+// 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.test.regression;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.utils.UtilsForTest;
+
+public class ApiCommand {
+    public static final Logger s_logger = Logger.getLogger(ApiCommand.class.getName());
+
+    public static enum CommandType {
+        HTTP, MYSQL, SCRIPT;
+    }
+
+    public static enum ResponseType {
+        ERROR, EMPTY;
+    }
+
+    private Element xmlCommand;
+    private String commandName;
+    private String testCaseInfo;
+    private boolean isUserCommand;
+    private boolean isAsync = false;
+    private CommandType commandType;
+    private ResponseType responseType;
+
+    private TreeMap<String, String> urlParam;
+    private HashMap<String, String> verifyParam = new HashMap<String, String>();;
+    private HashMap<String, String> setParam = new HashMap<String, String>();;
+    private int responseCode;
+    private Element responseBody;
+
+    private String command;
+    private String host;
+    private boolean list;
+    private Element listName;
+    private Element listId;
+    private boolean required = false;
+    private ResultSet result;
+
+    public ApiCommand(Element fstElmnt, HashMap<String, String> param, HashMap<String, String> commands) {
+        this.setXmlCommand(fstElmnt);
+        this.setCommandName();
+        this.setResponseType();
+        this.setUserCommand();
+        this.setCommandType();
+        this.setTestCaseInfo();
+        this.setUrlParam(param);
+        this.setVerifyParam(param);
+        this.setHost("http://" + param.get("hostip"));
+        this.setCommand(param);
+        String async = commands.get(this.getName());
+        if (async != null && async.equals("yes")) {
+            this.isAsync = true;
+
+        }
+    }
+
+    public Element getXmlCommand() {
+        return xmlCommand;
+    }
+
+    public void setXmlCommand(Element xmlCommand) {
+        this.xmlCommand = xmlCommand;
+    }
+
+    // ================FOLLOWING METHODS USE INPUT XML FILE=======================//
+    public void setCommandName() {
+        NodeList commandName = this.xmlCommand.getElementsByTagName("name");
+        Element commandElmnt = (Element) commandName.item(0);
+        NodeList commandNm = commandElmnt.getChildNodes();
+        this.commandName = (((Node) commandNm.item(0)).getNodeValue());
+    }
+
+    public String getName() {
+        return commandName;
+    }
+
+    public void setTestCaseInfo() {
+        this.testCaseInfo = getElementByName("testcase");
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public void setResponseType() {
+        boolean result = verifyTagValue("error", "true");
+        if (result) {
+            this.responseType = ResponseType.ERROR;
+            return;
+        }
+        result = verifyTagValue("empty", "true");
+        if (result) {
+            this.responseType = ResponseType.EMPTY;
+        }
+    }
+
+    public void setResponseType(ResponseType responseType) {
+        this.responseType = responseType;
+    }
+
+    public ResponseType getResponseType() {
+        return responseType;
+    }
+
+    public void setUserCommand() {
+        boolean result = verifyTagValue("usercommand", "true");
+        this.isUserCommand = result;
+    }
+
+    public void setCommandType() {
+        boolean result = verifyTagValue("mysql", "true");
+        if (result) {
+            this.commandType = CommandType.MYSQL;
+            return;
+        }
+        result = verifyTagValue("script", "true");
+        if (result) {
+            this.commandType = CommandType.SCRIPT;
+            return;
+        }
+        this.commandType = CommandType.HTTP;
+    }
+
+    public CommandType getCommandType() {
+        return commandType;
+    }
+
+    public String getTestCaseInfo() {
+        return testCaseInfo;
+    }
+
+    public Boolean getRequired() {
+        return required;
+    }
+
+    public void setUrlParam(HashMap<String, String> param) {
+        this.urlParam = new TreeMap<String, String>();
+        NodeList parameterLst = this.xmlCommand.getElementsByTagName("parameters");
+        if (parameterLst != null) {
+            for (int j = 0; j < parameterLst.getLength(); j++) {
+                Element parameterElement = (Element) parameterLst.item(j);
+                NodeList itemLst = parameterElement.getElementsByTagName("item");
+                for (int k = 0; k < itemLst.getLength(); k++) {
+                    Node item = itemLst.item(k);
+                    if (item.getNodeType() == Node.ELEMENT_NODE) {
+                        Element itemElement = (Element) item;
+                        NodeList itemName = itemElement.getElementsByTagName("name");
+                        Element itemNameElement = (Element) itemName.item(0);
+
+                        // get value
+                        Element itemValueElement = null;
+                        if ((itemElement.getElementsByTagName("value") != null) && (itemElement.getElementsByTagName("value").getLength() != 0)) {
+                            NodeList itemValue = itemElement.getElementsByTagName("value");
+                            itemValueElement = (Element) itemValue.item(0);
+                        }
+
+                        Element itemParamElement = null;
+                        // getparam
+                        if ((itemElement.getElementsByTagName("param") != null) && (itemElement.getElementsByTagName("param").getLength() != 0)) {
+                            NodeList itemParam = itemElement.getElementsByTagName("param");
+                            itemParamElement = (Element) itemParam.item(0);
+                        }
+
+                        if ((itemElement.getAttribute("getparam").equals("true")) && (itemParamElement != null)) {
+                            this.urlParam.put(itemNameElement.getTextContent(), param.get(itemParamElement.getTextContent()));
+                        }
+                        else if (itemValueElement != null) {
+                            this.urlParam.put(itemNameElement.getTextContent(), itemValueElement.getTextContent());
+                        } else if (itemElement.getAttribute("random").equals("true")) {
+                            Random ran = new Random();
+                            String randomString = Math.abs(ran.nextInt()) + "-randomName";
+                            this.urlParam.put(itemNameElement.getTextContent(), randomString);
+                            if ((itemElement.getAttribute("setparam").equals("true")) && (itemParamElement != null)) {
+                                param.put(itemParamElement.getTextContent(), randomString);
+                            }
+                        } else if (itemElement.getAttribute("randomnumber").equals("true")) {
+                            Random ran = new Random();
+                            Integer randomNumber = (Integer) Math.abs(ran.nextInt(65535));
+                            this.urlParam.put(itemNameElement.getTextContent(), randomNumber.toString());
+                            if ((itemElement.getAttribute("setparam").equals("true")) && (itemParamElement != null)) {
+                                param.put(itemParamElement.getTextContent(), randomNumber.toString());
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    // Set command URL
+    public void setCommand(HashMap<String, String> param) {
+
+        if (this.getCommandType() == CommandType.SCRIPT) {
+            String temp = "bash xen/" + this.commandName;
+            Set<?> c = this.urlParam.entrySet();
+            Iterator<?> it = c.iterator();
+            while (it.hasNext()) {
+                Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                String key = (String) me.getKey();
+                String value = (String) me.getValue();
+                try {
+                    temp = temp + " -" + key + " " + value;
+                } catch (Exception ex) {
+                    s_logger.error("Unable to set parameter " + key + " for the command " + this.getName());
+                }
+            }
+            this.command = temp;
+        } else if (this.getCommandType() == CommandType.MYSQL) {
+            String temp = this.commandName + " where ";
+            Set<?> c = this.urlParam.entrySet();
+            Iterator<?> it = c.iterator();
+            while (it.hasNext()) {
+                Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                String key = (String) me.getKey();
+                String value = (String) me.getValue();
+                try {
+                    temp = temp + key + "=" + value;
+                } catch (Exception ex) {
+                    s_logger.error("Unable to set parameter " + key + " for the command " + this.getName());
+                }
+            }
+            this.command = temp;
+            s_logger.info("The command is " + this.command);
+
+        } else {
+            if ((param.get("apikey") == null) || (param.get("secretkey") == null) || (this.isUserCommand == false)) {
+                String temp = this.host + ":8096/?command=" + this.commandName;
+                Set<?> c = this.urlParam.entrySet();
+                Iterator<?> it = c.iterator();
+                while (it.hasNext()) {
+                    Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                    String key = (String) me.getKey();
+                    String value = (String) me.getValue();
+                    try {
+                        temp = temp + "&" + key + "=" + URLEncoder.encode(value, "UTF-8");
+                    } catch (Exception ex) {
+                        s_logger.error("Unable to set parameter " + key + " for the command " + this.getName());
+                    }
+                }
+                this.command = temp;
+            }
+            else if (isUserCommand == true) {
+                String apiKey = param.get("apikey");
+                String secretKey = param.get("secretkey");
+
+                String temp = "";
+                this.urlParam.put("apikey", apiKey);
+                this.urlParam.put("command", this.commandName);
+
+                // sort url hash map by key
+                Set<?> c = this.urlParam.entrySet();
+                Iterator<?> it = c.iterator();
+                while (it.hasNext()) {
+                    Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                    String key = (String) me.getKey();
+                    String value = (String) me.getValue();
+                    try {
+                        temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
+                    } catch (Exception ex) {
+                        s_logger.error("Unable to set parameter " + value + " for the command " + this.getName());
+                    }
+
+                }
+                temp = temp.substring(0, temp.length() - 1);
+                String requestToSign = temp.toLowerCase();
+                String signature = UtilsForTest.signRequest(requestToSign, secretKey);
+                String encodedSignature = "";
+                try {
+                    encodedSignature = URLEncoder.encode(signature, "UTF-8");
+                } catch (Exception ex) {
+                    s_logger.error(ex);
+                }
+                this.command = this.host + ":8080/client/api/?" + temp + "&signature=" + encodedSignature;
+            }
+        }
+    }
+
+    public void setVerifyParam(HashMap<String, String> param) {
+        NodeList returnLst = this.xmlCommand.getElementsByTagName("returnvalue");
+        if (returnLst != null) {
+            for (int m = 0; m < returnLst.getLength(); m++) {
+                Element returnElement = (Element) returnLst.item(m);
+                if (returnElement.getAttribute("list").equals("true")) {
+                    this.list = true;
+                    NodeList elementLst = returnElement.getElementsByTagName("element");
+                    this.listId = (Element) elementLst.item(0);
+                    NodeList elementName = returnElement.getElementsByTagName("name");
+                    this.listName = (Element) elementName.item(0);
+                }
+                else {
+                    this.list = false;
+                }
+
+                NodeList itemLst1 = returnElement.getElementsByTagName("item");
+                if (itemLst1 != null) {
+                    for (int n = 0; n < itemLst1.getLength(); n++) {
+                        Node item = itemLst1.item(n);
+                        if (item.getNodeType() == Node.ELEMENT_NODE) {
+                            Element itemElement = (Element) item;
+                            // get parameter name
+                            NodeList itemName = itemElement.getElementsByTagName("name");
+                            Element itemNameElement = (Element) itemName.item(0);
+
+                            // Get parameters for future use
+                            if (itemElement.getAttribute("setparam").equals("true")) {
+                                NodeList itemVariable = itemElement.getElementsByTagName("param");
+                                Element itemVariableElement = (Element) itemVariable.item(0);
+                                setParam.put(itemVariableElement.getTextContent(), itemNameElement.getTextContent());
+                                this.required = true;
+                            } else if (itemElement.getAttribute("getparam").equals("true")) {
+                                NodeList itemVariable = itemElement.getElementsByTagName("param");
+                                Element itemVariableElement = (Element) itemVariable.item(0);
+                                this.verifyParam.put(itemNameElement.getTextContent(), param.get(itemVariableElement.getTextContent()));
+                            } else if ((itemElement.getElementsByTagName("value") != null) && (itemElement.getElementsByTagName("value").getLength() != 0)) {
+                                NodeList itemVariable = itemElement.getElementsByTagName("value");
+                                Element itemVariableElement = (Element) itemVariable.item(0);
+                                this.verifyParam.put(itemNameElement.getTextContent(), itemVariableElement.getTextContent());
+                            } else {
+                                this.verifyParam.put(itemNameElement.getTextContent(), "no value");
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public int getResponseCode() {
+        return responseCode;
+    }
+
+    // Send api command to the server
+    public void sendCommand(HttpClient client, Connection conn) {
+        if (TestCaseEngine._printUrl == true)
+        {
+            s_logger.info("url is " + this.command);
+        }
+
+        if (this.getCommandType() == CommandType.SCRIPT) {
+            try {
+                s_logger.info("Executing command " + this.command);
+                Runtime rtime = Runtime.getRuntime();
+                Process child = rtime.exec(this.command);
+                Thread.sleep(10000);
+                int retCode = child.waitFor();
+                if (retCode != 0) {
+                    this.responseCode = retCode;
+                } else {
+                    this.responseCode = 200;
+                }
+
+            } catch (Exception ex) {
+                s_logger.error("Unable to execute a command " + this.command, ex);
+            }
+        } else if (this.getCommandType() == CommandType.MYSQL) {
+            try {
+                Statement stmt = conn.createStatement();
+                this.result = stmt.executeQuery(this.command);
+                this.responseCode = 200;
+            } catch (Exception ex) {
+                this.responseCode = 400;
+                s_logger.error("Unable to execute mysql query " + this.command, ex);
+            }
+        } else {
+            HttpMethod method = new GetMethod(this.command);
+            try {
+                this.responseCode = client.executeMethod(method);
+
+                if (this.responseCode == 200) {
+                    InputStream is = method.getResponseBodyAsStream();
+                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                    DocumentBuilder builder = factory.newDocumentBuilder();
+                    Document doc = builder.parse(is);
+                    doc.getDocumentElement().normalize();
+
+                    if (!(this.isAsync)) {
+                        this.responseBody = doc.getDocumentElement();
+                    }
+                    else {
+                        // get async job result
+                        Element jobTag = (Element) doc.getDocumentElement().getElementsByTagName("jobid").item(0);
+                        String jobId = jobTag.getTextContent();
+                        Element responseBodyAsyncEl = queryAsyncJobResult(jobId);
+                        if (responseBodyAsyncEl == null) {
+                            s_logger.error("Can't get a async result");
+                        }
+                        else {
+                            this.responseBody = responseBodyAsyncEl;
+                            // get status of the job
+                            Element jobStatusTag = (Element) responseBodyAsyncEl.getElementsByTagName("jobstatus").item(0);
+                            String jobStatus = jobStatusTag.getTextContent();
+                            if (!jobStatus.equals("1")) { // Need to modify with different error codes for jobAsync
+// results
+                                // set fake response code by now
+                                this.responseCode = 400;
+                            }
+                        }
+                    }
+                }
+
+                if (TestCaseEngine._printUrl == true) {
+                    s_logger.info("Response code is " + this.responseCode);
+                }
+            } catch (Exception ex) {
+                s_logger.error("Command " + command + " failed with exception " + ex.getMessage());
+            } finally {
+                method.releaseConnection();
+            }
+        }
+    }
+
+    // verify if response is empty (contains only root element)
+    public boolean isEmpty() {
+        boolean result = false;
+        if (!this.responseBody.hasChildNodes())
+            result = true;
+        return result;
+    }
+
+    // ================FOLLOWING METHODS USE RETURN XML FILE=======================//
+
+    public boolean setParam(HashMap<String, String> param) {
+        if ((this.responseBody == null) && (this.commandType == CommandType.HTTP)) {
+            s_logger.error("Response body is empty");
+            return false;
+        }
+        Boolean result = true;
+
+        if (this.getCommandType() == CommandType.MYSQL) {
+            Set<?> set = this.setParam.entrySet();
+            Iterator<?> it = set.iterator();
+            while (it.hasNext()) {
+                Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                String key = (String) me.getKey();
+                String value = (String) me.getValue();
+                try {
+                    String itemName = null;
+                    while (this.result.next()) {
+                        itemName = this.result.getString(value);
+                    }
+                    if (itemName != null) {
+                        param.put(key, itemName);
+                    }
+                    else {
+                        s_logger.error("Following return parameter is missing: " + value);
+                        result = false;
+                    }
+                } catch (Exception ex) {
+                    s_logger.error("Unable to set parameter " + value, ex);
+                }
+            }
+        } else if (this.getCommandType() == CommandType.HTTP) {
+            if (this.list == false) {
+                Set<?> set = this.setParam.entrySet();
+                Iterator<?> it = set.iterator();
+
+                while (it.hasNext()) {
+                    Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                    String key = (String) me.getKey();
+                    String value = (String) me.getValue();
+                    // set parameters needed for the future use
+                    NodeList itemName = this.responseBody.getElementsByTagName(value);
+                    if ((itemName != null) && (itemName.getLength() != 0)) {
+                        for (int i = 0; i < itemName.getLength(); i++) {
+                            Element itemNameElement = (Element) itemName.item(i);
+                            if (itemNameElement.getChildNodes().getLength() <= 1) {
+                                param.put(key, itemNameElement.getTextContent());
+                                break;
+                            }
+                        }
+                    }
+                    else {
+                        s_logger.error("Following return parameter is missing: " + value);
+                        result = false;
+                    }
+                }
+            } else {
+                Set<?> set = this.setParam.entrySet();
+                Iterator<?> it = set.iterator();
+                NodeList returnLst = this.responseBody.getElementsByTagName(this.listName.getTextContent());
+                Node requiredNode = returnLst.item(Integer.parseInt(this.listId.getTextContent()));
+
+                if (requiredNode.getNodeType() == Node.ELEMENT_NODE) {
+                    Element fstElmnt = (Element) requiredNode;
+
+                    while (it.hasNext()) {
+                        Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                        String key = (String) me.getKey();
+                        String value = (String) me.getValue();
+                        NodeList itemName = fstElmnt.getElementsByTagName(value);
+                        if ((itemName != null) && (itemName.getLength() != 0)) {
+                            Element itemNameElement = (Element) itemName.item(0);
+                            if (itemNameElement.getChildNodes().getLength() <= 1) {
+                                param.put(key, itemNameElement.getTextContent());
+                            }
+                        }
+                        else {
+                            s_logger.error("Following return parameter is missing: " + value);
+                            result = false;
+                        }
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    public String getUrl() {
+        return command;
+    }
+
+    public boolean verifyParam() {
+        boolean result = true;
+        if (this.getCommandType() == CommandType.HTTP) {
+            if (this.list == false) {
+                Set<?> set = verifyParam.entrySet();
+                Iterator<?> it = set.iterator();
+
+                while (it.hasNext()) {
+                    Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                    String key = (String) me.getKey();
+                    String value = (String) me.getValue();
+                    if (value == null) {
+                        s_logger.error("Parameter " + key + " is missing in the list of global parameters");
+                        return false;
+                    }
+
+                    NodeList itemName = this.responseBody.getElementsByTagName(key);
+                    if ((itemName.getLength() != 0) && (itemName != null)) {
+                        Element itemNameElement = (Element) itemName.item(0);
+                        if (itemNameElement.hasChildNodes()) {
+                            continue;
+                        }
+                        if (!(verifyParam.get(key).equals("no value")) && !(itemNameElement.getTextContent().equals(verifyParam.get(key)))) {
+                            s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " + itemNameElement.getTextContent());
+                            result = false;
+                        }
+                    } else {
+                        s_logger.error("Following xml element is missing in the response: " + key);
+                        result = false;
+                    }
+                }
+            }
+            // for multiple elements
+            else {
+                Set<?> set = verifyParam.entrySet();
+                Iterator<?> it = set.iterator();
+                // get list element specified by id
+                NodeList returnLst = this.responseBody.getElementsByTagName(this.listName.getTextContent());
+                Node requiredNode = returnLst.item(Integer.parseInt(this.listId.getTextContent()));
+
+                if (requiredNode.getNodeType() == Node.ELEMENT_NODE) {
+                    Element fstElmnt = (Element) requiredNode;
+
+                    while (it.hasNext()) {
+                        Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                        String key = (String) me.getKey();
+                        String value = (String) me.getValue();
+                        if (value == null) {
+                            s_logger.error("Parameter " + key + " is missing in the list of global parameters");
+                            return false;
+                        }
+                        NodeList itemName = fstElmnt.getElementsByTagName(key);
+                        if ((itemName.getLength() != 0) && (itemName != null)) {
+                            Element itemNameElement = (Element) itemName.item(0);
+                            if (!(verifyParam.get(key).equals("no value")) && !(itemNameElement.getTextContent().equals(verifyParam.get(key)))) {
+                                s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " + itemNameElement.getTextContent());
+                                result = false;
+                            }
+                        } else {
+                            s_logger.error("Following xml element is missing in the response: " + key);
+                            result = false;
+                        }
+                    }
+                }
+            }
+        } else if (this.getCommandType() == CommandType.MYSQL) {
+            Set<?> set = verifyParam.entrySet();
+            Iterator<?> it = set.iterator();
+
+            while (it.hasNext()) {
+                Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+                String key = (String) me.getKey();
+                String value = (String) me.getValue();
+                if (value == null) {
+                    s_logger.error("Parameter " + key + " is missing in the list of global parameters");
+                    return false;
+                }
+
+                String itemName = null;
+                try {
+                    while (this.result.next()) {
+                        itemName = this.result.getString(key);
+                    }
+                } catch (Exception ex) {
+                    s_logger.error("Unable to get element from result set " + key);
+                }
+
+                if (!(value.equals("no value")) && !(itemName.equals(verifyParam.get(key)))) {
+                    s_logger.error("Incorrect value for the following tag: " + key + ". Expected value is " + verifyParam.get(key) + " while actual value is " + itemName);
+                    result = false;
+                }
+            }
+        }
+        return result;
+    }
+
+    public static boolean verifyEvents(String fileName, String level, String host, String account) {
+        boolean result = false;
+        HashMap<String, Integer> expectedEvents = new HashMap<String, Integer>();
+        HashMap<String, Integer> actualEvents = new HashMap<String, Integer>();
+        String key = "";
+
+        File file = new File(fileName);
+        if (file.exists()) {
+            Properties pro = new Properties();
+            try {
+                // get expected events
+                FileInputStream in = new FileInputStream(file);
+                pro.load(in);
+                Enumeration<?> en = pro.propertyNames();
+                while (en.hasMoreElements()) {
+                    key = (String) en.nextElement();
+                    expectedEvents.put(key, Integer.parseInt(pro.getProperty(key)));
+                }
+
+                // get actual events
+                String url = host + "/?command=listEvents&account=" + account + "&level=" + level + "&domainid=1&pagesize=100";
+                s_logger.info("Getting events with the following url " + url);
+                HttpClient client = new HttpClient();
+                HttpMethod method = new GetMethod(url);
+                int responseCode = client.executeMethod(method);
+                if (responseCode == 200) {
+                    InputStream is = method.getResponseBodyAsStream();
+                    ArrayList<HashMap<String, String>> eventValues = UtilsForTest.parseMulXML(
+                            is, new String[] { "event" });
+
+                    for (int i = 0; i < eventValues.size(); i++) {
+                        HashMap<String, String> element = eventValues.get(i);
+                        if (element.get("level").equals(level)) {
+                            if (actualEvents.containsKey(element.get("type")) == true) {
+                                actualEvents.put(element.get("type"), actualEvents.get(element.get("type")) + 1);
+                            }
+                            else {
+                                actualEvents.put(element.get("type"), 1);
+                            }
+                        }
+                    }
+                }
+                method.releaseConnection();
+
+                // compare actual events with expected events
+
+                // compare expected result and actual result
+                Iterator<?> iterator = expectedEvents.keySet().iterator();
+                Integer expected;
+                Integer actual;
+                int fail = 0;
+                while (iterator.hasNext()) {
+                    expected = null;
+                    actual = null;
+                    String type = iterator.next().toString();
+                    expected = expectedEvents.get(type);
+                    actual = actualEvents.get(type);
+                    if (actual == null) {
+                        s_logger.error("Event of type " + type + " and level " + level + " is missing in the listEvents response. Expected number of these events is " + expected);
+                        fail++;
+                    } else if (expected.compareTo(actual) != 0) {
+                        fail++;
+                        s_logger.info("Amount of events of  " + type + " type and level " + level + " is incorrect. Expected number of these events is " + expected + ", actual number is " + actual);
+                    }
+                }
+                if (fail == 0) {
+                    result = true;
+                }
+            } catch (Exception ex) {
+                s_logger.error(ex);
+            }
+        } else {
+            s_logger.info("File " + fileName + " not found");
+        }
+        return result;
+    }
+
+    public static boolean verifyEvents(HashMap<String, Integer> expectedEvents, String level, String host, String parameters) {
+        boolean result = false;
+        HashMap<String, Integer> actualEvents = new HashMap<String, Integer>();
+        try {
+            // get actual events
+            String url = host + "/?command=listEvents&" + parameters;
+            HttpClient client = new HttpClient();
+            HttpMethod method = new GetMethod(url);
+            int responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                ArrayList<HashMap<String, String>> eventValues = UtilsForTest.parseMulXML(
+                        is, new String[] { "event" });
+
+                for (int i = 0; i < eventValues.size(); i++) {
+                    HashMap<String, String> element = eventValues.get(i);
+                    if (element.get("level").equals(level)) {
+                        if (actualEvents.containsKey(element.get("type")) == true) {
+                            actualEvents.put(element.get("type"), actualEvents.get(element.get("type")) + 1);
+                        }
+                        else {
+                            actualEvents.put(element.get("type"), 1);
+                        }
+                    }
+                }
+            }
+            method.releaseConnection();
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+
+        // compare actual events with expected events
+        Iterator<?> iterator = expectedEvents.keySet().iterator();
+        Integer expected;
+        Integer actual;
+        int fail = 0;
+        while (iterator.hasNext()) {
+            expected = null;
+            actual = null;
+            String type = iterator.next().toString();
+            expected = expectedEvents.get(type);
+            actual = actualEvents.get(type);
+            if (actual == null) {
+                s_logger.error("Event of type " + type + " and level " + level + " is missing in the listEvents response. Expected number of these events is " + expected);
+                fail++;
+            }
+            else if (expected.compareTo(actual) != 0) {
+                fail++;
+                s_logger.info("Amount of events of  " + type + " type and level " + level + " is incorrect. Expected number of these events is " + expected + ", actual number is " + actual);
+            }
+        }
+
+        if (fail == 0) {
+            result = true;
+        }
+
+        return result;
+    }
+
+    public Element queryAsyncJobResult(String jobId) {
+        Element returnBody = null;
+        int code = 400;
+        String resultUrl = this.host + ":8096/?command=queryAsyncJobResult&jobid=" + jobId;
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(resultUrl);
+        while (true) {
+            try {
+                code = client.executeMethod(method);
+                if (code == 200) {
+                    InputStream is = method.getResponseBodyAsStream();
+                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                    DocumentBuilder builder = factory.newDocumentBuilder();
+                    Document doc = builder.parse(is);
+                    doc.getDocumentElement().normalize();
+                    returnBody = doc.getDocumentElement();
+                    Element jobStatusTag = (Element) returnBody.getElementsByTagName("jobstatus").item(0);
+                    String jobStatus = jobStatusTag.getTextContent();
+                    if (jobStatus.equals("0")) {
+                        try {
+                            Thread.sleep(1000);
+                        } catch (InterruptedException e) {
+                        }
+                    } else {
+                        break;
+                    }
+                    method.releaseConnection();
+                }
+                else {
+                    s_logger.error("Error during queryJobAsync. Error code is " + code);
+                    this.responseCode = code;
+                    return null;
+                }
+            } catch (Exception ex) {
+                s_logger.error(ex);
+            }
+        }
+        return returnBody;
+    }
+
+    private String getElementByName(String elementName) {
+        NodeList commandName = this.xmlCommand.getElementsByTagName(elementName);
+        if (commandName.getLength() != 0) {
+            Element commandElmnt = (Element) commandName.item(0);
+            NodeList commandNm = commandElmnt.getChildNodes();
+            return ((Node) commandNm.item(0)).getNodeValue();
+        }
+        else {
+            return null;
+        }
+    }
+
+    private boolean verifyTagValue(String elementName, String expectedValue) {
+        NodeList tag = this.xmlCommand.getElementsByTagName(elementName);
+        if (tag.getLength() != 0) {
+            Element commandElmnt = (Element) tag.item(0);
+            NodeList commandNm = commandElmnt.getChildNodes();
+            if (((Node) commandNm.item(0)).getNodeValue().equals(expectedValue)) {
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            return false;
+        }
+    }
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/ConfigTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/ConfigTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/ConfigTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/ConfigTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,131 @@
+// 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.test.regression;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.Session;
+
+public class ConfigTest extends TestCase{
+	public static final Logger s_logger = Logger.getLogger(ConfigTest.class.getName());
+	
+	public ConfigTest(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    //new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+		    
+		    
+		    if (api.getName().equals("rebootManagementServer")) {
+		    		
+	    		s_logger.info("Attempting to SSH into management server " + this.getParam().get("hostip"));
+	    		try {
+	    			Connection conn = new Connection(this.getParam().get("hostip"));
+					conn.connect(null, 60000, 60000);
+
+					s_logger.info("SSHed successfully into management server " + this.getParam().get("hostip"));
+
+					boolean isAuthenticated = conn.authenticateWithPassword("root",
+							"password");
+
+					if (isAuthenticated == false) {
+						s_logger.info("Authentication failed for root with password");
+						return false;
+					}
+					
+					String restartCommand = "service cloud-management restart; service cloud-usage restart";
+					Session sess = conn.openSession();
+					s_logger.info("Executing : " + restartCommand);
+					sess.execCommand(restartCommand);
+					Thread.sleep(120000);
+					sess.close();
+					conn.close();
+					
+	    		} catch (Exception ex) {
+	    			s_logger.error(ex);
+	    			return false;
+	    		}	
+		    }
+		    else {
+				//send a command
+				api.sendCommand(this.getClient(), null);
+				
+				
+				//verify the response of the command
+				if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200) && (api.getTestCaseInfo() != null)) {
+					s_logger.error("Test case " + api.getTestCaseInfo() + "failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+					error++;
+				}
+				else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+					//set parameters for the future use
+					if (api.setParam(this.getParam()) == false) {
+						s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
+						return false;
+					}
+					else {
+						//verify parameters
+						if (api.verifyParam() == false)
+						{
+							s_logger.error("Command " + api.getName() + " failed. Verification for returned parameters failed. Command was sent with url " + api.getUrl());
+							error++;
+						}
+						else if (api.getTestCaseInfo() != null)
+						{
+							s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command was sent with the url " + api.getUrl());
+						}
+					}
+				}
+				else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
+					s_logger.error("Command " + api.getName() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url  " + api.getUrl() + " Required: " + api.getRequired());
+					if (api.getRequired() == true) {
+						s_logger.info("The command is required for the future use, so exiging");
+						return false;
+					}
+					error++;
+				}
+				else if (api.getTestCaseInfo() != null) {
+						s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command that was supposed to fail, failed - test passed. Command was sent with url " + api.getUrl());
+				}
+		    }
+		}
+			if (error != 0)
+				return false;
+			else
+				return true;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/DelegatedAdminTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/DelegatedAdminTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/DelegatedAdminTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/DelegatedAdminTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,132 @@
+// 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.test.regression;
+
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+
+public class DelegatedAdminTest extends TestCase{
+	
+public static final Logger s_logger = Logger.getLogger(DelegatedAdminTest.class.getName());
+
+	public DelegatedAdminTest(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		int error=0;
+	
+		for (Document eachElement: this.getInputFile()) {
+			
+			Element rootElement = eachElement.getDocumentElement();
+			NodeList commandLst = rootElement.getElementsByTagName("command");
+			
+			//Analyze each command, send request and build the array list of api commands
+			for (int i=0; i<commandLst.getLength(); i++) {
+				boolean verify = false;
+				Node fstNode = commandLst.item(i);
+			    Element fstElmnt = (Element) fstNode;
+			    
+			    //new command
+				ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+				
+				if ((eachElement.getElementsByTagName("delegated_admin_verify_part2").getLength() != 0) && !(api.getName().equals("registerUserKeys"))) {
+					if (api.getName().startsWith("list")) {
+					    
+					    if (this.denyToExecute()) {
+	                        api.setResponseType(ResponseType.EMPTY);
+	                    }
+						verify = true;
+					}
+					
+					if (this.denyToExecute()) {
+					    api.setResponseType(ResponseType.ERROR);
+					}
+				}
+				
+				//send a command
+				api.sendCommand(this.getClient(), null);
+				
+				//verify the response of the command
+				if ((verify == true) && !(api.getResponseType() == ResponseType.ERROR || api.getResponseType() == ResponseType.EMPTY)) {
+					s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+					error++;
+				} 
+				else if ((verify == true) && (api.getResponseType() == ResponseType.ERROR || api.getResponseType() == ResponseType.EMPTY)) {
+					s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
+				}
+				else if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+					s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+					error++;
+				}
+				else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+					//set parameters for the future use
+					if (api.setParam(this.getParam()) == false) {
+						s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
+						return false;
+					}
+					else if (api.getTestCaseInfo() != null){
+						s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
+					}
+				}
+				else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
+					s_logger.error("Test case  " + api.getTestCaseInfo() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url  " + api.getUrl());
+					if (api.getRequired() == true) {
+						s_logger.info("The command is required for the future use, so exiging");
+						return false;
+					}
+					error++;
+				}
+				else if (api.getTestCaseInfo() != null){
+						s_logger.info("Test case " + api.getTestCaseInfo() +  " passed");
+				
+				}	
+			}
+		}
+		
+		if (error != 0)
+			return false;
+		else
+			return true;
+	}
+	
+	public boolean denyToExecute () {
+		boolean result = true;
+		Integer level1 = Integer.valueOf(this.getParam().get("domainlevel1"));
+		Integer level2 = Integer.valueOf(this.getParam().get("domainlevel2"));
+		String domain1 = this.getParam().get("domainname1");
+		String domain2 = this.getParam().get("domainname2");
+		
+		if (this.getParam().get("accounttype2").equals("1")) {
+			result = false;
+		}
+		else if ((level2.compareTo(level1) < 0) && (domain1.startsWith(domain2)) && (this.getParam().get("accounttype2").equals("2"))) {
+			result = false;
+		}
+		
+		return result;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/Deploy.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/Deploy.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/Deploy.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/Deploy.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,114 @@
+// 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.test.regression;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class Deploy extends TestCase{
+	public static final Logger s_logger = Logger.getLogger(Deploy.class.getName());
+	
+	public Deploy(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+
+	
+	public boolean executeTest() {
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    //new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+			
+			//send a command
+			api.sendCommand(this.getClient(), null);
+			
+			
+			//verify the response of the command
+			if (api.getResponseCode() != 200) {
+				error++;
+				s_logger.error("The command " + api.getUrl() + " failed");
+			}
+			else {
+				s_logger.info("The command " + api.getUrl() + " passsed");
+			}
+		}
+			if (error != 0)
+				return false;
+			else
+				return true;
+	}
+		
+	
+	public static void main (String[] args) {
+		
+		List<String> argsList = Arrays.asList(args);
+		Iterator<String> iter = argsList.iterator();
+		String host = null;
+		String file = null;
+		
+		while (iter.hasNext()) {
+			String arg = iter.next();
+			// management server host
+			if (arg.equals("-h")) {
+				host = iter.next();
+			}
+			if (arg.equals("-f")) {
+				file = iter.next();
+			}
+		}
+		
+		Deploy deploy = new Deploy ();
+		
+		ArrayList<String> inputFile = new ArrayList<String>();
+		inputFile.add(file);
+		deploy.setInputFile(inputFile);
+		deploy.setTestCaseName("Management server deployment");
+		deploy.getParam().put("hostip", host);
+		deploy.getParam().put("apicommands", "../metadata/func/commands");
+		deploy.setCommands();
+		
+		s_logger.info("Starting deployment against host " + host);
+		
+		boolean result = deploy.executeTest();
+		if (result == false) {
+     	   s_logger.error("DEPLOYMENT FAILED");
+     	   System.exit(1);
+        }
+        else {
+     	   s_logger.info("DEPLOYMENT IS SUCCESSFUL");
+        }
+		
+	} 
+	
+}
+
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/EventsApiTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/EventsApiTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/EventsApiTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/EventsApiTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,178 @@
+// 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.test.regression;
+
+import java.sql.Statement;
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.Session;
+
+public class EventsApiTest extends TestCase{
+public static final Logger s_logger = Logger.getLogger(EventsApiTest.class.getName());
+	
+	
+	public EventsApiTest(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    
+		    //!!!check if we need to execute mySql command
+		    NodeList commandName = fstElmnt.getElementsByTagName("name");
+		    Element commandElmnt = (Element) commandName.item(0);
+		    NodeList commandNm = commandElmnt.getChildNodes();
+		    if (((Node) commandNm.item(0)).getNodeValue().equals("mysqlupdate")) {
+		    	//establish connection to mysql server and execute an update command
+		    	NodeList mysqlList = fstElmnt.getElementsByTagName("mysqlcommand");
+		    	for (int j=0; j<mysqlList.getLength(); j++) {
+		    		Element itemVariableElement = (Element) mysqlList.item(j);
+		    		
+		    		s_logger.info("Executing mysql command " + itemVariableElement.getTextContent());
+		    		try {
+		    			Statement st = this.getConn().createStatement();
+		    			st.executeUpdate(itemVariableElement.getTextContent());
+		    		} catch (Exception ex) {
+		    			s_logger.error(ex);
+		    			return false;
+		    		}	
+		    	}
+		    } 
+		    
+		    else if (((Node) commandNm.item(0)).getNodeValue().equals("agentcommand")) {
+		    	//connect to all the agents and execute agent command
+		    	NodeList commandList = fstElmnt.getElementsByTagName("commandname");
+		    	Element commandElement = (Element) commandList.item(0);
+		    	NodeList ipList = fstElmnt.getElementsByTagName("ip");
+		    	for (int j=0; j<ipList.getLength(); j++) {
+		    		Element itemVariableElement = (Element) ipList.item(j);
+		    		
+		    		s_logger.info("Attempting to SSH into agent " + itemVariableElement.getTextContent());
+		    		try {
+		    			Connection conn = new Connection(itemVariableElement.getTextContent());
+						conn.connect(null, 60000, 60000);
+
+						s_logger.info("SSHed successfully into agent " + itemVariableElement.getTextContent());
+
+						boolean isAuthenticated = conn.authenticateWithPassword("root",
+								"password");
+
+						if (isAuthenticated == false) {
+							s_logger.info("Authentication failed for root with password");
+							return false;
+						}
+						
+						Session sess = conn.openSession();
+						s_logger.info("Executing : " + commandElement.getTextContent());
+						sess.execCommand(commandElement.getTextContent());
+						Thread.sleep(60000);
+						sess.close();
+						conn.close();
+						
+		    		} catch (Exception ex) {
+		    			s_logger.error(ex);
+		    			return false;
+		    		}	
+		    	}
+		    } 
+		    
+		    else {
+			    //new command
+				ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+				
+				//send a command
+				api.sendCommand(this.getClient(), null);
+				
+				
+				//verify the response of the command
+				if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+					s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+					error++;
+				}
+				else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+					//verify if response is suppposed to be empty
+					if (api.getResponseType() == ResponseType.EMPTY) {
+						if (api.isEmpty() == true) {
+							s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Empty response was returned as expected. Command was sent with url " + api.getUrl());
+						}
+						else {
+							s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Empty response was expected. Command was sent with url " + api.getUrl());
+						}
+					} else {
+						if (api.isEmpty() != false) 
+							s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Non-empty response was expected. Command was sent with url " + api.getUrl());
+						else {
+							//set parameters for the future use
+							if (api.setParam(this.getParam()) == false) {
+								s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
+								return false;
+							}
+							else if (api.getTestCaseInfo() != null){
+								s_logger.info("Test case " + api.getTestCaseInfo() + " passed. Command was sent with the url " + api.getUrl());
+							}
+						}	
+					}
+				}
+				else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
+					s_logger.error("Command " + api.getName() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url  " + api.getUrl());
+					if (api.getRequired() == true) {
+						s_logger.info("The command is required for the future use, so exiging");
+						return false;
+					}
+					error++;
+				}
+				else if (api.getTestCaseInfo() != null){
+						s_logger.info("Test case " + api.getTestCaseInfo() +  " passed. Command that was supposed to fail, failed. Command was sent with url " + api.getUrl());
+				
+				}	
+		    }
+		}
+		
+		//verify events with userid parameter - test case 97
+		HashMap<String, Integer> expectedEvents = new HashMap<String, Integer>();
+		expectedEvents.put("VM.START", 1);
+		boolean eventResult = ApiCommand.verifyEvents(expectedEvents, "INFO", "http://" + this.getParam().get("hostip") + ":8096", "userid=" + this.getParam().get("userid1") + "&type=VM.START");
+		s_logger.info("Test case 97 - listEvent command verification result is  " + eventResult);
+		
+		//verify error events
+		eventResult = ApiCommand.verifyEvents("../metadata/error_events.properties", "ERROR", "http://" + this.getParam().get("hostip") + ":8096", this.getParam().get("erroruseraccount"));
+		s_logger.info("listEvent command verification result is  " + eventResult);
+		
+		
+			if (error != 0)
+				return false;
+			else
+				return true;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/HA.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/HA.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/HA.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/HA.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,78 @@
+// 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.test.regression;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+
+public class HA extends TestCase{
+
+	public static final Logger s_logger = Logger.getLogger(HA.class.getName());
+	
+	public HA(){
+		this.setClient();
+	}
+	
+	public boolean executeTest(){
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			
+		    Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+			
+			//new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+		
+			//send a command
+			api.sendCommand(this.getClient(), this.getConn());
+			
+			//verify the response parameters
+			if ((api.getResponseCode() !=200 ) && (api.getRequired() == true) )
+			{
+				s_logger.error("Exiting the test....Command " + api.getName() + " required for the future run, failed with an error code " + api.getResponseCode() + ". Command was sent with the url " + api.getUrl());
+				return false;
+			}
+			else if ((api.getResponseCode() != 200) && (api.getResponseType() != ResponseType.ERROR)) {
+				error++;
+				s_logger.error("Command " + api.getTestCaseInfo() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url  " + api.getUrl());
+			} else if ((api.getResponseCode() == 200) && (api.getResponseType() == ResponseType.ERROR)) {
+				error++;
+				s_logger.error("Command " + api.getTestCaseInfo() + " which was supposed to failed, passed. The command was sent with url  " + api.getUrl());
+			} else {
+				//set parameters for the future use
+				if (api.setParam(this.getParam()) == false) {	
+					s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. Command was sent with url " + api.getUrl());
+					return false;
+				}
+				s_logger.info("Command " + api.getTestCaseInfo() + " passed");
+			}
+		}
+		
+		if (error != 0)
+			return false;
+		else
+			return true;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/LoadBalancingTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/LoadBalancingTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/LoadBalancingTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/LoadBalancingTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,147 @@
+// 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.test.regression;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+
+
+public class LoadBalancingTest extends TestCase{
+
+	public static final Logger s_logger = Logger.getLogger(LoadBalancingTest.class.getName());
+	
+	public LoadBalancingTest(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    //new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+			
+			//send a command
+			api.sendCommand(this.getClient(), null);
+			
+			
+			//verify the response of the command
+			if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+				s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+				error++;
+			}
+			else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+				//verify if response is suppposed to be empty
+				if (api.getResponseType() == ResponseType.EMPTY) {
+					if (api.isEmpty() == true) {
+						s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
+					}
+					else {
+						s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Empty response was expected. Command was sent with url " + api.getUrl());
+					}
+				} else {
+					if (api.isEmpty() != false) 
+						s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Non-empty response was expected. Command was sent with url " + api.getUrl());
+					else {
+						//set parameters for the future use
+						if (api.setParam(this.getParam()) == false) {
+							s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
+							return false;
+						}
+						else if (api.getTestCaseInfo() != null){
+							s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
+						}
+					}	
+				}
+			}
+			else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
+				s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command was sent with url  " + api.getUrl());
+				if (api.getRequired() == true) {
+					s_logger.info("The command is required for the future use, so exiging");
+					return false;
+				}
+				error++;
+			}
+			else if (api.getTestCaseInfo() != null){
+					s_logger.info("Test case " + api.getTestCaseInfo() +  " passed");
+			
+			}		
+		}
+		
+//		//Try to create portForwarding rule for all available private/public ports
+//		ArrayList<String> port = new ArrayList<String>();
+//		for (int i=1; i<65536; i++){
+//			port.add(Integer.toString(i));
+//		}
+//		
+//		//try all public ports	
+//		for (String portValue : port) {
+//	        try {
+//	        	String url = this.getHost() + ":8096/?command=createOrUpdateLoadBalancerRule&account=" + this.getParam().get("accountname") + "&publicip=" + this.getParam().get("boundaryip") + 
+//	        	"&privateip=" + this.getParam().get("vmipaddress") + "&privateport=22&protocol=tcp&publicport=" + portValue;
+//	        	HttpClient client = new HttpClient();
+//				HttpMethod method = new GetMethod(url);
+//				int responseCode = client.executeMethod(method);
+//				if (responseCode != 200 ) {
+//					error++;
+//					s_logger.error("Can't create LB rule for the public port " + portValue + ". Request was sent with url " + url);
+//				}	
+//	        }catch (Exception ex) {
+//	        	s_logger.error(ex);
+//	        }
+//		}
+//		
+//		//try all private ports
+//		for (String portValue : port) {
+//	        try {
+//	        	String url = this.getHost() + ":8096/?command=createOrUpdateLoadBalancerRule&account=" + this.getParam().get("accountname") + "&publicip=" + this.getParam().get("boundaryip") + 
+//	        	"&privateip=" + this.getParam().get("vmipaddress") + "&publicport=22&protocol=tcp&privateport=" + portValue;
+//	        	HttpClient client = new HttpClient();
+//				HttpMethod method = new GetMethod(url);
+//				int responseCode = client.executeMethod(method);
+//				if (responseCode != 200 ) {
+//					error++;
+//					s_logger.error("Can't create LB rule for the private port " + portValue + ". Request was sent with url " + url);
+//				}	
+//	        }catch (Exception ex) {
+//	        	s_logger.error(ex);
+//	        }
+//		}
+
+		
+		if (error != 0)
+			return false;
+		else
+			return true;
+	}
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/PortForwardingTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/PortForwardingTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/PortForwardingTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/PortForwardingTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,146 @@
+// 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.test.regression;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+
+public class PortForwardingTest extends TestCase{
+	public static final Logger s_logger = Logger.getLogger(PortForwardingTest.class.getName());
+	
+	public PortForwardingTest(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    //new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+			
+			//send a command
+			api.sendCommand(this.getClient(), null);
+			
+			
+			//verify the response of the command
+			if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+				s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+				error++;
+			}
+			else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+				//verify if response is suppposed to be empty
+				if (api.getResponseType() == ResponseType.EMPTY) {
+					if (api.isEmpty() == true) {
+						s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
+					}
+					else {
+						s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Empty response was expected. Command was sent with url " + api.getUrl());
+					}
+				} else {
+					if (api.isEmpty() != false) 
+						s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Non-empty response was expected. Command was sent with url " + api.getUrl());
+					else {
+						//set parameters for the future use
+						if (api.setParam(this.getParam()) == false) {
+							s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
+							return false;
+						}
+						else if (api.getTestCaseInfo() != null){
+							s_logger.info("Test case " + api.getTestCaseInfo() + " passed");
+						}
+					}	
+				}
+			}
+			else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
+				s_logger.error("Test case " + api.getTestCaseInfo() + " failed . Command was sent with url  " + api.getUrl());
+				if (api.getRequired() == true) {
+					s_logger.info("The command is required for the future use, so exiging");
+					return false;
+				}
+				error++;
+			}
+			else if (api.getTestCaseInfo() != null){
+					s_logger.info("Test case " + api.getTestCaseInfo() +  " passed");
+			
+			}		
+		}
+		
+//		//Try to create portForwarding rule for all available private/public ports
+//		ArrayList<String> port = new ArrayList<String>();
+//		for (int i=1; i<65536; i++){
+//			port.add(Integer.toString(i));
+//		}
+//		
+//		//try all public ports	
+//		for (String portValue : port) {
+//	        try {
+//	        	s_logger.info("public port is " + portValue);
+//	        	String url = this.getHost() + ":8096/?command=createOrUpdateIpForwardingRule&account=" + this.getParam().get("accountname") + "&publicip=" + this.getParam().get("boundaryip") + 
+//	        	"&privateip=" + this.getParam().get("vmipaddress") + "&privateport=22&protocol=tcp&publicport=" + portValue;
+//	        	HttpClient client = new HttpClient();
+//				HttpMethod method = new GetMethod(url);
+//				int responseCode = client.executeMethod(method);
+//				if (responseCode != 200 ) {
+//					error++;
+//					s_logger.error("Can't create portForwarding rule for the public port " + portValue + ". Request was sent with url " + url);
+//				}	
+//	        }catch (Exception ex) {
+//	        	s_logger.error(ex);
+//	        }
+//		}
+//		
+//		//try all private ports
+//		for (String portValue : port) {
+//	        try {
+//	        	String url = this.getHost() + ":8096/?command=createOrUpdateIpForwardingRule&account=" + this.getParam().get("accountname") + "&publicip=" + this.getParam().get("boundaryip") + 
+//	        	"&privateip=" + this.getParam().get("vmipaddress") + "&publicport=22&protocol=tcp&privateport=" + portValue;
+//	        	HttpClient client = new HttpClient();
+//				HttpMethod method = new GetMethod(url);
+//				int responseCode = client.executeMethod(method);
+//				if (responseCode != 200 ) {
+//					error++;
+//					s_logger.error("Can't create portForwarding rule for the private port " + portValue + ". Request was sent with url " + url);
+//				}	
+//	        }catch (Exception ex) {
+//	        	s_logger.error(ex);
+//	        }
+//		}
+
+		
+		if (error != 0)
+			return false;
+		else
+			return true;
+	}
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/SanityTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/SanityTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/SanityTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/SanityTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,86 @@
+// 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.test.regression;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.log4j.Logger;
+
+public class SanityTest extends TestCase{
+
+	public static final Logger s_logger = Logger.getLogger(SanityTest.class.getName());
+	
+	public SanityTest(){
+		this.setClient();
+	}
+	
+	public boolean executeTest(){
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			
+		    Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+			
+			//new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+		
+			api.sendCommand(this.getClient(), null);
+			
+			//verify the response parameters
+			if ((api.getResponseCode() !=200 ) && (api.getRequired() == true) )
+			{
+				s_logger.error("Exiting the test....Command " + api.getName() + " required for the future run, failed with an error code " + api.getResponseCode() + ". Command was sent with the url " + api.getUrl());
+				return false;
+			}
+			else if (api.getResponseCode() != 200) {
+				error++;
+				s_logger.error("Test " + api.getTestCaseInfo() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url  " + api.getUrl());
+			}
+			else {
+				//set parameters for the future use
+				if (api.setParam(this.getParam()) == false) {	
+					s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. Command was sent with url " + api.getUrl());
+					return false;
+				}
+				
+				//verify parameters
+				if (api.verifyParam() == false)
+				{
+					s_logger.error("Test " + api.getTestCaseInfo() + " failed. Verification for returned parameters failed. The command was sent with url " + api.getUrl());
+					error++;
+				}
+				else if (api.getTestCaseInfo() != null)
+				{
+					s_logger.info("Test " + api.getTestCaseInfo() + " passed");
+				}
+			}
+		}
+		
+		//verify event	
+		boolean eventResult = ApiCommand.verifyEvents("../metadata/func/regression_events.properties", "INFO", "http://" + this.getParam().get("hostip") + ":8096", this.getParam().get("accountname"));
+		s_logger.info("listEvent command verification result is  " + eventResult);
+		
+		if (error != 0)
+			return false;
+		else
+			return true;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/TestCaseEngine.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/TestCaseEngine.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/TestCaseEngine.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/TestCaseEngine.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,288 @@
+// 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.test.regression;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class TestCaseEngine {
+
+	public static final Logger s_logger = Logger.getLogger(TestCaseEngine.class
+			.getName());
+	public static String fileName = "../metadata/adapter.xml";
+	public static HashMap<String, String> globalParameters = new HashMap<String, String>();
+	protected static HashMap<String, String> _componentMap = new HashMap<String, String>();
+	protected static HashMap<String, ArrayList<String>> _inputFile = new HashMap<String, ArrayList<String>>();
+	protected static String testCaseName = new String();
+	protected static ArrayList<String> _keys = new ArrayList<String>();
+	private static ThreadLocal<Object> result = new ThreadLocal<Object>();
+	public static int _numThreads = 1;
+	public static boolean _repeat = false;
+	public static boolean _printUrl = false;
+	public static String type = "All";
+	public static boolean isSanity = false;
+	public static boolean isRegression = false;
+	private static int failure = 0;
+
+	public static void main(String args[]) {
+
+		// Parameters
+		List<String> argsList = Arrays.asList(args);
+		Iterator<String> iter = argsList.iterator();
+		while (iter.hasNext()) {
+			String arg = iter.next();
+			// is stress?
+			if (arg.equals("-t")) {
+				_numThreads = Integer.parseInt(iter.next());
+			}
+			// do you want to print url for all commands?
+			if (arg.equals("-p")) {
+				_printUrl = true;
+			}
+			
+			//type of the test: sanity, regression, all (default)
+			if (arg.equals("-type")) {
+				type = iter.next();
+			}
+			
+			if (arg.equals("-repeat")) {
+			    _repeat = Boolean.valueOf(iter.next());
+			}
+			
+			if (arg.equals("-filename")) {
+			    fileName = iter.next();
+			}
+		}
+		
+		if (type.equalsIgnoreCase("sanity"))
+			isSanity = true;
+		else if (type.equalsIgnoreCase("regression"))
+			isRegression = true;
+
+		try {
+			// parse adapter.xml file to get list of tests to execute
+			File file = new File(fileName);
+			DocumentBuilderFactory factory = DocumentBuilderFactory
+					.newInstance();
+			DocumentBuilder builder = factory.newDocumentBuilder();
+			Document doc = builder.parse(file);
+			doc.getDocumentElement().normalize();
+			Element root = doc.getDocumentElement();
+
+			// set global parameters
+			setGlobalParams(root);
+
+			// populate _componentMap
+			setComponent(root);
+
+			// set error to 0 by default
+
+			// execute test
+			for (int i = 0; i < _numThreads; i++) {
+			    if (_numThreads > 1) {
+			        s_logger.info("STARTING STRESS TEST IN "
+                            + _numThreads + " THREADS");
+			    } else {
+			        s_logger.info("STARTING FUNCTIONAL TEST");
+			    }
+				new Thread(new Runnable() {
+					public void run() {
+						do {
+							if (_numThreads == 1) {
+								try {
+									for (String key : _keys) {
+										Class<?> c = Class.forName(_componentMap.get(key));
+										TestCase component = (TestCase) c.newInstance();
+										executeTest(key, c, component);
+									}
+								} catch (Exception ex1) {
+									s_logger.error(ex1);
+								} finally {
+									if (failure > 0) {
+										System.exit(1);
+									}
+								}
+							} else {
+								Random ran = new Random();
+								Integer randomNumber = (Integer) Math.abs(ran
+										.nextInt(_keys.size()));
+								try {
+									String key = _keys.get(randomNumber);
+									Class<?> c = Class.forName(_componentMap
+											.get(key));
+									TestCase component = (TestCase) c
+											.newInstance();
+									executeTest(key, c, component);
+								} catch (Exception e) {
+									s_logger.error("Error in thread ", e);
+								}
+							}
+						} while (_repeat);
+					}
+				}).start();
+			}
+
+		} catch (Exception exc) {
+			s_logger.error(exc);
+		}
+	}
+
+	public static void setGlobalParams(Element rootElement) {
+		NodeList globalParam = rootElement.getElementsByTagName("globalparam");
+		Element parameter = (Element) globalParam.item(0);
+		NodeList paramLst = parameter.getElementsByTagName("param");
+
+		for (int i = 0; i < paramLst.getLength(); i++) {
+			Element paramElement = (Element) paramLst.item(i);
+
+			if (paramElement.getNodeType() == Node.ELEMENT_NODE) {
+				Element itemElement = (Element) paramElement;
+				NodeList itemName = itemElement.getElementsByTagName("name");
+				Element itemNameElement = (Element) itemName.item(0);
+				NodeList itemVariable = itemElement
+						.getElementsByTagName("variable");
+				Element itemVariableElement = (Element) itemVariable.item(0);
+				globalParameters.put(itemVariableElement.getTextContent(),
+						itemNameElement.getTextContent());
+			}
+		}
+	}
+
+	public static void setComponent(Element rootElement) {
+		NodeList testLst = rootElement.getElementsByTagName("test");
+		for (int j = 0; j < testLst.getLength(); j++) {
+			Element testElement = (Element) testLst.item(j);
+
+			if (testElement.getNodeType() == Node.ELEMENT_NODE) {
+				Element itemElement = (Element) testElement;
+
+				// get test case name
+				NodeList testCaseNameList = itemElement
+						.getElementsByTagName("testname");
+				if (testCaseNameList != null) {
+					testCaseName = ((Element) testCaseNameList.item(0))
+							.getTextContent();
+				}
+				
+				if (isSanity == true && !testCaseName.equals("SANITY TEST"))
+					continue;
+				else if (isRegression == true && !(testCaseName.equals("SANITY TEST") || testCaseName.equals("REGRESSION TEST")))
+					continue;
+
+				// set class name
+				NodeList className = itemElement.getElementsByTagName("class");
+				if ((className.getLength() == 0) || (className == null)) {
+					_componentMap.put(testCaseName,
+							"com.cloud.test.regression.VMApiTest");
+				} else {
+					String name = ((Element) className.item(0))
+							.getTextContent();
+					_componentMap.put(testCaseName, name);
+				}
+
+				// set input file name
+				NodeList inputFileNameLst = itemElement
+						.getElementsByTagName("filename");
+				_inputFile.put(testCaseName, new ArrayList<String>());
+				for (int k = 0; k < inputFileNameLst.getLength(); k++) {
+					String inputFileName = ((Element) inputFileNameLst.item(k))
+							.getTextContent();
+					_inputFile.get(testCaseName).add(inputFileName);
+				}
+			}
+		}
+		
+		//If sanity test required, make sure that SANITY TEST componennt got loaded
+		if (isSanity == true && _componentMap.size() == 0) {
+			s_logger.error("FAILURE!!! Failed to load SANITY TEST component. Verify that the test is uncommented in adapter.xml");
+			System.exit(1);
+		}
+		
+		if (isRegression == true && _componentMap.size() != 2) {
+			s_logger.error("FAILURE!!! Failed to load SANITY TEST or REGRESSION TEST components. Verify that these tests are uncommented in adapter.xml");
+			System.exit(1);
+		}
+
+		// put all keys from _componentMap to the ArrayList
+		Set<?> set = _componentMap.entrySet();
+		Iterator<?> it = set.iterator();
+		while (it.hasNext()) {
+			Map.Entry<?, ?> me = (Map.Entry<?, ?>) it.next();
+			String key = (String) me.getKey();
+			_keys.add(key);
+		}
+
+	}
+
+	public static boolean executeTest(String key, Class<?> c, TestCase component) {
+		boolean finalResult = false;
+		try {
+			s_logger.info("Starting \"" + key + "\" test...\n\n");
+
+			// set global parameters
+			HashMap<String, String> updateParam = new HashMap<String, String>();
+			updateParam.putAll(globalParameters);
+			component.setParam(updateParam);
+
+			// set DB ip address
+			component.setConn(globalParameters.get("dbPassword"));
+
+			// set commands list
+			component.setCommands();
+
+			// set input file
+			if (_inputFile.get(key) != null) {
+				component.setInputFile(_inputFile.get(key));
+			}
+
+			// set test case name
+			if (key != null) {
+				component.setTestCaseName(testCaseName);
+			}
+
+			// execute method
+			result.set(component.executeTest());
+			if (result.get().toString().equals("false")) {
+				s_logger.error("FAILURE!!! Test \"" + key + "\" failed\n\n\n");
+				failure++;
+			} else {
+				finalResult = true;
+				s_logger.info("SUCCESS!!! Test \"" + key + "\" passed\n\n\n");
+			}
+
+		} catch (Exception ex) {
+			s_logger.error("error during test execution ", ex);
+		}
+		return finalResult;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/TestCase.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/TestCase.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/TestCase.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/TestCase.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,140 @@
+// 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.test.regression;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
+
+public abstract class TestCase{
+	
+	public static Logger s_logger = Logger.getLogger(TestCase.class.getName());
+	private Connection conn;
+	private ArrayList <Document> inputFile = new ArrayList<Document> ();
+	private HttpClient client;
+	private String testCaseName;
+	private HashMap<String, String> param = new HashMap<String, String> ();
+	private HashMap<String, String> commands = new HashMap<String, String> ();
+	
+	public HashMap<String, String> getParam() {
+		return param;
+	}
+
+	public void setParam(HashMap<String, String> param) {
+		this.param = param;
+	}
+	
+	
+	public HashMap<String, String> getCommands() {
+		return commands;
+	}
+
+	public void setCommands() {
+		File asyncCommands = null;
+		if (param.get("apicommands") == null) {
+			s_logger.info("Unable to get the list of commands, exiting");
+			System.exit(1);
+		} else {
+			asyncCommands = new File(param.get("apicommands"));
+		}
+		try {
+			Properties pro = new Properties();
+			FileInputStream in = new FileInputStream(asyncCommands);
+	        pro.load(in);
+	        Enumeration<?> en = pro.propertyNames();
+	        while (en.hasMoreElements()) {
+	        	String key = (String) en.nextElement();
+	        	commands.put(key, pro.getProperty(key));
+	        }	
+		} catch (Exception ex) {
+			s_logger.info("Unable to find the file " + param.get("apicommands") + " due to following exception " + ex);
+		}
+			
+	}
+
+	public Connection getConn() {
+		return conn;
+	}
+
+	public void setConn(String dbPassword) {
+		this.conn = null;
+		try {
+			Class.forName("com.mysql.jdbc.Driver");
+			this.conn=DriverManager.getConnection("jdbc:mysql://" + param.get("db") + "/cloud", "root", dbPassword);
+			if (!this.conn.isValid(0)) {
+				s_logger.error("Connection to DB failed to establish");
+			}
+			
+		}catch (Exception ex) {
+			s_logger.error(ex);
+		}
+	}
+
+	public void setInputFile (ArrayList<String> fileNameInput) {
+		for (String fileName: fileNameInput) {
+			File file = new File(fileName);
+			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+			Document doc = null;
+			try {
+				DocumentBuilder builder = factory.newDocumentBuilder();
+				doc = builder.parse(file);
+				doc.getDocumentElement().normalize();
+			} catch (Exception ex) {
+				s_logger.error("Unable to load " + fileName + " due to ", ex);
+			}
+			this.inputFile.add(doc);
+		}
+	} 
+
+	public ArrayList<Document> getInputFile() {
+		return inputFile;
+	}
+	
+	public void setTestCaseName(String testCaseName) {
+		this.testCaseName = testCaseName;
+	}
+	
+	public String getTestCaseName(){
+		return this.testCaseName;
+	}
+
+	public void setClient() {
+		HttpClient client = new HttpClient();
+		this.client = client;
+	}
+	
+	public HttpClient getClient() {
+		return this.client;
+	}
+	
+	//abstract methods
+	public abstract boolean executeTest();
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/Test.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/Test.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/Test.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/Test.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,86 @@
+// 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.test.regression;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class Test extends TestCase{
+	public static final Logger s_logger = Logger.getLogger(Test.class.getName());
+	
+	public Test(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    //new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+			
+			//send a command
+			api.sendCommand(this.getClient(), null);
+			
+		}
+		
+		//Try to create portForwarding rule for all available private/public ports
+		ArrayList<String> port = new ArrayList<String>();
+		for (int j=1; j<1000; j++){
+			port.add(Integer.toString(j));
+		}
+		
+		//try all public ports	
+		for (String portValue : port) {
+	        try {
+	        	s_logger.info("public port is " + portValue);
+	        	String url = "http://" + this.getParam().get("hostip") + ":8096/?command=createNetworkRule&publicPort=" + portValue + "&privatePort=22&protocol=tcp&isForward=true&securityGroupId=1&account=admin";
+	        	HttpClient client = new HttpClient();
+				HttpMethod method = new GetMethod(url);
+				int responseCode = client.executeMethod(method);
+				if (responseCode != 200 ) {
+					error++;
+					s_logger.error("Can't create portForwarding network rule for the public port " + portValue + ". Request was sent with url " + url);
+				}	
+	        }catch (Exception ex) {
+	        	s_logger.error(ex);
+	        }
+		}
+		
+		
+			if (error != 0)
+				return false;
+			else
+				return true;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/VMApiTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/VMApiTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/regression/VMApiTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/regression/VMApiTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,95 @@
+// 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.test.regression;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.test.regression.ApiCommand.ResponseType;
+
+
+public class VMApiTest extends TestCase{
+public static final Logger s_logger = Logger.getLogger(VMApiTest.class.getName());
+	
+	
+	public VMApiTest(){
+		this.setClient();
+		this.setParam(new HashMap<String, String>());
+	}
+	
+	public boolean executeTest(){
+		int error=0;	
+		Element rootElement = this.getInputFile().get(0).getDocumentElement();
+		NodeList commandLst = rootElement.getElementsByTagName("command");
+		
+		//Analyze each command, send request and build the array list of api commands
+		for (int i=0; i<commandLst.getLength(); i++) {
+			Node fstNode = commandLst.item(i);
+		    Element fstElmnt = (Element) fstNode;
+		    
+		    //new command
+			ApiCommand api = new ApiCommand(fstElmnt, this.getParam(), this.getCommands());
+			
+			//send a command
+			api.sendCommand(this.getClient(), this.getConn());
+			
+			
+			//verify the response of the command
+			if ((api.getResponseType() == ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+				s_logger.error("Test case " + api.getTestCaseInfo() + " failed. Command that was supposed to fail, passed. The command was sent with the following url " + api.getUrl());
+				error++;
+			}
+			else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() == 200)) {
+				//set parameters for the future use
+				if (api.setParam(this.getParam()) == false) {
+					s_logger.error("Exiting the test...Command " + api.getName() + " didn't return parameters needed for the future use. The command was sent with url " + api.getUrl());
+					return false;
+				}
+				//verify parameters
+				if (api.verifyParam() == false)
+				{
+					s_logger.error("Test " + api.getTestCaseInfo() + " failed. Verification for returned parameters failed. The command was sent with url " + api.getUrl());
+					error++;
+				}
+				else 
+				{
+					s_logger.info("Test " + api.getTestCaseInfo() + " passed");
+				}
+			}
+			else if ((api.getResponseType() != ResponseType.ERROR) && (api.getResponseCode() != 200)) {
+				s_logger.error("Test case  " + api.getTestCaseInfo() + " failed with an error code " + api.getResponseCode() + " . Command was sent with url  " + api.getUrl());
+				if (api.getRequired() == true) {
+					s_logger.info("The command is required for the future use, so exiging");
+					return false;
+				}
+				error++;
+			}
+			else if (api.getTestCaseInfo() != null){
+					s_logger.info("Test case " + api.getTestCaseInfo() +  " passed");
+			
+			}	
+		}
+			if (error != 0)
+				return false;
+			else
+				return true;
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/SshTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/SshTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/SshTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/SshTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,90 @@
+// 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.test.stress;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.Session;
+
+public class SshTest {
+    
+    public static final Logger s_logger = Logger.getLogger(SshTest.class.getName());
+    public static String host = "";
+    public static String password = "password";
+    public static String url = "http://google.com";
+    
+    public static void main (String[] args) {
+        
+        // Parameters
+        List<String> argsList = Arrays.asList(args);
+        Iterator<String> iter = argsList.iterator();
+        while (iter.hasNext()) {
+            String arg = iter.next();
+            if (arg.equals("-h")) {
+                host = iter.next();
+            }   
+            if (arg.equals("-p")) {
+                password = iter.next();
+            }  
+            
+            if (arg.equals("-u")) {
+                url = iter.next();
+            }  
+        }
+    
+        if (host == null || host.equals("")) {
+            s_logger.info("Did not receive a host back from test, ignoring ssh test");
+            System.exit(2);
+        }
+        
+        if (password == null){
+            s_logger.info("Did not receive a password back from test, ignoring ssh test");
+            System.exit(2);
+        }
+
+        try {
+            s_logger.info("Attempting to SSH into host " + host);
+            Connection conn = new Connection(host);
+            conn.connect(null, 60000, 60000);
+
+            s_logger.info("User + ssHed successfully into host " + host);
+
+            boolean isAuthenticated = conn.authenticateWithPassword("root", password);
+
+            if (isAuthenticated == false) {
+                s_logger.info("Authentication failed for root with password" + password);
+                System.exit(2);
+            }
+            
+            String linuxCommand = "wget " + url;
+            Session sess = conn.openSession();
+            sess.execCommand(linuxCommand);
+            sess.close();
+            conn.close();
+          
+        } catch (Exception e) {
+            s_logger.error("SSH test fail with error", e);
+            System.exit(2);
+        }
+    }
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/StressTestDirectAttach.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/StressTestDirectAttach.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/StressTestDirectAttach.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/StressTestDirectAttach.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,1528 @@
+// 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.test.stress;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.apache.log4j.NDC;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.trilead.ssh2.ChannelCondition;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.SCPClient;
+import com.trilead.ssh2.Session;
+
+public class StressTestDirectAttach {
+    private static long sleepTime = 180000L; // default 0
+    private static boolean cleanUp = true;
+    public static final Logger s_logger = Logger
+            .getLogger(TestClientWithAPI.class.getName());
+    private static boolean repeat = true;
+    private static String[] users = null;
+    private static boolean internet = false;
+    private static ThreadLocal<String> _linuxIP = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxVmId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxVmId1 = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxPassword = new ThreadLocal<String>();
+    private static ThreadLocal<String> _windowsIP = new ThreadLocal<String>();
+    private static ThreadLocal<String> _secretKey = new ThreadLocal<String>();
+    private static ThreadLocal<String> _apiKey = new ThreadLocal<String>();
+    private static ThreadLocal<Long> _userId = new ThreadLocal<Long>();
+    private static ThreadLocal<String> _account = new ThreadLocal<String>();
+    private static ThreadLocal<String> _domainRouterId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _newVolume = new ThreadLocal<String>();
+    private static ThreadLocal<String> _newVolume1 = new ThreadLocal<String>();
+    private static DocumentBuilderFactory factory = DocumentBuilderFactory
+            .newInstance();
+    private static int usageIterator = 1;
+    private static int numThreads = 1;
+    private static int wait = 5000;
+    private static String accountName = null;
+    private static String zoneId = "1";
+    private static String serviceOfferingId = "13";
+    private static String diskOfferingId="11";
+    private static String diskOfferingId1="12";
+
+    private static final int MAX_RETRY_LINUX = 10;
+    private static final int MAX_RETRY_WIN = 10;
+
+
+    public static void main(String[] args) {
+        String host = "http://localhost";
+        String port = "8092";
+        String devPort = "8080";
+        String apiUrl = "/client/api";
+
+        try {
+            // Parameters
+            List<String> argsList = Arrays.asList(args);
+            Iterator<String> iter = argsList.iterator();
+            while (iter.hasNext()) {
+                String arg = iter.next();
+                // host
+                if (arg.equals("-h")) {
+                    host = "http://" + iter.next();
+                }
+
+                if (arg.equals("-p")) {
+                    port = iter.next();
+                }
+                if (arg.equals("-dp")) {
+                    devPort = iter.next();
+                }
+
+                if (arg.equals("-t")) {
+                    numThreads = Integer.parseInt(iter.next());
+                }
+
+                if (arg.equals("-s")) {
+                    sleepTime = Long.parseLong(iter.next());
+                }
+                if (arg.equals("-a")) {
+                    accountName = iter.next();
+                }
+
+                if (arg.equals("-c")) {
+                    cleanUp = Boolean.parseBoolean(iter.next());
+                    if (!cleanUp)
+                        sleepTime = 0L; // no need to wait if we don't ever
+                    // cleanup
+                }
+
+                if (arg.equals("-r")) {
+                    repeat = Boolean.parseBoolean(iter.next());
+                }
+
+                if (arg.equals("-i")) {
+                    internet = Boolean.parseBoolean(iter.next());
+                }
+
+                if (arg.equals("-w")) {
+                    wait = Integer.parseInt(iter.next());
+                }
+
+                if (arg.equals("-z")) {
+                    zoneId = iter.next();
+                }
+
+                if (arg.equals("-so")) {
+                    serviceOfferingId = iter.next();
+                }
+
+            }
+
+            final String server = host + ":" + port + "/";
+            final String developerServer = host + ":" + devPort + apiUrl;
+            s_logger.info("Starting test against server: " + server + " with "
+                    + numThreads + " thread(s)");
+            if (cleanUp)
+                s_logger.info("Clean up is enabled, each test will wait "
+                        + sleepTime + " ms before cleaning up");
+
+
+
+            for (int i = 0; i < numThreads; i++) {
+                new Thread(new Runnable() {
+                    @Override
+                    public void run() {
+                        do {
+                            String username = null;
+                            try {
+                                long now = System.currentTimeMillis();
+                                Random ran = new Random();
+                                username = Math.abs(ran.nextInt())+ "-user";
+                                NDC.push(username);
+
+                                s_logger.info("Starting test for the user " + username); 
+                                int response = executeDeployment(server,
+                                        developerServer, username);
+                                boolean success = false;
+                                String reason = null;
+
+
+
+
+                                if (response == 200) {
+                                    success = true;
+                                    if (internet) {
+                                        s_logger
+                                        .info("Deploy successful...waiting 5 minute before SSH tests");
+                                        Thread.sleep(300000L); // Wait 60
+                                        // seconds so
+                                        // the windows VM
+                                        // can boot up and do a sys prep.
+
+                                        s_logger.info("Begin Linux SSH test for account " + _account.get());
+                                        reason = sshTest(_linuxIP.get(), _linuxPassword.get());
+
+
+                                        if (reason == null) {
+                                            s_logger
+                                            .info("Linux SSH test successful for account " + _account.get());
+                                        }
+                                    }
+                                    if (reason == null) {
+                                        if (internet) {
+                                            s_logger
+                                            .info("Windows SSH test successful for account " + _account.get());
+                                        } else {
+                                            s_logger
+                                            .info("deploy test successful....now cleaning up");
+                                            if (cleanUp) {
+                                                s_logger
+                                                .info("Waiting "
+                                                        + sleepTime
+                                                        + " ms before cleaning up vms");
+                                                Thread.sleep(sleepTime);
+                                            } else {
+                                                success = true;
+                                            }
+                                        }
+
+                                        if (usageIterator >= numThreads) {
+                                            int eventsAndBillingResponseCode =
+                                                    executeEventsAndBilling(server, developerServer);
+                                            s_logger.info("events and usage records command finished with response code: "
+                                                    + eventsAndBillingResponseCode);
+                                            usageIterator = 1;
+
+                                        }
+                                        else {	
+                                            s_logger.info("Skipping events and usage records for this user: usageIterator " + usageIterator+ " and number of Threads " + numThreads);
+                                            usageIterator++;
+                                        }
+
+                                        if ((users == null) && (accountName == null)) {
+                                            s_logger
+                                            .info("Sending cleanup command");
+                                            int cleanupResponseCode = executeCleanup(
+                                                    server, developerServer, username);
+                                            s_logger
+                                            .info("cleanup command finished with response code: "
+                                                    + cleanupResponseCode);
+                                            success = (cleanupResponseCode == 200);
+                                        } else {
+                                            s_logger
+                                            .info("Sending stop DomR / destroy VM command");
+                                            int stopResponseCode = executeStop(
+                                                    server, developerServer,
+                                                    username);
+                                            s_logger
+                                            .info("stop(destroy) command finished with response code: "
+                                                    + stopResponseCode);
+                                            success = (stopResponseCode == 200);
+                                        }
+
+                                    } else {
+                                        // Just stop but don't destroy the
+                                        // VMs/Routers
+                                        s_logger
+                                        .info("SSH test failed for account " + _account.get() +  "with reason '"
+                                                + reason
+                                                + "', stopping VMs");
+                                        int stopResponseCode = executeStop(
+                                                server, developerServer,
+                                                username);
+                                        s_logger
+                                        .info("stop command finished with response code: "
+                                                + stopResponseCode);
+                                        success = false; // since the SSH test
+                                        // failed, mark the
+                                        // whole test as
+                                        // failure
+                                    }
+                                } else {
+                                    // Just stop but don't destroy the
+                                    // VMs/Routers
+                                    s_logger
+                                    .info("Deploy test failed with reason '"
+                                            + reason
+                                            + "', stopping VMs");
+                                    int stopResponseCode = executeStop(server,
+                                            developerServer, username);
+                                    s_logger
+                                    .info("stop command finished with response code: "
+                                            + stopResponseCode);
+                                    success = false; // since the deploy test
+                                    // failed, mark the
+                                    // whole test as failure
+                                }
+
+                                if (success) {
+                                    s_logger
+                                    .info("***** Completed test for user : "
+                                            + username
+                                            + " in "
+                                            + ((System
+                                                    .currentTimeMillis() - now) / 1000L)
+                                                    + " seconds");
+
+                                } else {
+                                    s_logger
+                                    .info("##### FAILED test for user : "
+                                            + username
+                                            + " in "
+                                            + ((System
+                                                    .currentTimeMillis() - now) / 1000L)
+                                                    + " seconds with reason : "
+                                                    + reason);
+                                }
+                                s_logger.info("Sleeping for " + wait + " seconds before starting next iteration");
+                                Thread.sleep(wait);
+                            } catch (Exception e) {
+                                s_logger.warn("Error in thread", e);
+                                try {
+                                    int stopResponseCode = executeStop(server,
+                                            developerServer, username);
+                                    s_logger.info("stop response code: "
+                                            + stopResponseCode);
+                                } catch (Exception e1) {
+                                }
+                            } finally {
+                                NDC.clear();
+                            }
+                        } while (repeat);
+                    }
+                }).start();
+            }
+        } catch (Exception e) {
+            s_logger.error(e);
+        }
+    }
+
+
+    public static Map<String, List<String>> getMultipleValuesFromXML(
+            InputStream is, String[] tagNames) {
+        Map<String, List<String>> returnValues = new HashMap<String, List<String>>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    s_logger.error("no " + tagNames[i]
+                            + " tag in XML response...returning null");
+                } else {
+                    List<String> valueList = new ArrayList<String>();
+                    for (int j = 0; j < targetNodes.getLength(); j++) {
+                        Node node = targetNodes.item(j);
+                        valueList.add(node.getTextContent());
+                    }
+                    returnValues.put(tagNames[i], valueList);
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+        return returnValues;
+    }
+
+    public static Map<String, String> getSingleValueFromXML(InputStream is,
+            String[] tagNames) {
+        Map<String, String> returnValues = new HashMap<String, String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    s_logger.error("no " + tagNames[i]
+                            + " tag in XML response...returning null");
+                } else {
+                    returnValues.put(tagNames[i], targetNodes.item(0)
+                            .getTextContent());
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error("error processing XML", ex);
+        }
+        return returnValues;
+    }
+
+    public static Map<String, String> getSingleValueFromXML(Element rootElement,
+            String[] tagNames) {
+        Map<String, String> returnValues = new HashMap<String, String>();
+        if (rootElement == null) {
+            s_logger.error("Root element is null, can't get single value from xml");
+            return null;
+        }
+        try {
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    s_logger.error("no " + tagNames[i]
+                            + " tag in XML response...returning null");
+                } else {
+                    returnValues.put(tagNames[i], targetNodes.item(0)
+                            .getTextContent());
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error("error processing XML", ex);
+        }
+        return returnValues;
+    }
+
+
+    private static List<String> getNonSourceNatIPs(InputStream is) {
+        List<String> returnValues = new ArrayList<String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            NodeList allocatedIpAddrNodes = rootElement
+                    .getElementsByTagName("publicipaddress");
+            for (int i = 0; i < allocatedIpAddrNodes.getLength(); i++) {
+                Node allocatedIpAddrNode = allocatedIpAddrNodes.item(i);
+                NodeList childNodes = allocatedIpAddrNode.getChildNodes();
+                String ipAddress = null;
+                boolean isSourceNat = true; // assume it's source nat until we
+                // find otherwise
+                for (int j = 0; j < childNodes.getLength(); j++) {
+                    Node n = childNodes.item(j);
+                    if ("ipaddress".equals(n.getNodeName())) {
+                        ipAddress = n.getTextContent();
+                    } else if ("issourcenat".equals(n.getNodeName())) {
+                        isSourceNat = Boolean.parseBoolean(n.getTextContent());
+                    }
+                }
+                if ((ipAddress != null) && !isSourceNat) {
+                    returnValues.add(ipAddress);
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+        return returnValues;
+    }
+
+    private static List<String> getSourceNatIPs(InputStream is) {
+        List<String> returnValues = new ArrayList<String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            NodeList allocatedIpAddrNodes = rootElement
+                    .getElementsByTagName("publicipaddress");
+            for (int i = 0; i < allocatedIpAddrNodes.getLength(); i++) {
+                Node allocatedIpAddrNode = allocatedIpAddrNodes.item(i);
+                NodeList childNodes = allocatedIpAddrNode.getChildNodes();
+                String ipAddress = null;
+                boolean isSourceNat = false; // assume it's *not* source nat until we find otherwise
+                for (int j = 0; j < childNodes.getLength(); j++) {
+                    Node n = childNodes.item(j);
+                    if ("ipaddress".equals(n.getNodeName())) {
+                        ipAddress = n.getTextContent();
+                    } else if ("issourcenat".equals(n.getNodeName())) {
+                        isSourceNat = Boolean.parseBoolean(n.getTextContent());
+                    }
+                }
+                if ((ipAddress != null) && isSourceNat) {
+                    returnValues.add(ipAddress);
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+        return returnValues;
+    }
+
+    private static String executeRegistration(String server, String username,
+            String password) throws HttpException, IOException {
+        String url = server + "?command=registerUserKeys&id=" + _userId.get().toString();
+        s_logger.info("registering: " + username);
+        String returnValue = null;
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> requestKeyValues = getSingleValueFromXML(is,
+                    new String[] { "apikey", "secretkey" });
+            _apiKey.set(requestKeyValues.get("apikey"));
+            returnValue = requestKeyValues.get("secretkey");
+        } else  {
+            s_logger.error("registration failed with error code: " + responseCode);
+        } 
+        return returnValue;
+    }
+
+    private static Integer executeDeployment(String server, String developerServer,
+            String username) throws HttpException, IOException {
+        // test steps:
+        // - create user
+        // - deploy Windows VM
+        // - deploy Linux VM
+        // - associate IP address
+        // - create two IP forwarding rules
+        // - create load balancer rule
+        // - list IP forwarding rules
+        // - list load balancer rules
+
+        // -----------------------------
+        // CREATE USER
+        // -----------------------------
+        String encodedUsername = URLEncoder.encode(username, "UTF-8");
+        String encryptedPassword = createMD5Password(username);
+        String encodedPassword = URLEncoder.encode(encryptedPassword, "UTF-8");
+
+        String url = server + "?command=createUser&username=" + encodedUsername
+                + "&password=" + encodedPassword
+                + "&firstname=Test&lastname=Test&email=test@vmops.com&domainId=1&accounttype=0"; 
+        if (accountName != null ) {
+            url = server + "?command=createUser&username=" + encodedUsername
+                    + "&password=" + encodedPassword
+                    + "&firstname=Test&lastname=Test&email=test@vmops.com&domainId=1&accounttype=0&account=" + accountName;
+        }
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        long userId = -1;
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> userIdValues = getSingleValueFromXML(is,
+                    new String[] { "id", "account" });
+            String userIdStr = userIdValues.get("id");
+            s_logger.info("created user " + username + " with id "+ userIdStr);
+            if (userIdStr != null) {
+                userId = Long.parseLong(userIdStr);
+                _userId.set(userId);
+                _account.set(userIdValues.get("account"));
+                if (userId == -1) {
+                    s_logger
+                    .error("create user (" + username + ") failed to retrieve a valid user id, aborting depolyment test");
+                    return -1;
+                }
+            }
+        } else  {
+            s_logger.error("create user test failed for user " + username + " with error code :" + responseCode);
+            return responseCode;
+        } 
+
+        _secretKey.set(executeRegistration(server, username, username));
+
+        if (_secretKey.get() == null) {
+            s_logger
+            .error("FAILED to retrieve secret key during registration, skipping user: "
+                    + username);
+            return -1;
+        } else {
+            s_logger.info("got secret key: " + _secretKey.get());
+            s_logger.info("got api key: " + _apiKey.get());
+        }
+
+
+        // ---------------------------------
+        // CREATE NETWORK GROUP AND ADD INGRESS RULE TO IT
+        // ---------------------------------
+        String networkAccount = null;
+        if (accountName != null) {
+            networkAccount = accountName;
+        }
+        else {
+            networkAccount = encodedUsername;
+        }
+        String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+        String requestToSign = "apikey=" + encodedApiKey
+                + "&command=createSecurityGroup&name=" + encodedUsername;
+        requestToSign = requestToSign.toLowerCase();
+        String signature = signRequest(requestToSign, _secretKey.get());
+        String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+        url = developerServer + "?command=createSecurityGroup&name=" + encodedUsername + "&apikey=" + encodedApiKey
+                + "&signature=" + encodedSignature;
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> values = getSingleValueFromXML(is,
+                    new String[] { "id" });
+
+            if (values.get("id") == null) {
+                s_logger.info("Create network rule response code: 401");
+                return 401;
+            }
+            else {
+                s_logger.info("Create security group response code: " + responseCode);
+            }
+        } else  {
+            s_logger.error("Create security group failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+
+        String encodedCidr = URLEncoder.encode("192.168.1.143/32", "UTF-8");
+        url = server + "?command=authorizeSecurityGroupIngress&cidrlist=" + encodedCidr + "&endport=22&" +
+                "securitygroupname=" + encodedUsername +"&protocol=tcp&startport=22&account=" + networkAccount + "&domainid=1";
+
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> values = getSingleValueFromXML(el,
+                    new String[] { "id" });
+
+            if (values.get("id") == null) {
+                s_logger.info("Authorise security group ingress response code: 401");
+                return 401;
+            }
+            else {
+                s_logger.info("Authorise security group ingress response code: " + responseCode);
+            }
+        } else  {
+            s_logger.error("Authorise security group ingress failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+
+
+        // ---------------------------------
+        // DEPLOY LINUX VM
+        // ---------------------------------
+        {
+            long templateId = 2;
+            String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
+            String encodedServiceOfferingId = URLEncoder.encode(""
+                    + serviceOfferingId, "UTF-8");
+            String encodedTemplateId = URLEncoder.encode("" + templateId,
+                    "UTF-8");
+            encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            requestToSign = "apikey=" + encodedApiKey
+                    + "&command=deployVirtualMachine&securitygrouplist=" + encodedUsername + "&serviceofferingid="
+                    + encodedServiceOfferingId + "&templateid="
+                    + encodedTemplateId + "&zoneid=" + encodedZoneId;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+            url = developerServer + "?command=deployVirtualMachine&securitygrouplist=" + encodedUsername + "&zoneid=" + encodedZoneId + "&serviceofferingid="
+                    + encodedServiceOfferingId + "&templateid="
+                    + encodedTemplateId + "&apikey=" + encodedApiKey
+                    + "&signature=" + encodedSignature;
+
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el,
+                        new String[] { "id", "ipaddress" });
+
+                if ((values.get("ipaddress") == null) || (values
+                        .get("id") == null)) {
+                    s_logger.info("deploy linux vm response code: 401");
+                    return 401;
+                }
+                else {
+                    s_logger.info("deploy linux vm response code: " + responseCode);
+                    long linuxVMId = Long.parseLong(values.get("id"));
+                    s_logger.info("got linux virtual machine id: " + linuxVMId);
+                    _linuxVmId.set(values.get("id"));
+                    _linuxIP.set(values.get("ipaddress"));
+                    _linuxPassword.set("rs-ccb35ea5");
+                }
+            } else  {
+                s_logger.error("deploy linux vm failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+
+
+
+        //Create a new volume
+        {
+            url = server + "?command=createVolume&diskofferingid=" + diskOfferingId + "&zoneid=" + zoneId + "&name=newvolume&account=" +  _account.get() + "&domainid=1";
+            s_logger.info("Creating volume....");
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el,
+                        new String[] { "id" });
+
+                if (values.get("id") == null) {
+                    s_logger.info("create volume response code: 401");
+                    return 401;
+                }
+                else {
+                    s_logger.info("create volume response code: " + responseCode);
+                    String volumeId = values.get("id");
+                    s_logger.info("got volume id: " + volumeId);
+                    _newVolume.set(volumeId);
+                }
+            } else  {
+                s_logger.error("create volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+
+        //attach a new volume to the vm
+        {
+            url = server + "?command=attachVolume&id=" + _newVolume.get() + "&virtualmachineid=" + _linuxVmId.get();
+            s_logger.info("Attaching volume with id " + _newVolume.get() + " to the vm " + _linuxVmId.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Attach data volume response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el,
+                        new String[] { "id" });
+
+                if (values.get("id") == null) {
+                    s_logger.info("Attach volume response code: 401");
+                    return 401;
+                }
+                else {
+                    s_logger.info("Attach volume response code: " + responseCode);
+                }
+            } else  {
+                s_logger.error("Attach volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+
+        //DEPLOY SECOND VM, ADD VOLUME TO IT
+
+        // ---------------------------------
+        // DEPLOY another linux vm
+        // ---------------------------------
+        {
+            long templateId = 2;
+            String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
+            String encodedServiceOfferingId = URLEncoder.encode(""
+                    + serviceOfferingId, "UTF-8");
+            String encodedTemplateId = URLEncoder.encode("" + templateId,
+                    "UTF-8");
+            encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            requestToSign = "apikey=" + encodedApiKey
+                    + "&command=deployVirtualMachine&securitygrouplist=" + encodedUsername + "&serviceofferingid="
+                    + encodedServiceOfferingId + "&templateid="
+                    + encodedTemplateId + "&zoneid=" + encodedZoneId;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+            url = developerServer + "?command=deployVirtualMachine&securitygrouplist=" + encodedUsername + "&zoneid=" + encodedZoneId + "&serviceofferingid="
+                    + encodedServiceOfferingId + "&templateid="
+                    + encodedTemplateId + "&apikey=" + encodedApiKey
+                    + "&signature=" + encodedSignature;
+
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el,
+                        new String[] { "id", "ipaddress" });
+
+                if ((values.get("ipaddress") == null) || (values
+                        .get("id") == null)) {
+                    s_logger.info("deploy linux vm response code: 401");
+                    return 401;
+                }
+                else {
+                    s_logger.info("deploy linux vm response code: " + responseCode);
+                    long linuxVMId = Long.parseLong(values.get("id"));
+                    s_logger.info("got linux virtual machine id: " + linuxVMId);
+                    _linuxVmId1.set(values.get("id"));
+                }
+            } else  {
+                s_logger.error("deploy linux vm failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+
+
+
+        //Create a new volume
+        {
+            url = server + "?command=createVolume&diskofferingid=" + diskOfferingId1 + "&zoneid=" + zoneId + "&name=newvolume1&account=" +  _account.get() + "&domainid=1";
+            s_logger.info("Creating volume....");
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el,
+                        new String[] { "id" });
+
+                if (values.get("id") == null) {
+                    s_logger.info("create volume response code: 401");
+                    return 401;
+                }
+                else {
+                    s_logger.info("create volume response code: " + responseCode);
+                    String volumeId = values.get("id");
+                    s_logger.info("got volume id: " + volumeId);
+                    _newVolume1.set(volumeId);
+                }
+            } else  {
+                s_logger.error("create volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+
+        //attach a new volume to the vm
+        {
+            url = server + "?command=attachVolume&id=" + _newVolume1.get() + "&virtualmachineid=" + _linuxVmId1.get();
+            s_logger.info("Attaching volume with id " + _newVolume1.get() + " to the vm " + _linuxVmId1.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Attach data volume response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el,
+                        new String[] { "id" });
+
+                if (values.get("id") == null) {
+                    s_logger.info("Attach volume response code: 401");
+                    return 401;
+                }
+                else {
+                    s_logger.info("Attach volume response code: " + responseCode);
+                }
+            } else  {
+                s_logger.error("Attach volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+        return 200;
+    }			
+
+
+
+
+    private static int executeCleanup(String server, String developerServer, String username)
+            throws HttpException, IOException {
+        // test steps:
+        // - get user
+        // - delete user
+
+        // -----------------------------
+        // GET USER
+        // -----------------------------
+        String userId = _userId.get().toString();
+        String encodedUserId = URLEncoder.encode(userId, "UTF-8");
+        String url = server + "?command=listUsers&id=" + encodedUserId;
+        s_logger.info("Cleaning up resources for user: " + userId + " with url " + url);
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        s_logger.info("get user response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> userInfo = getSingleValueFromXML(is,
+                    new String[] { "username", "id", "account" });
+            if (!username.equals(userInfo.get("username"))) {
+                s_logger
+                .error("get user failed to retrieve requested user, aborting cleanup test" + ". Following URL was sent: " + url);
+                return -1;
+            }
+
+        } else  {
+            s_logger.error("get user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+        // -----------------------------
+        // UPDATE USER
+        // -----------------------------
+        {
+            url = server + "?command=updateUser&id=" + userId
+                    + "&firstname=delete&lastname=me";
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("update user response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is,
+                        new String[] { "success" });
+                s_logger
+                .info("update user..success? " + success.get("success"));
+            } else  {
+                s_logger.error("update user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+
+        // -----------------------------
+        // Execute reboot/stop/start commands for the VMs before deleting the account - made to exercise xen
+        // -----------------------------
+
+        //Reboot centos VM
+        String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+        String requestToSign = "apikey=" + encodedApiKey + "&command=rebootVirtualMachine&id=" + _linuxVmId.get();
+        requestToSign = requestToSign.toLowerCase();
+        String signature = signRequest(requestToSign, _secretKey.get());
+        String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=rebootVirtualMachine&id=" + _linuxVmId.get() + "&apikey="
+                + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Reboot VM response code: "
+                + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> success = getSingleValueFromXML(el,
+                    new String[] { "success" });
+            s_logger.info("VM was rebooted with the status: "
+                    + success.get("success"));
+        } else  {
+            s_logger.error(" VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+        //Stop centos VM
+        requestToSign = "apikey=" + encodedApiKey + "&command=stopVirtualMachine&id=" + _linuxVmId.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=stopVirtualMachine&id=" + _linuxVmId.get() + "&apikey="
+                + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Stop VM response code: "
+                + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> success = getSingleValueFromXML(el,
+                    new String[] { "success" });
+            s_logger.info("VM was stopped with the status: "
+                    + success.get("success"));
+        } else  {
+            s_logger.error("Stop VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+        //Start centos VM
+        requestToSign = "apikey=" + encodedApiKey + "&command=startVirtualMachine&id=" + _linuxVmId.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=startVirtualMachine&id=" + _linuxVmId.get() + "&apikey="
+                + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Start VM response code: "
+                + responseCode);
+
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> success = getSingleValueFromXML(el,
+                    new String[] { "id" });
+
+            if (success.get("id") == null) {
+                s_logger.info("Start linux vm response code: 401");
+                return 401;
+            }
+            else {
+                s_logger.info("Start vm response code: " + responseCode);
+            }
+
+            s_logger.info("VM was started with the status: "
+                    + success.get("success"));
+        } else  {
+            s_logger.error("Start VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+////		// -----------------------------
+////		// DISABLE USER
+////		// -----------------------------
+//		{
+//			url = server + "?command=disableUser&id=" + userId;
+//			client = new HttpClient();
+//			method = new GetMethod(url);
+//			responseCode = client.executeMethod(method);
+//			s_logger.info("disable user response code: " + responseCode);
+//			if (responseCode == 200) {
+//				InputStream input = method.getResponseBodyAsStream();
+//				Element el = queryAsyncJobResult(server, input);
+//				s_logger
+//						.info("Disabled user successfully");
+//			} else  {
+//				s_logger.error("disable user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+//				return responseCode;
+//			} 
+//		}
+
+        // -----------------------------
+        // DELETE USER
+        // -----------------------------
+        {
+            url = server + "?command=deleteUser&id=" + userId;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("delete user response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger
+                .info("Deleted user successfully");
+            } else  {
+                s_logger.error("delete user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+        }
+        return responseCode;
+    }
+
+    private static int executeEventsAndBilling(String server, String developerServer)
+            throws HttpException, IOException {
+        // test steps:
+        // - get all the events in the system for all users in the system
+        // - generate all the usage records in the system
+        // - get all the usage records in the system
+
+        // -----------------------------
+        // GET EVENTS
+        // -----------------------------
+        String url =server+"?command=listEvents&page=1&account=" + _account.get();
+
+        s_logger.info("Getting events for the account " + _account.get());
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        s_logger.info("get events response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, List<String>> eventDescriptions = getMultipleValuesFromXML(
+                    is, new String[] { "description" });
+            List<String> descriptionText = eventDescriptions.get("description");
+            if (descriptionText == null) {
+                s_logger.info("no events retrieved...");
+            } else {
+                for (String text : descriptionText) {
+                    s_logger.info("event: " + text);
+                }
+            }
+        } else  {
+            s_logger.error("list events failed with error code: " + responseCode + ". Following URL was sent: " + url);
+
+            return responseCode;
+        } 
+        return responseCode;
+    }
+
+
+    private static int executeStop(String server, String developerServer,
+            String username) throws HttpException, IOException {
+        // test steps:
+        // - get userId for the given username
+        // - list virtual machines for the user
+        // - stop all virtual machines
+        // - get ip addresses for the user
+        // - release ip addresses
+
+        // -----------------------------
+        // GET USER
+        // -----------------------------
+        String userId = _userId.get().toString();
+        String encodedUserId = URLEncoder.encode(userId, "UTF-8");
+
+        String url = server + "?command=listUsers&id=" + encodedUserId;
+        s_logger.info("Stopping resources for user: " + username);
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        s_logger.info("get user response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> userIdValues = getSingleValueFromXML(is,
+                    new String[] { "id" });
+            String userIdStr = userIdValues.get("id");
+            if (userIdStr != null) {
+                userId = userIdStr;
+                if (userId == null) {
+                    s_logger
+                    .error("get user failed to retrieve a valid user id, aborting depolyment test" + ". Following URL was sent: " + url);
+                    return -1;
+                }
+            }
+        } else  {
+            s_logger.error("get user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        } 
+
+        {
+            // ----------------------------------
+            // LIST VIRTUAL MACHINES
+            // ----------------------------------
+            String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            String requestToSign = "apikey=" + encodedApiKey
+                    + "&command=listVirtualMachines";
+            requestToSign = requestToSign.toLowerCase();
+            String signature = signRequest(requestToSign, _secretKey.get());
+            String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listVirtualMachines&apikey=" + encodedApiKey + "&signature="
+                    + encodedSignature;
+
+            s_logger.info("Listing all virtual machines for the user with url " + url);
+            String[] vmIds = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list virtual machines response code: "
+                    + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> vmIdValues = getMultipleValuesFromXML(
+                        is, new String[] { "id" });
+                if (vmIdValues.containsKey("id")) {
+                    List<String> vmIdList = vmIdValues.get("id");
+                    if (vmIdList != null) {
+                        vmIds = new String[vmIdList.size()];
+                        vmIdList.toArray(vmIds);
+                        String vmIdLogStr = "";
+                        if ((vmIds != null) && (vmIds.length > 0)) {
+                            vmIdLogStr = vmIds[0];
+                            for (int i = 1; i < vmIds.length; i++) {
+                                vmIdLogStr = vmIdLogStr + "," + vmIds[i];
+                            }
+                        }
+                        s_logger.info("got virtual machine ids: " + vmIdLogStr);
+                    }
+                }
+
+
+            } else  {
+                s_logger.error("list virtual machines test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            } 
+
+
+            // ----------------------------------
+            // STOP/DESTROY VIRTUAL MACHINES
+            // ----------------------------------
+            if (vmIds != null) {
+                for (String vmId : vmIds) {
+                    requestToSign = "apikey=" + encodedApiKey + "&command=stopVirtualMachine&id=" + vmId;
+                    requestToSign = requestToSign.toLowerCase();
+                    signature = signRequest(requestToSign, _secretKey.get());
+                    encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                    url = developerServer + "?command=stopVirtualMachine&id=" + vmId + "&apikey="
+                            + encodedApiKey + "&signature=" + encodedSignature;
+                    client = new HttpClient();
+                    method = new GetMethod(url);
+                    responseCode = client.executeMethod(method);
+                    s_logger.info("StopVirtualMachine" + " [" + vmId + "] response code: "
+                            + responseCode);
+                    if (responseCode == 200) {
+                        InputStream input = method.getResponseBodyAsStream();
+                        Element el = queryAsyncJobResult(server, input);
+                        Map<String, String> success = getSingleValueFromXML(el,
+                                new String[] { "success" });
+                        s_logger.info("StopVirtualMachine..success? "
+                                + success.get("success"));
+                    } else  {
+                        s_logger.error("Stop virtual machine test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                        return responseCode;
+                    } 
+                }
+            }
+
+//			{
+//				url = server + "?command=deleteUser&id=" + userId;
+//				client = new HttpClient();
+//				method = new GetMethod(url);
+//				responseCode = client.executeMethod(method);
+//				s_logger.info("delete user response code: " + responseCode);
+//				if (responseCode == 200) {
+//					InputStream input = method.getResponseBodyAsStream();
+//					Element el = queryAsyncJobResult(server, input);
+//					s_logger
+//							.info("Deleted user successfully");
+//				} else  {
+//					s_logger.error("delete user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+//					return responseCode;
+//				} 
+//			}
+
+
+        }
+
+        _linuxIP.set("");
+        _linuxVmId.set("");
+        _linuxPassword.set("");
+        _windowsIP.set("");
+        _secretKey.set("");
+        _apiKey.set("");
+        _userId.set(Long.parseLong("0"));
+        _account.set("");
+        _domainRouterId.set("");
+        return responseCode;
+    }
+
+    public static String signRequest(String request, String key) {
+        try {
+            Mac mac = Mac.getInstance("HmacSHA1");
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(),
+                    "HmacSHA1");
+            mac.init(keySpec);
+            mac.update(request.getBytes());
+            byte[] encryptedBytes = mac.doFinal();
+            return Base64.encodeBase64String(encryptedBytes);
+        } catch (Exception ex) {
+            s_logger.error("unable to sign request", ex);
+        }
+        return null;
+    }
+
+    private static String sshWinTest(String host) {
+        if (host == null) {
+            s_logger
+            .info("Did not receive a host back from test, ignoring win ssh test");
+            return null;
+        }
+
+        // We will retry 5 times before quitting
+        int retry = 1;
+
+        while (true) {
+            try {
+                if (retry > 0) {
+                    s_logger.info("Retry attempt : " + retry
+                            + " ...sleeping 300 seconds before next attempt. Account is " + _account.get());
+                    Thread.sleep(300000);
+                }
+
+                s_logger.info("Attempting to SSH into windows host " + host
+                        + " with retry attempt: " + retry + " for account " + _account.get());
+
+                Connection conn = new Connection(host);
+                conn.connect(null, 60000, 60000);
+
+                s_logger.info("User " + _account.get() + " ssHed successfully into windows host " + host);
+                boolean success = false;
+                boolean isAuthenticated = conn.authenticateWithPassword(
+                        "Administrator", "password");
+                if (isAuthenticated == false) {
+                    return "Authentication failed";
+                }
+                else {
+                    s_logger.info("Authentication is successfull");
+                }
+
+                try {
+                    SCPClient scp = new SCPClient(conn);
+                    scp.put("wget.exe", "wget.exe", "C:\\Users\\Administrator", "0777");
+                    s_logger.info("Successfully put wget.exe file");
+                } catch (Exception ex) {
+                    s_logger.error("Unable to put wget.exe " + ex);
+                }
+
+                if (conn == null ){
+                    s_logger.error("Connection is null");
+                }
+                Session sess = conn.openSession();
+
+                s_logger.info("User + " + _account.get() + " executing : wget http://192.168.1.250/dump.bin");
+                sess
+                .execCommand("wget http://192.168.1.250/dump.bin && dir dump.bin");
+
+                InputStream stdout = sess.getStdout();
+                InputStream stderr = sess.getStderr();
+
+                byte[] buffer = new byte[8192];
+                while (true) {
+                    if ((stdout.available() == 0) && (stderr.available() == 0)) {
+                        int conditions = sess.waitForCondition(
+                                ChannelCondition.STDOUT_DATA
+                                | ChannelCondition.STDERR_DATA
+                                | ChannelCondition.EOF, 120000);
+
+                        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+                            s_logger
+                            .info("Timeout while waiting for data from peer.");
+                            return null;
+                        }
+
+                        if ((conditions & ChannelCondition.EOF) != 0) {
+                            if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+                                break;
+                            }
+                        }
+                    }
+
+                    while (stdout.available() > 0) {
+                        success = true;
+                        int len = stdout.read(buffer);
+                        if (len > 0) // this check is somewhat paranoid
+                            s_logger.info(new String(buffer, 0, len));
+                    }
+
+                    while (stderr.available() > 0) {
+                        /* int len = */stderr.read(buffer);
+                    }
+                }
+                sess.close();
+                conn.close();
+
+                if (success) {
+                    Thread.sleep(120000);
+                    return null;
+                } else {
+                    retry++;
+                    if (retry == MAX_RETRY_WIN) {
+                        return "SSH Windows Network test fail for account " + _account.get();
+                    }
+                }
+            } catch (Exception e) {
+                s_logger.error(e);
+                retry++;
+                if (retry == MAX_RETRY_WIN) {
+                    return "SSH Windows Network test fail with error "
+                            + e.getMessage();
+                }
+            }
+        }
+    }
+
+    private static String sshTest(String host, String password) {
+        int i = 0;
+        if (host == null) {
+            s_logger
+            .info("Did not receive a host back from test, ignoring ssh test");
+            return null;
+        }
+
+        if (password == null){
+            s_logger.info("Did not receive a password back from test, ignoring ssh test");
+            return null;
+        }
+
+        // We will retry 5 times before quitting
+        String result  = null;
+        int retry = 0;
+
+        while (true) {
+            try {
+                if (retry > 0) {
+                    s_logger.info("Retry attempt : " + retry
+                            + " ...sleeping 120 seconds before next attempt. Account is " + _account.get());
+                    Thread.sleep(120000);
+                }
+
+                s_logger.info("Attempting to SSH into linux host " + host
+                        + " with retry attempt: " + retry + ". Account is " + _account.get());
+
+                Connection conn = new Connection(host);
+                conn.connect(null, 60000, 60000);
+
+                s_logger.info("User + " + _account.get() + " ssHed successfully into linux host " + host);
+
+                boolean isAuthenticated = conn.authenticateWithPassword("root",
+                        password);
+
+                if (isAuthenticated == false) {
+                    s_logger.info("Authentication failed for root with password" + password);
+                    return "Authentication failed";
+
+                }
+
+                boolean success = false;
+                String linuxCommand = null;
+
+                if (i % 10 == 0) 
+                    linuxCommand = "rm -rf *; wget http://192.168.1.250/dump.bin && ls -al dump.bin";
+                else 
+                    linuxCommand = "wget http://192.168.1.250/dump.bin && ls -al dump.bin";
+
+                Session sess = conn.openSession();
+                s_logger.info("User " + _account.get() + " executing : " + linuxCommand);
+                sess.execCommand(linuxCommand);
+
+                InputStream stdout = sess.getStdout();
+                InputStream stderr = sess.getStderr();
+
+
+                byte[] buffer = new byte[8192];
+                while (true) {
+                    if ((stdout.available() == 0) && (stderr.available() == 0)) {
+                        int conditions = sess.waitForCondition(
+                                ChannelCondition.STDOUT_DATA
+                                | ChannelCondition.STDERR_DATA
+                                | ChannelCondition.EOF, 120000);
+
+                        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+                            s_logger
+                            .info("Timeout while waiting for data from peer.");
+                            return null;
+                        }
+
+                        if ((conditions & ChannelCondition.EOF) != 0) {
+                            if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+                                break;
+                            }
+                        }
+                    }
+
+                    while (stdout.available() > 0) {
+                        success = true;
+                        int len = stdout.read(buffer);
+                        if (len > 0) // this check is somewhat paranoid
+                            s_logger.info(new String(buffer, 0, len));
+                    }
+
+                    while (stderr.available() > 0) {
+                        /* int len = */stderr.read(buffer);
+                    }
+                }
+
+                sess.close();
+                conn.close();
+
+                if (!success) {
+                    retry++;
+                    if (retry == MAX_RETRY_LINUX) {
+                        result = "SSH Linux Network test fail";
+                    }
+                }
+
+                return result;
+            } catch (Exception e) {
+                retry++;
+                s_logger.error("SSH Linux Network test fail with error");
+                if (retry == MAX_RETRY_LINUX) {
+                    return "SSH Linux Network test fail with error "
+                            + e.getMessage();
+                }
+            }
+            i++;
+        }
+    }
+
+    public static String createMD5Password(String password) {
+        MessageDigest md5;
+
+        try {
+            md5 = MessageDigest.getInstance("MD5");
+        } catch (NoSuchAlgorithmException e) {
+            throw new CloudRuntimeException("Error", e);
+        }
+
+        md5.reset();
+        BigInteger pwInt = new BigInteger(1, md5.digest(password.getBytes()));
+
+        // make sure our MD5 hash value is 32 digits long...
+        StringBuffer sb = new StringBuffer();
+        String pwStr = pwInt.toString(16);
+        int padding = 32 - pwStr.length();
+        for (int i = 0; i < padding; i++) {
+            sb.append('0');
+        }
+        sb.append(pwStr);
+        return sb.toString();
+    }
+
+
+    public static Element queryAsyncJobResult (String host, InputStream inputStream) {
+        Element returnBody = null;
+
+        Map<String, String> values = getSingleValueFromXML(inputStream,
+                new String[] { "jobid" });
+        String jobId = values.get("jobid");
+
+        if (jobId == null) {
+            s_logger.error("Unable to get a jobId");
+            return null;
+        }
+
+        //s_logger.info("Job id is " + jobId); 
+        String resultUrl = host + "?command=queryAsyncJobResult&jobid=" + jobId;
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(resultUrl);
+        while (true) {
+            try {
+                client.executeMethod(method);
+                //s_logger.info("Method is executed successfully. Following url was sent " + resultUrl);
+                InputStream is = method.getResponseBodyAsStream();
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                Document doc = builder.parse(is);
+                returnBody = doc.getDocumentElement();
+                doc.getDocumentElement().normalize();
+                Element jobStatusTag = (Element) returnBody.getElementsByTagName("jobstatus").item(0);
+                String jobStatus = jobStatusTag.getTextContent();
+                if(jobStatus.equals("0")) {
+                    try {
+                        Thread.sleep(1000);
+                    } catch (InterruptedException e) {
+                    }
+                } else {
+                    break;
+                }
+
+            } catch (Exception ex) {
+                s_logger.error(ex);
+            }
+        }
+        return returnBody;
+    } 
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/TestClientWithAPI.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/TestClientWithAPI.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/TestClientWithAPI.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/TestClientWithAPI.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,2262 @@
+// 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.test.stress;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.apache.log4j.NDC;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.trilead.ssh2.ChannelCondition;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.SCPClient;
+import com.trilead.ssh2.Session;
+
+public class TestClientWithAPI {
+    private static long sleepTime = 180000L; // default 0
+    private static boolean cleanUp = true;
+    public static final Logger s_logger = Logger.getLogger(TestClientWithAPI.class);
+    private static boolean repeat = true;
+    private static int numOfUsers = 0;
+    private static String[] users = null;
+    private static boolean internet = false;
+    private static ThreadLocal<String> _linuxIP = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxIpId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxVmId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxPassword = new ThreadLocal<String>();
+    private static ThreadLocal<String> _windowsIP = new ThreadLocal<String>();
+    private static ThreadLocal<String> _windowsIpId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _windowsVmId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _secretKey = new ThreadLocal<String>();
+    private static ThreadLocal<String> _apiKey = new ThreadLocal<String>();
+    private static ThreadLocal<Long> _userId = new ThreadLocal<Long>();
+    private static ThreadLocal<Long> _accountId = new ThreadLocal<Long>();
+    private static ThreadLocal<String> _account = new ThreadLocal<String>();
+    private static ThreadLocal<String> _domainRouterId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _pfGroupId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _windowsLb = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linuxLb = new ThreadLocal<String>();
+    private static ThreadLocal<String> _dataVolume = new ThreadLocal<String>();
+    private static ThreadLocal<String> _rootVolume = new ThreadLocal<String>();
+    private static ThreadLocal<String> _newVolume = new ThreadLocal<String>();
+    private static ThreadLocal<String> _snapshot = new ThreadLocal<String>();
+    private static ThreadLocal<String> _volumeFromSnapshot = new ThreadLocal<String>();
+    private static ThreadLocal<String> _networkId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _publicIpId = new ThreadLocal<String>();
+    private static ThreadLocal<String> _winipfwdid = new ThreadLocal<String>();
+    private static ThreadLocal<String> _linipfwdid = new ThreadLocal<String>();
+    private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+    private static int usageIterator = 1;
+    private static int numThreads = 1;
+    private static int wait = 5000;
+    private static String accountName = null;
+    private static String zoneId = "1";
+    private static String snapshot_test = "no";
+    private static String serviceOfferingId = "1";
+    private static String diskOfferingId = "4";
+    private static String networkOfferingId = "6";
+    private static String vmPassword = "rs-ccb35ea5";
+    private static String downloadUrl = "192.168.1.250/dump.bin";
+
+    private static final int MAX_RETRY_LINUX = 10;
+    private static final int MAX_RETRY_WIN = 10;
+
+    public static void main(String[] args) {
+        String host = "http://localhost";
+        String port = "8092";
+        String devPort = "8080";
+        String apiUrl = "/client/api";
+
+        try {
+            // Parameters
+            List<String> argsList = Arrays.asList(args);
+            Iterator<String> iter = argsList.iterator();
+            while (iter.hasNext()) {
+                String arg = iter.next();
+                // host
+                if (arg.equals("-h")) {
+                    host = "http://" + iter.next();
+                }
+
+                if (arg.equals("-p")) {
+                    port = iter.next();
+                }
+                if (arg.equals("-dp")) {
+                    devPort = iter.next();
+                }
+
+                if (arg.equals("-t")) {
+                    numThreads = Integer.parseInt(iter.next());
+                }
+
+                if (arg.equals("-s")) {
+                    sleepTime = Long.parseLong(iter.next());
+                }
+                if (arg.equals("-a")) {
+                    accountName = iter.next();
+                }
+
+                if (arg.equals("-c")) {
+                    cleanUp = Boolean.parseBoolean(iter.next());
+                    if (!cleanUp)
+                        sleepTime = 0L; // no need to wait if we don't ever
+                    // cleanup
+                }
+
+                if (arg.equals("-r")) {
+                    repeat = Boolean.parseBoolean(iter.next());
+                }
+
+                if (arg.equals("-u")) {
+                    numOfUsers = Integer.parseInt(iter.next());
+                }
+
+                if (arg.equals("-i")) {
+                    internet = Boolean.parseBoolean(iter.next());
+                }
+
+                if (arg.equals("-w")) {
+                    wait = Integer.parseInt(iter.next());
+                }
+
+                if (arg.equals("-z")) {
+                    zoneId = iter.next();
+                }
+
+                if (arg.equals("-snapshot")) {
+                    snapshot_test = "yes";
+                }
+
+                if (arg.equals("-so")) {
+                    serviceOfferingId = iter.next();
+                }
+
+                if (arg.equals("-do")) {
+                    diskOfferingId = iter.next();
+                }
+
+                if (arg.equals("-no")) {
+                    networkOfferingId = iter.next();
+                }
+
+                if (arg.equals("-pass")) {
+                    vmPassword = iter.next();
+                }
+
+                if (arg.equals("-url")) {
+                    downloadUrl = iter.next();
+                }
+
+            }
+
+            final String server = host + ":" + port + "/";
+            final String developerServer = host + ":" + devPort + apiUrl;
+            s_logger.info("Starting test against server: " + server + " with " + numThreads + " thread(s)");
+            if (cleanUp)
+                s_logger.info("Clean up is enabled, each test will wait " + sleepTime + " ms before cleaning up");
+
+            if (numOfUsers > 0) {
+                s_logger.info("Pre-generating users for test of size : " + numOfUsers);
+                users = new String[numOfUsers];
+                Random ran = new Random();
+                for (int i = 0; i < numOfUsers; i++) {
+                    users[i] = Math.abs(ran.nextInt()) + "-user";
+                }
+            }
+
+            for (int i = 0; i < numThreads; i++) {
+                new Thread(new Runnable() {
+                    @Override
+                    public void run() {
+                        do {
+                            String username = null;
+                            try {
+                                long now = System.currentTimeMillis();
+                                Random ran = new Random();
+                                if (users != null) {
+                                    username = users[Math.abs(ran.nextInt()) % numOfUsers];
+                                } else {
+                                    username = Math.abs(ran.nextInt()) + "-user";
+                                }
+                                NDC.push(username);
+
+                                s_logger.info("Starting test for the user " + username);
+                                int response = executeDeployment(server, developerServer, username, snapshot_test);
+                                boolean success = false;
+                                String reason = null;
+
+                                if (response == 200) {
+                                    success = true;
+                                    if (internet) {
+                                        s_logger.info("Deploy successful...waiting 5 minute before SSH tests");
+                                        Thread.sleep(300000L); // Wait 60
+                                        // seconds so
+                                        // the windows VM
+                                        // can boot up and do a sys prep.
+
+                                        if (accountName == null) {
+                                            s_logger.info("Begin Linux SSH test for account " + _account.get());
+                                            reason = sshTest(_linuxIP.get(), _linuxPassword.get(), snapshot_test);
+                                        }
+
+                                        if (reason == null) {
+                                            s_logger.info("Linux SSH test successful for account " + _account.get());
+                                            s_logger.info("Begin WindowsSSH test for account " + _account.get());
+
+                                            reason = sshTest(_linuxIP.get(), _linuxPassword.get(), snapshot_test);
+                                            // reason = sshWinTest(_windowsIP.get());
+                                        }
+
+                                        // release the linux IP now...
+                                        _linuxIP.set(null);
+                                        // release the Windows IP now
+                                        _windowsIP.set(null);
+                                    }
+
+                                    // sleep for 3 min before getting the latest network stat
+                                    // s_logger.info("Sleeping for 5 min before getting the lates network stat for the account");
+                                    // Thread.sleep(300000);
+                                    // verify that network stat is correct for the user; if it's not - stop all the resources
+                                    // for the user
+                                    // if ((reason == null) && (getNetworkStat(server) == false) ) {
+                                    // s_logger.error("Stopping all the resources for the account " + _account.get() +
+                                    // " as network stat is incorrect");
+                                    // int stopResponseCode = executeStop(
+                                    // server, developerServer,
+                                    // username, false);
+                                    // s_logger
+                                    // .info("stop command finished with response code: "
+                                    // + stopResponseCode);
+                                    // success = false; // since the SSH test
+                                    //
+                                    // } else
+                                    if (reason == null) {
+                                        if (internet) {
+                                            s_logger.info("Windows SSH test successful for account " + _account.get());
+                                        } else {
+                                            s_logger.info("deploy test successful....now cleaning up");
+                                            if (cleanUp) {
+                                                s_logger.info("Waiting " + sleepTime + " ms before cleaning up vms");
+                                                Thread.sleep(sleepTime);
+                                            } else {
+                                                success = true;
+                                            }
+                                        }
+
+                                        if (usageIterator >= numThreads) {
+                                            int eventsAndBillingResponseCode = executeEventsAndBilling(server, developerServer);
+                                            s_logger.info("events and usage records command finished with response code: " + eventsAndBillingResponseCode);
+                                            usageIterator = 1;
+
+                                        } else {
+                                            s_logger.info("Skipping events and usage records for this user: usageIterator " + usageIterator + " and number of Threads " + numThreads);
+                                            usageIterator++;
+                                        }
+
+                                        if ((users == null) && (accountName == null)) {
+                                            s_logger.info("Sending cleanup command");
+                                            int cleanupResponseCode = executeCleanup(server, developerServer, username);
+                                            s_logger.info("cleanup command finished with response code: " + cleanupResponseCode);
+                                            success = (cleanupResponseCode == 200);
+                                        } else {
+                                            s_logger.info("Sending stop DomR / destroy VM command");
+                                            int stopResponseCode = executeStop(server, developerServer, username, true);
+                                            s_logger.info("stop(destroy) command finished with response code: " + stopResponseCode);
+                                            success = (stopResponseCode == 200);
+                                        }
+
+                                    } else {
+                                        // Just stop but don't destroy the
+                                        // VMs/Routers
+                                        s_logger.info("SSH test failed for account " + _account.get() + "with reason '" + reason + "', stopping VMs");
+                                        int stopResponseCode = executeStop(server, developerServer, username, false);
+                                        s_logger.info("stop command finished with response code: " + stopResponseCode);
+                                        success = false; // since the SSH test
+                                        // failed, mark the
+                                        // whole test as
+                                        // failure
+                                    }
+                                } else {
+                                    // Just stop but don't destroy the
+                                    // VMs/Routers
+                                    s_logger.info("Deploy test failed with reason '" + reason + "', stopping VMs");
+                                    int stopResponseCode = executeStop(server, developerServer, username, true);
+                                    s_logger.info("stop command finished with response code: " + stopResponseCode);
+                                    success = false; // since the deploy test
+                                    // failed, mark the
+                                    // whole test as failure
+                                }
+
+                                if (success) {
+                                    s_logger.info("***** Completed test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds");
+
+                                } else {
+                                    s_logger.info("##### FAILED test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds with reason : " + reason);
+                                }
+                                s_logger.info("Sleeping for " + wait + " seconds before starting next iteration");
+                                Thread.sleep(wait);
+                            } catch (Exception e) {
+                                s_logger.warn("Error in thread", e);
+                                try {
+                                    int stopResponseCode = executeStop(server, developerServer, username, true);
+                                    s_logger.info("stop response code: " + stopResponseCode);
+                                } catch (Exception e1) {
+                                }
+                            } finally {
+                                NDC.clear();
+                            }
+                        } while (repeat);
+                    }
+                }).start();
+            }
+        } catch (Exception e) {
+            s_logger.error(e);
+        }
+    }
+
+    public static Map<String, List<String>> getMultipleValuesFromXML(InputStream is, String[] tagNames) {
+        Map<String, List<String>> returnValues = new HashMap<String, List<String>>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement.getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    s_logger.error("no " + tagNames[i] + " tag in XML response...returning null");
+                } else {
+                    List<String> valueList = new ArrayList<String>();
+                    for (int j = 0; j < targetNodes.getLength(); j++) {
+                        Node node = targetNodes.item(j);
+                        valueList.add(node.getTextContent());
+                    }
+                    returnValues.put(tagNames[i], valueList);
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+        return returnValues;
+    }
+
+    public static Map<String, String> getSingleValueFromXML(InputStream is, String[] tagNames) {
+        Map<String, String> returnValues = new HashMap<String, String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement.getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    s_logger.error("no " + tagNames[i] + " tag in XML response...returning null");
+                } else {
+                    returnValues.put(tagNames[i], targetNodes.item(0).getTextContent());
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error("error processing XML", ex);
+        }
+        return returnValues;
+    }
+
+    public static Map<String, String> getSingleValueFromXML(Element rootElement, String[] tagNames) {
+        Map<String, String> returnValues = new HashMap<String, String>();
+        if (rootElement == null) {
+            s_logger.error("Root element is null, can't get single value from xml");
+            return null;
+        }
+        try {
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement.getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    s_logger.error("no " + tagNames[i] + " tag in XML response...returning null");
+                } else {
+                    returnValues.put(tagNames[i], targetNodes.item(0).getTextContent());
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error("error processing XML", ex);
+        }
+        return returnValues;
+    }
+
+    private static List<String> getNonSourceNatIPs(InputStream is) {
+        List<String> returnValues = new ArrayList<String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            NodeList allocatedIpAddrNodes = rootElement.getElementsByTagName("publicipaddress");
+            for (int i = 0; i < allocatedIpAddrNodes.getLength(); i++) {
+                Node allocatedIpAddrNode = allocatedIpAddrNodes.item(i);
+                NodeList childNodes = allocatedIpAddrNode.getChildNodes();
+                String ipAddress = null;
+                boolean isSourceNat = true; // assume it's source nat until we
+                // find otherwise
+                for (int j = 0; j < childNodes.getLength(); j++) {
+                    Node n = childNodes.item(j);
+                    if ("id".equals(n.getNodeName())) {
+                        //    if ("ipaddress".equals(n.getNodeName())) {
+                        ipAddress = n.getTextContent();
+                    } else if ("issourcenat".equals(n.getNodeName())) {
+                        isSourceNat = Boolean.parseBoolean(n.getTextContent());
+                    }
+                }
+                if ((ipAddress != null) && !isSourceNat) {
+                    returnValues.add(ipAddress);
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+        return returnValues;
+    }
+
+    private static List<String> getIPs(InputStream is, boolean sourceNat) {
+        List<String> returnValues = new ArrayList<String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            NodeList allocatedIpAddrNodes = rootElement.getElementsByTagName("publicipaddress");
+            for (int i = 0; i < allocatedIpAddrNodes.getLength(); i++) {
+                Node allocatedIpAddrNode = allocatedIpAddrNodes.item(i);
+                NodeList childNodes = allocatedIpAddrNode.getChildNodes();
+                String ipAddress = null;
+                String ipAddressId = null;
+                boolean isSourceNat = false; // assume it's *not* source nat until we find otherwise
+                for (int j = 0; j < childNodes.getLength(); j++) {
+                    Node n = childNodes.item(j);
+                    //Id is being used instead of ipaddress. Changes need to done later to ipaddress variable
+                    if ("id".equals(n.getNodeName())) 
+                    {
+                        ipAddressId = n.getTextContent();
+                    }
+                    else if("ipaddress".equals(n.getNodeName()))
+                    {
+                        ipAddress = n.getTextContent();
+                    }
+                    else if ("issourcenat".equals(n.getNodeName())) {
+                        isSourceNat = Boolean.parseBoolean(n.getTextContent());
+                    }
+                }
+                if ((ipAddress != null) && isSourceNat == sourceNat) {
+                    returnValues.add(ipAddressId);
+                    returnValues.add(ipAddress);
+                }
+            }
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+        return returnValues;
+    }
+
+    private static String executeRegistration(String server, String username, String password) throws HttpException, IOException {
+        String url = server + "?command=registerUserKeys&id=" + _userId.get().toString();
+        s_logger.info("registering: " + username);
+        String returnValue = null;
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> requestKeyValues = getSingleValueFromXML(is, new String[] { "apikey", "secretkey" });
+            _apiKey.set(requestKeyValues.get("apikey"));
+            returnValue = requestKeyValues.get("secretkey");
+        } else {
+            s_logger.error("registration failed with error code: " + responseCode);
+        }
+        return returnValue;
+    }
+
+    private static Integer executeDeployment(String server, String developerServer, String username, String snapshot_test) throws HttpException, IOException {
+        // test steps:
+        // - create user
+        // - deploy Windows VM
+        // - deploy Linux VM
+        // - associate IP address
+        // - create two IP forwarding rules
+        // - create load balancer rule
+        // - list IP forwarding rules
+        // - list load balancer rules
+
+        // -----------------------------
+        // CREATE ACCOUNT
+        // -----------------------------
+        String encodedUsername = URLEncoder.encode(username, "UTF-8");
+        String encryptedPassword = createMD5Password(username);
+        String encodedPassword = URLEncoder.encode(encryptedPassword, "UTF-8");
+
+        String url = server + "?command=createAccount&username=" + encodedUsername + "&account=" + encodedUsername + "&password=" + encodedPassword + "&firstname=Test&lastname=Test&email=test@vmops.com&domainId=1&accounttype=0";
+
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        long accountId = -1;
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> accountValues = getSingleValueFromXML(is, new String[] { "id", "name" });
+            String accountIdStr = accountValues.get("id");
+            s_logger.info("created account " + username + " with id " + accountIdStr);
+            if (accountIdStr != null) {
+                accountId = Long.parseLong(accountIdStr);
+                _accountId.set(accountId);
+                _account.set(accountValues.get("name"));
+                if (accountId == -1) {
+                    s_logger.error("create account (" + username + ") failed to retrieve a valid user id, aborting depolyment test");
+                    return -1;
+                }
+            }
+        } else {
+            s_logger.error("create account test failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
+            return -1;
+        }
+
+        // LIST JUST CREATED USER TO GET THE USER ID
+        url = server + "?command=listUsers&username=" + encodedUsername + "&account=" + encodedUsername + "&domainId=1";
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        long userId = -1;
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> userIdValues = getSingleValueFromXML(is, new String[] { "id" });
+            String userIdStr = userIdValues.get("id");
+            s_logger.info("listed user " + username + " with id " + userIdStr);
+            if (userIdStr != null) {
+                userId = Long.parseLong(userIdStr);
+                _userId.set(userId);
+                if (userId == -1) {
+                    s_logger.error("list user by username " + username + ") failed to retrieve a valid user id, aborting depolyment test");
+                    return -1;
+                }
+            }
+        } else {
+            s_logger.error("list user test failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
+            return -1;
+        }
+
+        _secretKey.set(executeRegistration(server, username, username));
+
+        if (_secretKey.get() == null) {
+            s_logger.error("FAILED to retrieve secret key during registration, skipping user: " + username);
+            return -1;
+        } else {
+            s_logger.info("got secret key: " + _secretKey.get());
+            s_logger.info("got api key: " + _apiKey.get());
+        }
+
+        // ---------------------------------
+        // CREATE VIRTUAL NETWORK
+        // ---------------------------------
+        url = server + "?command=createNetwork&networkofferingid=" + networkOfferingId + "&account=" + encodedUsername + "&domainId=1" + "&zoneId=" + zoneId + "&name=virtualnetwork-" + encodedUsername + "&displaytext=virtualnetwork-" + encodedUsername;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> networkValues = getSingleValueFromXML(is, new String[] { "id" });
+            String networkIdStr = networkValues.get("id");
+            s_logger.info("Created virtual network with name virtualnetwork-" + encodedUsername + " and id " + networkIdStr);
+            if (networkIdStr != null) {
+                _networkId.set(networkIdStr);
+            }
+        } else {
+            s_logger.error("Create virtual network failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
+            return -1;
+        }
+        /*
+        // ---------------------------------
+        // CREATE DIRECT NETWORK
+        // ---------------------------------
+        url = server + "?command=createNetwork&networkofferingid=" + networkOfferingId_dir + "&account=" + encodedUsername + "&domainId=1" + "&zoneId=" + zoneId + "&name=directnetwork-" + encodedUsername + "&displaytext=directnetwork-" + encodedUsername;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> networkValues = getSingleValueFromXML(is, new String[] { "id" });
+            String networkIdStr = networkValues.get("id");
+            s_logger.info("Created direct network with name directnetwork-" + encodedUsername + " and id " + networkIdStr);
+            if (networkIdStr != null) {
+                _networkId_dir.set(networkIdStr);
+            }
+        } else {
+            s_logger.error("Create direct network failed for account " + username + " with error code :" + responseCode + ", aborting deployment test. The command was sent with url " + url);
+            return -1;
+        }
+         */
+
+
+        // ---------------------------------
+        // DEPLOY LINUX VM
+        // ---------------------------------
+        String linuxVMPrivateIP = null;
+        {
+            // long templateId = 3;
+            long templateId = 4;
+            String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
+            String encodedServiceOfferingId = URLEncoder.encode("" + serviceOfferingId, "UTF-8");
+            String encodedTemplateId = URLEncoder.encode("" + templateId, "UTF-8");
+            String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            String encodedNetworkIds = URLEncoder.encode(_networkId.get()+",206","UTF-8");
+            String requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
+                    + "&zoneid=" + encodedZoneId;
+            requestToSign = requestToSign.toLowerCase();
+            String signature = signRequest(requestToSign, _secretKey.get());
+            String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+            url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid=" + encodedTemplateId
+                    + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el, new String[] { "id", "ipaddress" });
+
+                if ((values.get("ipaddress") == null) || (values.get("id") == null)) {
+                    s_logger.info("deploy linux vm response code: 401, the command was sent with url " + url);
+                    return 401;
+                } else {
+                    s_logger.info("deploy linux vm response code: " + responseCode);
+                    long linuxVMId = Long.parseLong(values.get("id"));
+                    s_logger.info("got linux virtual machine id: " + linuxVMId);
+                    _linuxVmId.set(values.get("id"));
+                    linuxVMPrivateIP = values.get("ipaddress");
+                    // _linuxPassword.set(values.get("password"));
+                    _linuxPassword.set(vmPassword);
+                    s_logger.info("got linux virtual machine password: " + _linuxPassword.get());
+                }
+            } else {
+                s_logger.error("deploy linux vm failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        {
+            // ---------------------------------
+            // ASSOCIATE IP for windows
+            // ---------------------------------
+            String ipAddr = null;
+
+            String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            String requestToSign = "apikey=" + encodedApiKey + "&command=associateIpAddress" + "&zoneid=" + zoneId;
+            requestToSign = requestToSign.toLowerCase();
+            String signature = signRequest(requestToSign, _secretKey.get());
+            String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=associateIpAddress" + "&apikey=" + encodedApiKey + "&zoneid=" + zoneId + "&signature=" + encodedSignature;
+
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                /*Asynchronous Job - Corresponding Changes Made*/
+                Element associpel = queryAsyncJobResult(server, is);
+                Map<String, String> values = getSingleValueFromXML(associpel, new String[] {"id", "ipaddress" });
+
+                if ((values.get("ipaddress") == null)|| (values.get("id") == null)) {
+                    s_logger.info("associate ip for Windows response code: 401, the command was sent with url " + url);
+                    return 401;
+                } 
+                else
+                {
+                    s_logger.info("Associate IP Address response code: " + responseCode);
+                    long publicIpId = Long.parseLong(values.get("id"));
+                    s_logger.info("Associate IP's Id: " + publicIpId);
+                    _publicIpId.set(values.get("id"));         
+                }	
+            } else {
+                s_logger.error("associate ip address for windows vm failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            String encodedPublicIpId = URLEncoder.encode(_publicIpId.get(), "UTF-8");
+            requestToSign = "apikey=" + encodedApiKey + "&command=listPublicIpAddresses"+"&id="+ encodedPublicIpId;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listPublicIpAddresses&apikey=" + encodedApiKey + "&id=" + encodedPublicIpId + "&signature=" + encodedSignature;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("url is " + url);
+            s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                //       InputStream ips = method.getResponseBodyAsStream();
+                List<String> ipAddressValues = getIPs(is, false);
+                //       List<String> ipAddressVals = getIPs(is, false, true);
+                if ((ipAddressValues != null) && !ipAddressValues.isEmpty()) {
+                    _windowsIpId.set(ipAddressValues.get(0));
+                    _windowsIP.set(ipAddressValues.get(1));
+                    s_logger.info("For Windows, using non-sourceNat IP address ID: " + ipAddressValues.get(0));
+                    s_logger.info("For Windows, using non-sourceNat IP address: " + ipAddressValues.get(1));
+                }
+            } else {
+                s_logger.error("list ip addresses failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ---------------------------------
+            // Use the SourceNat IP for linux
+            // ---------------------------------
+            {
+                requestToSign = "apikey=" + encodedApiKey + "&command=listPublicIpAddresses";
+                requestToSign = requestToSign.toLowerCase();
+                signature = signRequest(requestToSign, _secretKey.get());
+                encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                url = developerServer + "?command=listPublicIpAddresses&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+                client = new HttpClient();
+                method = new GetMethod(url);
+                responseCode = client.executeMethod(method);
+                s_logger.info("url is " + url);
+                s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+                if (responseCode == 200) {
+                    InputStream is = method.getResponseBodyAsStream();
+//                  InputStream ips = method.getResponseBodyAsStream();
+                    List<String> ipAddressValues = getIPs(is, true);
+//                    is = method.getResponseBodyAsStream();
+//                    List<String> ipAddressVals = getIPs(is, true, true);
+                    if ((ipAddressValues != null) && !ipAddressValues.isEmpty()) {
+                        _linuxIpId.set(ipAddressValues.get(0));
+                        _linuxIP.set(ipAddressValues.get(1));
+                        s_logger.info("For linux, using sourceNat IP address ID: " + ipAddressValues.get(0));
+                        s_logger.info("For linux, using sourceNat IP address: " + ipAddressValues.get(1));
+                    }
+                } else {
+                    s_logger.error("list ip addresses failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                    return responseCode;
+                }
+            }
+
+            //--------------------------------------------
+            // Enable Static NAT for the Source NAT Ip
+            //--------------------------------------------
+            String encodedSourceNatPublicIpId = URLEncoder.encode(_linuxIpId.get(), "UTF-8");
+
+            /*          requestToSign = "apikey=" + encodedApiKey + "&command=enableStaticNat"+"&id=" + encodedSourceNatPublicIpId + "&virtualMachineId=" + encodedVmId;;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=enableStaticNat&apikey=" + encodedApiKey + "&signature=" + encodedSignature + "&id=" + encodedSourceNatPublicIpId + "&virtualMachineId=" + encodedVmId;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("url is " + url);
+            s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
+                s_logger.info("Enable Static NAT..success? " + success.get("success"));
+            } else {
+                s_logger.error("Enable Static NAT failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+             */          
+            // -------------------------------------------------------------
+            // CREATE IP FORWARDING RULE -- Linux VM
+            // -------------------------------------------------------------
+            String encodedVmId = URLEncoder.encode(_linuxVmId.get(), "UTF-8");
+            String encodedIpAddress = URLEncoder.encode(_linuxIpId.get(), "UTF-8");
+            requestToSign = "apikey=" + encodedApiKey + "&command=createPortForwardingRule&ipaddressid=" + encodedIpAddress + "&privateport=22&protocol=TCP&publicport=22" + "&virtualmachineid=" + encodedVmId ;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=createPortForwardingRule&apikey=" + encodedApiKey + "&ipaddressid=" + encodedIpAddress + "&privateport=22&protocol=TCP&publicport=22&virtualmachineid=" + encodedVmId + "&signature=" + encodedSignature;
+
+            s_logger.info("Created port forwarding rule with " + url);
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el, new String[] {"id"});
+                s_logger.info("Port forwarding rule was assigned successfully to Linux VM");
+                long ipfwdid = Long.parseLong(values.get("id"));
+                s_logger.info("got Port Forwarding Rule's Id:" + ipfwdid);
+                _linipfwdid.set(values.get("id"));
+
+            } else {
+                s_logger.error("Port forwarding rule creation failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // Create snapshot recurring policy if needed; otherwise create windows vm
+            if (snapshot_test.equals("yes")) {
+
+                // list volumes for linux vm
+                {
+                    url = server + "?command=listVolumes&virtualMachineId=" + _linuxVmId.get() + "&type=root";
+                    s_logger.info("Getting rootDisk id of Centos vm");
+                    client = new HttpClient();
+                    method = new GetMethod(url);
+                    responseCode = client.executeMethod(method);
+                    s_logger.info("List volumes response code: " + responseCode);
+                    if (responseCode == 200) {
+                        InputStream is = method.getResponseBodyAsStream();
+                        Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
+                        if (success.get("id") == null) {
+                            s_logger.error("Unable to get root volume for linux vm. Followin url was sent: " + url);
+                        }
+                        s_logger.info("Got rootVolume for linux vm with id " + success.get("id"));
+                        _rootVolume.set(success.get("id"));
+                    } else {
+                        s_logger.error("List volumes for linux vm failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                        return responseCode;
+                    }
+                }
+                // Create recurring snapshot policy for linux vm
+                {
+                    String encodedTimeZone = URLEncoder.encode("America/Los Angeles", "UTF-8");
+                    url = server + "?command=createSnapshotPolicy&intervaltype=hourly&schedule=10&maxsnaps=4&volumeid=" + _rootVolume.get() + "&timezone=" + encodedTimeZone;
+                    s_logger.info("Creating recurring snapshot policy for linux vm ROOT disk");
+                    client = new HttpClient();
+                    method = new GetMethod(url);
+                    responseCode = client.executeMethod(method);
+                    s_logger.info("Create recurring snapshot policy for linux vm ROOT disk: " + responseCode);
+                    if (responseCode != 200) {
+                        s_logger.error("Create recurring snapshot policy for linux vm ROOT disk failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                        return responseCode;
+                    }
+                }
+            } else {
+                // ---------------------------------
+                // DEPLOY WINDOWS VM
+                // ---------------------------------
+                String windowsVMPrivateIP = null;
+                {
+                    // long templateId = 6;
+                    long templateId = 4;
+                    String encodedZoneId = URLEncoder.encode("" + zoneId, "UTF-8");
+                    String encodedServiceOfferingId = URLEncoder.encode("" + serviceOfferingId, "UTF-8");
+                    String encodedTemplateId = URLEncoder.encode("" + templateId, "UTF-8");
+                    encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+                    String encodedNetworkIds = URLEncoder.encode(_networkId.get()+",206","UTF-8");
+
+                    requestToSign = "apikey=" + encodedApiKey + "&command=deployVirtualMachine&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&serviceofferingid=" + encodedServiceOfferingId + "&templateid=" + encodedTemplateId
+                            + "&zoneid=" + encodedZoneId;
+                    requestToSign = requestToSign.toLowerCase();
+                    signature = signRequest(requestToSign, _secretKey.get());
+                    encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                    url = developerServer + "?command=deployVirtualMachine" + "&zoneid=" + encodedZoneId + "&serviceofferingid=" + encodedServiceOfferingId + "&diskofferingid=" + diskOfferingId + "&networkids=" + encodedNetworkIds + "&templateid="
+                            + encodedTemplateId + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+
+                    method = new GetMethod(url);
+                    responseCode = client.executeMethod(method);
+                    if (responseCode == 200) {
+                        InputStream input = method.getResponseBodyAsStream();
+                        Element el = queryAsyncJobResult(server, input);
+                        Map<String, String> values = getSingleValueFromXML(el, new String[] { "id", "ipaddress" });
+
+                        if ((values.get("ipaddress") == null) || (values.get("id") == null)) {
+                            s_logger.info("deploy windows vm response code: 401, the command was sent with url " + url);
+                            return 401;
+                        } else {
+                            s_logger.info("deploy windows vm response code: " + responseCode);
+                            windowsVMPrivateIP = values.get("ipaddress");
+                            long windowsVMId = Long.parseLong(values.get("id"));
+                            s_logger.info("got windows virtual machine id: " + windowsVMId);
+                            _windowsVmId.set(values.get("id"));
+                        }
+                    } else {
+                        s_logger.error("deploy windows vm failes with error code: " + responseCode + ". Following URL was sent: " + url);
+                        return responseCode;
+                    }
+                }
+
+                //--------------------------------------------
+                // Enable Static NAT for the Non Source NAT Ip
+                //--------------------------------------------
+
+                encodedVmId = URLEncoder.encode(_windowsVmId.get(), "UTF-8");
+                encodedPublicIpId = URLEncoder.encode(_publicIpId.get(), "UTF-8");
+                requestToSign = "apikey=" + encodedApiKey + "&command=enableStaticNat"+"&ipaddressid="+ encodedPublicIpId + "&virtualMachineId=" + encodedVmId;
+                requestToSign = requestToSign.toLowerCase();
+                signature = signRequest(requestToSign, _secretKey.get());
+                encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                url = developerServer + "?command=enableStaticNat&apikey=" + encodedApiKey + "&ipaddressid=" + encodedPublicIpId + "&signature=" + encodedSignature + "&virtualMachineId=" + encodedVmId;
+                client = new HttpClient();
+                method = new GetMethod(url);
+                responseCode = client.executeMethod(method);
+                s_logger.info("url is " + url);
+                s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+                if (responseCode == 200) {
+                    InputStream is = method.getResponseBodyAsStream();
+                    Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
+                    s_logger.info("Enable Static NAT..success? " + success.get("success"));
+                } else {
+                    s_logger.error("Enable Static NAT failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                    return responseCode;
+                }                                            
+
+
+                // -------------------------------------------------------------
+                // CREATE IP FORWARDING RULE -- Windows VM
+                // -------------------------------------------------------------
+
+                // create port forwarding rule for window vm
+                encodedIpAddress = URLEncoder.encode(_windowsIpId.get(), "UTF-8");
+                //encodedVmId = URLEncoder.encode(_windowsVmId.get(), "UTF-8");
+
+                requestToSign = "apikey=" + encodedApiKey + "&command=createIpForwardingRule&endPort=22&ipaddressid=" + encodedIpAddress + "&protocol=TCP&startPort=22";
+                requestToSign = requestToSign.toLowerCase();
+                signature = signRequest(requestToSign, _secretKey.get());
+                encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                url = developerServer + "?command=createIpForwardingRule&apikey=" + encodedApiKey + "&endPort=22&ipaddressid=" + encodedIpAddress + "&protocol=TCP&signature=" + encodedSignature + "&startPort=22";
+
+                s_logger.info("Created Ip forwarding rule with " + url);
+                method = new GetMethod(url);
+                responseCode = client.executeMethod(method);
+                if (responseCode == 200) {
+                    InputStream input = method.getResponseBodyAsStream();
+                    Element el = queryAsyncJobResult(server, input);
+                    Map<String, String> values = getSingleValueFromXML(el, new String[] {"id"});
+                    s_logger.info("Port forwarding rule was assigned successfully to Windows VM");
+                    long ipfwdid = Long.parseLong(values.get("id"));
+                    s_logger.info("got Ip Forwarding Rule's Id:" + ipfwdid);
+                    _winipfwdid.set(values.get("id"));
+                } else {
+                    s_logger.error("Port forwarding rule creation failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                    return responseCode;
+                }
+            }
+        }
+        return responseCode;
+    }
+
+    private static int executeCleanup(String server, String developerServer, String username) throws HttpException, IOException {
+        // test steps:
+        // - get user
+        // - delete user
+
+        // -----------------------------
+        // GET USER
+        // -----------------------------
+        String userId = _userId.get().toString();
+        String encodedUserId = URLEncoder.encode(userId, "UTF-8");
+        String url = server + "?command=listUsers&id=" + encodedUserId;
+        s_logger.info("Cleaning up resources for user: " + userId + " with url " + url);
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        s_logger.info("get user response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> userInfo = getSingleValueFromXML(is, new String[] { "username", "id", "account" });
+            if (!username.equals(userInfo.get("username"))) {
+                s_logger.error("get user failed to retrieve requested user, aborting cleanup test" + ". Following URL was sent: " + url);
+                return -1;
+            }
+
+        } else {
+            s_logger.error("get user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // -----------------------------
+        // UPDATE USER
+        // -----------------------------
+        {
+            url = server + "?command=updateUser&id=" + userId + "&firstname=delete&lastname=me";
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("update user response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
+                s_logger.info("update user..success? " + success.get("success"));
+            } else {
+                s_logger.error("update user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // -----------------------------
+        // Detach existin dataVolume, create a new volume, attach it to the vm
+        // -----------------------------
+        {
+            url = server + "?command=listVolumes&virtualMachineId=" + _linuxVmId.get() + "&type=dataDisk";
+            s_logger.info("Getting dataDisk id of Centos vm");
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("List volumes response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
+                s_logger.info("Got dataDiskVolume with id " + success.get("id"));
+                _dataVolume.set(success.get("id"));
+            } else {
+                s_logger.error("List volumes failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // Detach volume
+        {
+            url = server + "?command=detachVolume&id=" + _dataVolume.get();
+            s_logger.info("Detaching volume with id " + _dataVolume.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Detach data volume response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger.info("The volume was detached successfully");
+            } else {
+                s_logger.error("Detach data disk failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // Delete a volume
+        {
+            url = server + "?command=deleteVolume&id=" + _dataVolume.get();
+            s_logger.info("Deleting volume with id " + _dataVolume.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Delete data volume response code: " + responseCode);
+            if (responseCode == 200) {
+                s_logger.info("The volume was deleted successfully");
+            } else {
+                s_logger.error("Delete volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // Create a new volume
+        {
+            url = server + "?command=createVolume&diskofferingid=" + diskOfferingId + "&zoneid=" + zoneId + "&name=newvolume&account=" + _account.get() + "&domainid=1";
+            s_logger.info("Creating volume....");
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
+
+                if (values.get("id") == null) {
+                    s_logger.info("create volume response code: 401");
+                    return 401;
+                } else {
+                    s_logger.info("create volume response code: " + responseCode);
+                    long volumeId = Long.parseLong(values.get("id"));
+                    s_logger.info("got volume id: " + volumeId);
+                    _newVolume.set(values.get("id"));
+                }
+            } else {
+                s_logger.error("create volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // attach a new volume to the vm
+        {
+            url = server + "?command=attachVolume&id=" + _newVolume.get() + "&virtualmachineid=" + _linuxVmId.get();
+            s_logger.info("Attaching volume with id " + _newVolume.get() + " to the vm " + _linuxVmId.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Attach data volume response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger.info("The volume was attached successfully");
+            } else {
+                s_logger.error("Attach volume failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // Create a snapshot
+        // list volumes
+        {
+            url = server + "?command=listVolumes&virtualMachineId=" + _linuxVmId.get() + "&type=root";
+            s_logger.info("Getting rootDisk id of Centos vm");
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("List volumes response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
+                if (success.get("id") == null) {
+                    s_logger.error("Unable to get root volume. Followin url was sent: " + url);
+                }
+                s_logger.info("Got rootVolume with id " + success.get("id"));
+                _rootVolume.set(success.get("id"));
+            } else {
+                s_logger.error("List volumes failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // //Create snapshot from root disk volume
+        String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+        String requestToSign = "apikey=" + encodedApiKey + "&command=createSnapshot&volumeid=" + _rootVolume.get();
+        requestToSign = requestToSign.toLowerCase();
+        String signature = signRequest(requestToSign, _secretKey.get());
+        String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=createSnapshot&volumeid=" + _rootVolume.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Create snapshot response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
+
+            if (values.get("id") == null) {
+                s_logger.info("create snapshot response code: 401");
+                return 401;
+            } else {
+                s_logger.info("create snapshot response code: " + responseCode + ". Got snapshot with id " + values.get("id"));
+                _snapshot.set(values.get("id"));
+            }
+        } else {
+            s_logger.error("create snapshot failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // Create volume from the snapshot created on the previous step and attach it to the running vm
+        /*      encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+        requestToSign = "apikey=" + encodedApiKey + "&command=createVolume&name=" + _account.get() + "&snapshotid=" + _snapshot.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=createVolume&name=" + _account.get() + "&snapshotid=" + _snapshot.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Create volume from snapshot response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
+
+            if (values.get("id") == null) {
+                s_logger.info("create volume from snapshot response code: 401");
+                return 401;
+            } else {
+                s_logger.info("create volume from snapshot response code: " + responseCode + ". Got volume with id " + values.get("id") + ". The command was sent with url " + url);
+                _volumeFromSnapshot.set(values.get("id"));
+            }
+        } else {
+            s_logger.error("create volume from snapshot failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        {
+            url = server + "?command=attachVolume&id=" + _volumeFromSnapshot.get() + "&virtualmachineid=" + _linuxVmId.get();
+            s_logger.info("Attaching volume with id " + _volumeFromSnapshot.get() + " to the vm " + _linuxVmId.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Attach volume from snapshot to linux vm response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger.info("The volume created from snapshot was attached successfully to linux vm");
+            } else {
+                s_logger.error("Attach volume created from snapshot failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+         */
+        // -----------------------------
+        // Execute reboot/stop/start commands for the VMs before deleting the account - made to exercise xen
+        // -----------------------------
+
+        // Reboot windows VM
+        requestToSign = "apikey=" + encodedApiKey + "&command=rebootVirtualMachine&id=" + _windowsVmId.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=rebootVirtualMachine&id=" + _windowsVmId.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Reboot windows Vm response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> success = getSingleValueFromXML(el, new String[] { "success" });
+            s_logger.info("Windows VM was rebooted with the status: " + success.get("success"));
+        } else {
+            s_logger.error("Reboot windows VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // Stop centos VM
+        requestToSign = "apikey=" + encodedApiKey + "&command=stopVirtualMachine&id=" + _linuxVmId.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=stopVirtualMachine&id=" + _linuxVmId.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Stop linux Vm response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> success = getSingleValueFromXML(el, new String[] { "success" });
+            s_logger.info("Linux VM was stopped with the status: " + success.get("success"));
+        } else {
+            s_logger.error("Stop linux VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // Create private template from root disk volume
+        requestToSign = "apikey=" + encodedApiKey + "&command=createTemplate" + "&displaytext=" + _account.get() + "&name=" + _account.get() + "&ostypeid=11" + "&snapshotid=" + _snapshot.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=createTemplate" + "&displaytext=" + _account.get() + "&name=" + _account.get() + "&ostypeid=11" + "&snapshotid=" + _snapshot.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Create private template response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream input = method.getResponseBodyAsStream();
+            Element el = queryAsyncJobResult(server, input);
+            Map<String, String> values = getSingleValueFromXML(el, new String[] { "id" });
+
+            if (values.get("id") == null) {
+                s_logger.info("create private template response code: 401");
+                return 401;
+            } else {
+                s_logger.info("create private template response code: " + responseCode);
+            }
+        } else {
+            s_logger.error("create private template failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // Start centos VM
+        requestToSign = "apikey=" + encodedApiKey + "&command=startVirtualMachine&id=" + _windowsVmId.get();
+        requestToSign = requestToSign.toLowerCase();
+        signature = signRequest(requestToSign, _secretKey.get());
+        encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+        url = developerServer + "?command=startVirtualMachine&id=" + _windowsVmId.get() + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("Start linux Vm response code: " + responseCode);
+        if (responseCode != 200) {
+            s_logger.error("Start linux VM test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // get domainRouter id
+        {
+            url = server + "?command=listRouters&zoneid=" + zoneId + "&account=" + _account.get() + "&domainid=1";
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("List domain routers response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is, new String[] { "id" });
+                s_logger.info("Got the domR with id " + success.get("id"));
+                _domainRouterId.set(success.get("id"));
+            } else {
+                s_logger.error("List domain routers failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // reboot the domain router
+        {
+            url = server + "?command=rebootRouter&id=" + _domainRouterId.get();
+            s_logger.info("Rebooting domR with id " + _domainRouterId.get());
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("Reboot domain router response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger.info("Domain router was rebooted successfully");
+            } else {
+                s_logger.error("Reboot domain routers failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+
+        // -----------------------------
+        // DELETE ACCOUNT
+        // -----------------------------
+        {
+            url = server + "?command=deleteAccount&id=" + _accountId.get();
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("delete account response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger.info("Deleted account successfully");
+            } else {
+                s_logger.error("delete account failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+        }
+        return responseCode;
+    }
+
+    private static int executeEventsAndBilling(String server, String developerServer) throws HttpException, IOException {
+        // test steps:
+        // - get all the events in the system for all users in the system
+        // - generate all the usage records in the system
+        // - get all the usage records in the system
+
+        // -----------------------------
+        // GET EVENTS
+        // -----------------------------
+        String url = server + "?command=listEvents&page=1&pagesize=100&&account=" + _account.get();
+
+        s_logger.info("Getting events for the account " + _account.get());
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        s_logger.info("get events response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, List<String>> eventDescriptions = getMultipleValuesFromXML(is, new String[] { "description" });
+            List<String> descriptionText = eventDescriptions.get("description");
+            if (descriptionText == null) {
+                s_logger.info("no events retrieved...");
+            } else {
+                for (String text : descriptionText) {
+                    s_logger.info("event: " + text);
+                }
+            }
+        } else {
+            s_logger.error("list events failed with error code: " + responseCode + ". Following URL was sent: " + url);
+
+            return responseCode;
+        }
+
+        // -------------------------------------------------------------------------------------
+        // GENERATE USAGE RECORDS (note: typically this is done infrequently)
+        // -------------------------------------------------------------------------------------
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date currentDate = new Date();
+        String endDate = dateFormat.format(currentDate);
+        s_logger.info("Generating usage records from September 1st till " + endDate);
+        url = server + "?command=generateUsageRecords&startdate=2009-09-01&enddate=" + endDate; // generate
+        // all usage record till today
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("generate usage records response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> successStr = getSingleValueFromXML(is, new String[] { "success" });
+            s_logger.info("successfully generated usage records? " + successStr.get("success"));
+        } else {
+            s_logger.error("generate usage records failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        // Sleeping for a 2 minutes before getting a usage records from the database
+        try {
+            Thread.sleep(120000);
+        } catch (Exception ex) {
+            s_logger.error(ex);
+        }
+
+        // --------------------------------
+        // GET USAGE RECORDS
+        // --------------------------------
+        url = server + "?command=listUsageRecords&startdate=2009-09-01&enddate=" + endDate + "&account=" + _account.get() + "&domaindid=1";
+        s_logger.info("Getting all usage records with request: " + url);
+        client = new HttpClient();
+        method = new GetMethod(url);
+        responseCode = client.executeMethod(method);
+        s_logger.info("get usage records response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, List<String>> usageRecValues = getMultipleValuesFromXML(is, new String[] { "description", "usage" });
+            if ((usageRecValues.containsKey("description") == true) && (usageRecValues.containsKey("usage") == true)) {
+                List<String> descriptions = usageRecValues.get("description");
+                List<String> usages = usageRecValues.get("usage");
+                for (int i = 0; i < descriptions.size(); i++) {
+                    String desc = descriptions.get(i);
+                    String usage = "";
+                    if (usages != null) {
+                        if (i < usages.size()) {
+                            usage = ", usage: " + usages.get(i);
+                        }
+                    }
+                    s_logger.info("desc: " + desc + usage);
+                }
+            }
+
+        } else {
+            s_logger.error("list usage records failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        return responseCode;
+    }
+
+    private static boolean getNetworkStat(String server) {
+        try {
+            String url = server + "?command=listAccountStatistics&account=" + _account.get();
+            HttpClient client = new HttpClient();
+            HttpMethod method = new GetMethod(url);
+            int responseCode = client.executeMethod(method);
+            s_logger.info("listAccountStatistics response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> requestKeyValues = getSingleValueFromXML(is, new String[] { "receivedbytes", "sentbytes" });
+                int bytesReceived = Integer.parseInt(requestKeyValues.get("receivedbytes"));
+                int bytesSent = Integer.parseInt(requestKeyValues.get("sentbytes"));
+                if ((bytesReceived > 100000000) && (bytesSent > 0)) {
+                    s_logger.info("Network stat is correct for account" + _account.get() + "; bytest received is " + bytesReceived + " and bytes sent is " + bytesSent);
+                    return true;
+                } else {
+                    s_logger.error("Incorrect value for bytes received/sent for the account " + _account.get() + ". We got " + bytesReceived + " bytes received; " + " and " + bytesSent + " bytes sent");
+                    return false;
+                }
+
+            } else {
+                s_logger.error("listAccountStatistics failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return false;
+            }
+        } catch (Exception ex) {
+            s_logger.error("Exception while sending command listAccountStatistics");
+            return false;
+        }
+    }
+
+    private static int executeStop(String server, String developerServer, String username, boolean destroy) throws HttpException, IOException {
+        // test steps:
+        // - get userId for the given username
+        // - list virtual machines for the user
+        // - stop all virtual machines
+        // - get ip addresses for the user
+        // - release ip addresses
+
+        // -----------------------------
+        // GET USER
+        // -----------------------------
+        String userId = _userId.get().toString();
+        String encodedUserId = URLEncoder.encode(userId, "UTF-8");
+
+        String url = server + "?command=listUsers&id=" + encodedUserId;
+        s_logger.info("Stopping resources for user: " + username);
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(url);
+        int responseCode = client.executeMethod(method);
+        s_logger.info("get user response code: " + responseCode);
+        if (responseCode == 200) {
+            InputStream is = method.getResponseBodyAsStream();
+            Map<String, String> userIdValues = getSingleValueFromXML(is, new String[] { "id" });
+            String userIdStr = userIdValues.get("id");
+            if (userIdStr != null) {
+                userId = userIdStr;
+
+            } else {
+                s_logger.error("get user failed to retrieve a valid user id, aborting depolyment test" + ". Following URL was sent: " + url);
+                return -1;
+            }
+        } else {
+            s_logger.error("get user failed with error code: " + responseCode + ". Following URL was sent: " + url);
+            return responseCode;
+        }
+
+        {
+            // ----------------------------------
+            // LIST VIRTUAL MACHINES
+            // ----------------------------------
+            String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            String requestToSign = "apikey=" + encodedApiKey + "&command=listVirtualMachines";
+            requestToSign = requestToSign.toLowerCase();
+            String signature = signRequest(requestToSign, _secretKey.get());
+            String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listVirtualMachines&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+
+            s_logger.info("Listing all virtual machines for the user with url " + url);
+            String[] vmIds = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list virtual machines response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> vmIdValues = getMultipleValuesFromXML(is, new String[] { "id" });
+                if (vmIdValues.containsKey("id")) {
+                    List<String> vmIdList = vmIdValues.get("id");
+                    if (vmIdList != null) {
+                        vmIds = new String[vmIdList.size()];
+                        vmIdList.toArray(vmIds);
+                        String vmIdLogStr = "";
+                        if ((vmIds != null) && (vmIds.length > 0)) {
+                            vmIdLogStr = vmIds[0];
+                            for (int i = 1; i < vmIds.length; i++) {
+                                vmIdLogStr = vmIdLogStr + "," + vmIds[i];
+                            }
+                        }
+                        s_logger.info("got virtual machine ids: " + vmIdLogStr);
+                    }
+                }
+
+            } else {
+                s_logger.error("list virtual machines test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // LIST USER IP ADDRESSES
+            // ----------------------------------
+
+            requestToSign = "apikey=" + encodedApiKey + "&command=listPublicIpAddresses";
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listPublicIpAddresses&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+            String[] ipAddresses = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> ipAddressValues = getMultipleValuesFromXML(is, new String[] { "ipaddress" });
+                if (ipAddressValues.containsKey("ipaddress")) {
+                    List<String> ipAddressList = ipAddressValues.get("ipaddress");
+                    if (ipAddressList != null) {
+                        ipAddresses = new String[ipAddressList.size()];
+                        ipAddressList.toArray(ipAddresses);
+                        String ipAddressLogStr = "";
+                        if ((ipAddresses != null) && (ipAddresses.length > 0)) {
+                            ipAddressLogStr = ipAddresses[0];
+                            for (int i = 1; i < ipAddresses.length; i++) {
+                                ipAddressLogStr = ipAddressLogStr + "," + ipAddresses[i];
+                            }
+                        }
+                        s_logger.info("got IP addresses: " + ipAddressLogStr);
+                    }
+                }
+
+            } else {
+                s_logger.error("list user ip addresses failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // LIST ZONES
+            // ----------------------------------
+
+            requestToSign = "apikey=" + encodedApiKey + "&command=listZones";
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listZones&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+            String[] zoneNames = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list zones response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> zoneNameValues = getMultipleValuesFromXML(is, new String[] { "name" });
+                if (zoneNameValues.containsKey("name")) {
+                    List<String> zoneNameList = zoneNameValues.get("name");
+                    if (zoneNameList != null) {
+                        zoneNames = new String[zoneNameList.size()];
+                        zoneNameList.toArray(zoneNames);
+                        String zoneNameLogStr = "\n\n";
+                        if ((zoneNames != null) && (zoneNames.length > 0)) {
+                            zoneNameLogStr += zoneNames[0];
+                            for (int i = 1; i < zoneNames.length; i++) {
+                                zoneNameLogStr = zoneNameLogStr + "\n" + zoneNames[i];
+                            }
+
+                        }
+                        zoneNameLogStr += "\n\n";
+                        s_logger.info("got zones names: " + zoneNameLogStr);
+                    }
+                }
+
+            } else {
+                s_logger.error("list zones failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // LIST ACCOUNT STATISTICS
+            // ----------------------------------
+
+            requestToSign = "apikey=" + encodedApiKey + "&command=listAccounts";
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listAccounts&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+            String[] statNames = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("listAccountStatistics response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> statValues = getMultipleValuesFromXML(is, new String[] { "receivedbytes" });
+                if (statValues.containsKey("receivedbytes")) {
+                    List<String> statList = statValues.get("receivedbytes");
+                    if (statList != null) {
+                        statNames = new String[statList.size()];
+                        statList.toArray(statNames);
+                        String statLogStr = "\n\n";
+                        if ((statNames != null) && (zoneNames.length > 0)) {
+                            statLogStr += statNames[0];
+                            for (int i = 1; i < statNames.length; i++) {
+                                statLogStr = statLogStr + "\n" + zoneNames[i];
+                            }
+
+                        }
+                        statLogStr += "\n\n";
+                        s_logger.info("got accountstatistics: " + statLogStr);
+                    }
+                }
+
+            } else {
+                s_logger.error("listAccountStatistics failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // LIST TEMPLATES
+            // ----------------------------------
+
+            requestToSign = "apikey=" + encodedApiKey + "&command=listTemplates@templatefilter=self";
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listTemplates&apikey=" + encodedApiKey + "&templatefilter=self&signature=" + encodedSignature;
+            String[] templateNames = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list templates response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> templateNameValues = getMultipleValuesFromXML(is, new String[] { "name" });
+
+                if (templateNameValues.containsKey("name")) {
+                    List<String> templateNameList = templateNameValues.get("name");
+                    if (templateNameList != null) {
+                        templateNames = new String[templateNameList.size()];
+                        templateNameList.toArray(templateNames);
+                        String templateNameLogStr = "\n\n";
+                        if ((templateNames != null) && (templateNames.length > 0)) {
+                            templateNameLogStr += templateNames[0];
+                            for (int i = 1; i < templateNames.length; i++) {
+                                templateNameLogStr = templateNameLogStr + "\n" + templateNames[i];
+                            }
+
+                        }
+                        templateNameLogStr += "\n\n";
+                        s_logger.info("got template names: " + templateNameLogStr);
+                    }
+                }
+
+            } else {
+                s_logger.error("list templates failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // LIST SERVICE OFFERINGS
+            // ----------------------------------
+
+            requestToSign = "apikey=" + encodedApiKey + "&command=listServiceOfferings";
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listServiceOfferings&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+            String[] serviceOfferingNames = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list service offerings response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> serviceOfferingNameValues = getMultipleValuesFromXML(is, new String[] { "name" });
+
+                if (serviceOfferingNameValues.containsKey("name")) {
+                    List<String> serviceOfferingNameList = serviceOfferingNameValues.get("name");
+                    if (serviceOfferingNameList != null) {
+                        serviceOfferingNames = new String[serviceOfferingNameList.size()];
+                        serviceOfferingNameList.toArray(serviceOfferingNames);
+                        String serviceOfferingNameLogStr = "";
+                        if ((serviceOfferingNames != null) && (serviceOfferingNames.length > 0)) {
+                            serviceOfferingNameLogStr = serviceOfferingNames[0];
+                            for (int i = 1; i < serviceOfferingNames.length; i++) {
+                                serviceOfferingNameLogStr = serviceOfferingNameLogStr + ", " + serviceOfferingNames[i];
+                            }
+                        }
+                        s_logger.info("got service offering names: " + serviceOfferingNameLogStr);
+                    }
+                }
+
+            } else {
+                s_logger.error("list service offerings failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // LIST EVENTS
+            // ---------------------------------
+
+            url = server + "?command=listEvents&page=1&pagesize=100&&account=" + _account.get();
+            String[] eventDescriptions = null;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list events response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, List<String>> eventNameValues = getMultipleValuesFromXML(is, new String[] { "description" });
+
+                if (eventNameValues.containsKey("description")) {
+                    List<String> eventNameList = eventNameValues.get("description");
+                    if (eventNameList != null) {
+                        eventDescriptions = new String[eventNameList.size()];
+                        eventNameList.toArray(eventDescriptions);
+                        String eventNameLogStr = "\n\n";
+                        if ((eventDescriptions != null) && (eventDescriptions.length > 0)) {
+                            eventNameLogStr += eventDescriptions[0];
+                            for (int i = 1; i < eventDescriptions.length; i++) {
+                                eventNameLogStr = eventNameLogStr + "\n" + eventDescriptions[i];
+                            }
+                        }
+                        eventNameLogStr += "\n\n";
+                        s_logger.info("got event descriptions: " + eventNameLogStr);
+                    }
+                }
+            } else {
+                s_logger.error("list events failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // ----------------------------------
+            // STOP/DESTROY VIRTUAL MACHINES
+            // ----------------------------------
+            if (vmIds != null) {
+                String cmdName = (destroy ? "destroyVirtualMachine" : "stopVirtualMachine");
+                for (String vmId : vmIds) {
+                    requestToSign = "apikey=" + encodedApiKey + "&command=" + cmdName + "&id=" + vmId;
+                    requestToSign = requestToSign.toLowerCase();
+                    signature = signRequest(requestToSign, _secretKey.get());
+                    encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                    url = developerServer + "?command=" + cmdName + "&id=" + vmId + "&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+                    client = new HttpClient();
+                    method = new GetMethod(url);
+                    responseCode = client.executeMethod(method);
+                    s_logger.info(cmdName + " [" + vmId + "] response code: " + responseCode);
+                    if (responseCode == 200) {
+                        InputStream input = method.getResponseBodyAsStream();
+                        Element el = queryAsyncJobResult(server, input);
+                        Map<String, String> success = getSingleValueFromXML(el, new String[] { "success" });
+                        s_logger.info(cmdName + "..success? " + success.get("success"));
+                    } else {
+                        s_logger.error(cmdName + "test failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                        return responseCode;
+                    }
+                }
+            }
+        }
+
+        {
+            String[] ipAddresses = null;
+            // -----------------------------------------
+            // LIST NAT IP ADDRESSES
+            // -----------------------------------------
+            String encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            String requestToSign = "apikey=" + encodedApiKey + "&command=listPublicIpAddresses";
+            requestToSign = requestToSign.toLowerCase();
+            String signature = signRequest(requestToSign, _secretKey.get());
+            String encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=listPublicIpAddresses&apikey=" + encodedApiKey + "&signature=" + encodedSignature;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+            if (responseCode == 200) {
+
+                InputStream is = method.getResponseBodyAsStream();
+                List<String> ipAddressList = getNonSourceNatIPs(is);
+                ipAddresses = new String[ipAddressList.size()];
+                ipAddressList.toArray(ipAddresses);
+                String ipAddrLogStr = "";
+                if ((ipAddresses != null) && (ipAddresses.length > 0)) {
+                    ipAddrLogStr = ipAddresses[0];
+                    for (int i = 1; i < ipAddresses.length; i++) {
+                        ipAddrLogStr = ipAddrLogStr + "," + ipAddresses[i];
+                    }
+                }
+                s_logger.info("got ip addresses: " + ipAddrLogStr);
+
+            } else {
+                s_logger.error("list nat ip addresses failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // -------------------------------------------------------------
+            // Delete IP FORWARDING RULE -- Windows VM
+            // -------------------------------------------------------------
+            String encodedIpFwdId = URLEncoder.encode(_winipfwdid.get(), "UTF-8");
+
+            requestToSign = "apikey=" + encodedApiKey + "&command=deleteIpForwardingRule&id=" + encodedIpFwdId;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=deleteIpForwardingRule&apikey=" + encodedApiKey + "&id=" + encodedIpFwdId + "&signature=" + encodedSignature;
+
+            s_logger.info("Delete Ip forwarding rule with " + url);
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            if (responseCode == 200) {
+                InputStream input = method.getResponseBodyAsStream();
+                Element el = queryAsyncJobResult(server, input);
+                s_logger.info("IP forwarding rule was successfully deleted");        
+
+            } else {
+                s_logger.error("IP forwarding rule creation failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            //--------------------------------------------
+            // Disable Static NAT for the Source NAT Ip
+            //--------------------------------------------
+            encodedApiKey = URLEncoder.encode(_apiKey.get(), "UTF-8");
+            String encodedPublicIpId = URLEncoder.encode(_publicIpId.get(), "UTF-8");       
+            requestToSign = "apikey=" + encodedApiKey + "&command=disableStaticNat"+"&id=" + encodedPublicIpId;
+            requestToSign = requestToSign.toLowerCase();
+            signature = signRequest(requestToSign, _secretKey.get());
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+            url = developerServer + "?command=disableStaticNat&apikey=" + encodedApiKey + "&id=" + encodedPublicIpId + "&signature=" + encodedSignature ;
+            client = new HttpClient();
+            method = new GetMethod(url);
+            responseCode = client.executeMethod(method);
+            s_logger.info("url is " + url);
+            s_logger.info("list ip addresses for user " + userId + " response code: " + responseCode);
+            if (responseCode == 200) {
+                InputStream is = method.getResponseBodyAsStream();
+                Map<String, String> success = getSingleValueFromXML(is, new String[] { "success" });
+                s_logger.info("Disable Static NAT..success? " + success.get("success"));
+            } else {
+                s_logger.error("Disable Static NAT failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                return responseCode;
+            }
+
+            // -----------------------------------------
+            // DISASSOCIATE IP ADDRESSES
+            // -----------------------------------------
+            if (ipAddresses != null) {
+                for (String ipAddress : ipAddresses) {
+                    requestToSign = "apikey=" + encodedApiKey + "&command=disassociateIpAddress&id=" + ipAddress;
+                    requestToSign = requestToSign.toLowerCase();
+                    signature = signRequest(requestToSign, _secretKey.get());
+                    encodedSignature = URLEncoder.encode(signature, "UTF-8");
+
+                    url = developerServer + "?command=disassociateIpAddress&apikey=" + encodedApiKey + "&id=" + ipAddress + "&signature=" + encodedSignature;
+                    client = new HttpClient();
+                    method = new GetMethod(url);
+                    responseCode = client.executeMethod(method);
+                    s_logger.info("disassociate ip address [" + userId + "/" + ipAddress + "] response code: " + responseCode);
+                    if (responseCode == 200) {
+                        InputStream input = method.getResponseBodyAsStream();
+                        Element disassocipel = queryAsyncJobResult(server, input);
+                        Map<String, String> success = getSingleValueFromXML(disassocipel, new String[] {"success"});
+                        //       Map<String, String> success = getSingleValueFromXML(input, new String[] { "success" });
+                        s_logger.info("disassociate ip address..success? " + success.get("success"));
+                    } else {
+                        s_logger.error("disassociate ip address failed with error code: " + responseCode + ". Following URL was sent: " + url);
+                        return responseCode;
+                    }
+                }
+            }
+        }
+        _linuxIP.set("");
+        _linuxIpId.set("");
+        _linuxVmId.set("");
+        _linuxPassword.set("");
+        _windowsIP.set("");
+        _windowsIpId.set("");
+        _windowsVmId.set("");
+        _secretKey.set("");
+        _apiKey.set("");
+        _userId.set(Long.parseLong("0"));
+        _account.set("");
+        _domainRouterId.set("");
+        return responseCode;
+    }
+
+    public static String signRequest(String request, String key) {
+        try {
+            Mac mac = Mac.getInstance("HmacSHA1");
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");
+            mac.init(keySpec);
+            mac.update(request.getBytes());
+            byte[] encryptedBytes = mac.doFinal();
+            return org.apache.commons.codec.binary.Base64.encodeBase64String(encryptedBytes);
+        } catch (Exception ex) {
+            s_logger.error("unable to sign request", ex);
+        }
+        return null;
+    }
+
+    private static String sshWinTest(String host) {
+        if (host == null) {
+            s_logger.info("Did not receive a host back from test, ignoring win ssh test");
+            return null;
+        }
+
+        // We will retry 5 times before quitting
+        int retry = 1;
+
+        while (true) {
+            try {
+                if (retry > 0) {
+                    s_logger.info("Retry attempt : " + retry + " ...sleeping 300 seconds before next attempt. Account is " + _account.get());
+                    Thread.sleep(300000);
+                }
+
+                s_logger.info("Attempting to SSH into windows host " + host + " with retry attempt: " + retry + " for account " + _account.get());
+
+                Connection conn = new Connection(host);
+                conn.connect(null, 60000, 60000);
+
+                s_logger.info("User " + _account.get() + " ssHed successfully into windows host " + host);
+                boolean success = false;
+                boolean isAuthenticated = conn.authenticateWithPassword("Administrator", "password");
+                if (isAuthenticated == false) {
+                    return "Authentication failed";
+                } else {
+                    s_logger.info("Authentication is successfull");
+                }
+
+                try {
+                    SCPClient scp = new SCPClient(conn);
+                    scp.put("wget.exe", "wget.exe", "C:\\Users\\Administrator", "0777");
+                    s_logger.info("Successfully put wget.exe file");
+                } catch (Exception ex) {
+                    s_logger.error("Unable to put wget.exe " + ex);
+                }
+
+                if (conn == null) {
+                    s_logger.error("Connection is null");
+                }
+                Session sess = conn.openSession();
+
+                s_logger.info("User + " + _account.get() + " executing : wget http://" + downloadUrl);
+                String downloadCommand = "wget http://" + downloadUrl + " && dir dump.bin";
+                sess.execCommand(downloadCommand);
+
+                InputStream stdout = sess.getStdout();
+                InputStream stderr = sess.getStderr();
+
+                byte[] buffer = new byte[8192];
+                while (true) {
+                    if ((stdout.available() == 0) && (stderr.available() == 0)) {
+                        int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, 120000);
+
+                        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+                            s_logger.info("Timeout while waiting for data from peer.");
+                            return null;
+                        }
+
+                        if ((conditions & ChannelCondition.EOF) != 0) {
+                            if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+                                break;
+                            }
+                        }
+                    }
+
+                    while (stdout.available() > 0) {
+                        success = true;
+                        int len = stdout.read(buffer);
+                        if (len > 0) // this check is somewhat paranoid
+                            s_logger.info(new String(buffer, 0, len));
+                    }
+
+                    while (stderr.available() > 0) {
+                        /* int len = */stderr.read(buffer);
+                    }
+                }
+                sess.close();
+                conn.close();
+
+                if (success) {
+                    return null;
+                } else {
+                    retry++;
+                    if (retry == MAX_RETRY_WIN) {
+                        return "SSH Windows Network test fail for account " + _account.get();
+                    }
+                }
+            } catch (Exception e) {
+                s_logger.error(e);
+                retry++;
+                if (retry == MAX_RETRY_WIN) {
+                    return "SSH Windows Network test fail with error " + e.getMessage();
+                }
+            }
+        }
+    }
+
+    private static String sshTest(String host, String password, String snapshot_test) {
+        int i = 0;
+        if (host == null) {
+            s_logger.info("Did not receive a host back from test, ignoring ssh test");
+            return null;
+        }
+
+        if (password == null) {
+            s_logger.info("Did not receive a password back from test, ignoring ssh test");
+            return null;
+        }
+
+        // We will retry 5 times before quitting
+        String result = null;
+        int retry = 0;
+
+        while (true) {
+            try {
+                if (retry > 0) {
+                    s_logger.info("Retry attempt : " + retry + " ...sleeping 120 seconds before next attempt. Account is " + _account.get());
+                    Thread.sleep(120000);
+                }
+
+                s_logger.info("Attempting to SSH into linux host " + host + " with retry attempt: " + retry + ". Account is " + _account.get());
+
+                Connection conn = new Connection(host);
+                conn.connect(null, 60000, 60000);
+
+                s_logger.info("User + " + _account.get() + " ssHed successfully into linux host " + host);
+
+                boolean isAuthenticated = conn.authenticateWithPassword("root", password);
+
+                if (isAuthenticated == false) {
+                    s_logger.info("Authentication failed for root with password" + password);
+                    return "Authentication failed";
+
+                }
+
+                boolean success = false;
+                String linuxCommand = null;
+
+                if (i % 10 == 0)
+                    linuxCommand = "rm -rf *; wget http://" + downloadUrl + " && ls -al dump.bin";
+                else
+                    linuxCommand = "wget http://" + downloadUrl + " && ls -al dump.bin";
+
+                Session sess = conn.openSession();
+                s_logger.info("User " + _account.get() + " executing : " + linuxCommand);
+                sess.execCommand(linuxCommand);
+
+                InputStream stdout = sess.getStdout();
+                InputStream stderr = sess.getStderr();
+
+                byte[] buffer = new byte[8192];
+                while (true) {
+                    if ((stdout.available() == 0) && (stderr.available() == 0)) {
+                        int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, 120000);
+
+                        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+                            s_logger.info("Timeout while waiting for data from peer.");
+                            return null;
+                        }
+
+                        if ((conditions & ChannelCondition.EOF) != 0) {
+                            if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+                                break;
+                            }
+                        }
+                    }
+
+                    while (stdout.available() > 0) {
+                        success = true;
+                        int len = stdout.read(buffer);
+                        if (len > 0) // this check is somewhat paranoid
+                            s_logger.info(new String(buffer, 0, len));
+                    }
+
+                    while (stderr.available() > 0) {
+                        /* int len = */stderr.read(buffer);
+                    }
+                }
+
+                sess.close();
+                conn.close();
+
+                if (!success) {
+                    retry++;
+                    if (retry == MAX_RETRY_LINUX) {
+                        result = "SSH Linux Network test fail";
+                    }
+                }
+
+                if (snapshot_test.equals("no"))
+                    return result;
+                else {
+                    Long sleep = 300000L;
+                    s_logger.info("Sleeping for " + sleep / 1000 / 60 + "minutes before executing next ssh test");
+                    Thread.sleep(sleep);
+                }
+            } catch (Exception e) {
+                retry++;
+                s_logger.error("SSH Linux Network test fail with error");
+                if ((retry == MAX_RETRY_LINUX) && (snapshot_test.equals("no"))) {
+                    return "SSH Linux Network test fail with error " + e.getMessage();
+                }
+            }
+            i++;
+        }
+    }
+
+    public static String createMD5Password(String password) {
+        MessageDigest md5;
+
+        try {
+            md5 = MessageDigest.getInstance("MD5");
+        } catch (NoSuchAlgorithmException e) {
+            throw new CloudRuntimeException("Error", e);
+        }
+
+        md5.reset();
+        BigInteger pwInt = new BigInteger(1, md5.digest(password.getBytes()));
+
+        // make sure our MD5 hash value is 32 digits long...
+        StringBuffer sb = new StringBuffer();
+        String pwStr = pwInt.toString(16);
+        int padding = 32 - pwStr.length();
+        for (int i = 0; i < padding; i++) {
+            sb.append('0');
+        }
+        sb.append(pwStr);
+        return sb.toString();
+    }
+
+    public static Element queryAsyncJobResult(String host, InputStream inputStream) {
+        Element returnBody = null;
+
+        Map<String, String> values = getSingleValueFromXML(inputStream, new String[] { "jobid" });
+        String jobId = values.get("jobid");
+
+        if (jobId == null) {
+            s_logger.error("Unable to get a jobId");
+            return null;
+        }
+
+        // s_logger.info("Job id is " + jobId);
+        String resultUrl = host + "?command=queryAsyncJobResult&jobid=" + jobId;
+        HttpClient client = new HttpClient();
+        HttpMethod method = new GetMethod(resultUrl);
+        while (true) {
+            try {
+                client.executeMethod(method);
+                // s_logger.info("Method is executed successfully. Following url was sent " + resultUrl);
+                InputStream is = method.getResponseBodyAsStream();
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                Document doc = builder.parse(is);
+                returnBody = doc.getDocumentElement();
+                doc.getDocumentElement().normalize();
+                Element jobStatusTag = (Element) returnBody.getElementsByTagName("jobstatus").item(0);
+                String jobStatus = jobStatusTag.getTextContent();
+                if (jobStatus.equals("0")) {
+                    try {
+                        Thread.sleep(1000);
+                    } catch (InterruptedException e) {
+                    }
+                } else {
+                    break;
+                }
+
+            } catch (Exception ex) {
+                s_logger.error(ex);
+            }
+        }
+        return returnBody;
+    }
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/WgetTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/WgetTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/stress/WgetTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/stress/WgetTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,161 @@
+// 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.test.stress;
+
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.trilead.ssh2.ChannelCondition;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.Session;
+
+public class WgetTest {
+	
+	public static int MAX_RETRY_LINUX = 1;
+	public static final Logger s_logger = Logger.getLogger(WgetTest.class.getName());
+	public static String host = "";
+	public static String password = "rs-ccb35ea5";
+	
+
+	
+	public static void main (String[] args) {
+		
+		// Parameters
+		List<String> argsList = Arrays.asList(args);
+		Iterator<String> iter = argsList.iterator();
+		while (iter.hasNext()) {
+			String arg = iter.next();
+			// host
+			if (arg.equals("-h")) {
+				host = iter.next();
+			}	
+			//password
+			
+			if (arg.equals("-p")) {
+				password = iter.next();
+			}	
+			
+		}
+	
+		int i = 0;
+		if (host == null || host.equals("")) {
+			s_logger
+					.info("Did not receive a host back from test, ignoring ssh test");
+			System.exit(2);
+		}
+		
+		if (password == null){
+			s_logger.info("Did not receive a password back from test, ignoring ssh test");
+			System.exit(2);
+		}
+		int retry = 0;
+
+			try {
+				if (retry > 0) {
+					s_logger.info("Retry attempt : " + retry
+							+ " ...sleeping 120 seconds before next attempt");
+					Thread.sleep(120000);
+				}
+
+				s_logger.info("Attempting to SSH into linux host " + host
+						+ " with retry attempt: " + retry);
+
+				Connection conn = new Connection(host);
+				conn.connect(null, 60000, 60000);
+
+				s_logger.info("User + ssHed successfully into linux host " + host);
+
+				boolean isAuthenticated = conn.authenticateWithPassword("root",
+						password);
+
+				if (isAuthenticated == false) {
+					s_logger.info("Authentication failed for root with password" + password);
+					System.exit(2);
+				}
+				
+				boolean success = false;
+				String linuxCommand = null;
+				
+				if (i % 10 == 0) 
+					linuxCommand = "rm -rf *; wget http://192.168.1.250/dump.bin && ls -al dump.bin";
+				else 
+					linuxCommand = "wget http://192.168.1.250/dump.bin && ls -al dump.bin";
+				
+				Session sess = conn.openSession();
+				sess.execCommand(linuxCommand);
+
+				InputStream stdout = sess.getStdout();
+				InputStream stderr = sess.getStderr();
+				
+
+				byte[] buffer = new byte[8192];
+				while (true) {
+					if ((stdout.available() == 0) && (stderr.available() == 0)) {
+						int conditions = sess.waitForCondition(
+								ChannelCondition.STDOUT_DATA
+										| ChannelCondition.STDERR_DATA
+										| ChannelCondition.EOF, 120000);
+
+						if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+							s_logger
+									.info("Timeout while waiting for data from peer.");
+							System.exit(2);
+						}
+
+						if ((conditions & ChannelCondition.EOF) != 0) {
+							if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+								break;
+							}
+						}
+					}
+
+					while (stdout.available() > 0) {
+						success = true;
+						int len = stdout.read(buffer);
+						if (len > 0) // this check is somewhat paranoid
+							s_logger.info(new String(buffer, 0, len));
+					}
+
+					while (stderr.available() > 0) {
+						/* int len = */stderr.read(buffer);
+					}
+				}
+
+				sess.close();
+				conn.close();
+				
+				if (!success) {
+					retry++;
+					if (retry == MAX_RETRY_LINUX) {
+						System.exit(2);
+					}
+				}
+			} catch (Exception e) {
+				retry++;
+				s_logger.error("SSH Linux Network test fail with error");
+				if (retry == MAX_RETRY_LINUX) {
+					s_logger.error("Ssh test failed");
+					System.exit(2);
+				}
+			}
+	}
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/AbstractSeleniumTestCase.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/AbstractSeleniumTestCase.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/AbstractSeleniumTestCase.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/AbstractSeleniumTestCase.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,60 @@
+// 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.test.ui;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import junit.framework.JUnit4TestAdapter;
+import org.openqa.selenium.server.SeleniumServer;
+import org.openqa.selenium.server.RemoteControlConfiguration;
+import org.junit.runners.Suite;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+@RunWith(JUnit4.class)
+public abstract class AbstractSeleniumTestCase {
+	protected static DefaultSelenium selenium;
+	private static SeleniumServer seleniumServer;
+
+	@BeforeClass
+	public static void setUp() throws Exception {
+		System.out.println("*** Starting selenium ... ***");
+		RemoteControlConfiguration seleniumConfig = new RemoteControlConfiguration();
+		seleniumConfig.setPort(4444);
+		seleniumServer = new SeleniumServer(seleniumConfig);
+		seleniumServer.start();
+
+		String host = System.getProperty("myParam", "localhost");
+		selenium = createSeleniumClient("http://" + host + ":" + "8080/client/");
+		selenium.start();
+		System.out.println("*** Started selenium ***");
+	}
+
+	@AfterClass
+	public static void tearDown() throws Exception {
+		selenium.stop();
+	}
+
+	protected static DefaultSelenium createSeleniumClient(String url)
+			throws Exception {
+		return new DefaultSelenium("localhost", 4444, "*firefox", url);
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/AddAndDeleteAISO.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/AddAndDeleteAISO.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/AddAndDeleteAISO.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/AddAndDeleteAISO.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,117 @@
+// 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.test.ui;
+
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import com.cloud.test.ui.AbstractSeleniumTestCase;
+import com.thoughtworks.selenium.SeleniumException;
+
+public class AddAndDeleteAISO extends AbstractSeleniumTestCase {
+
+	@Test
+	public void testAddAndDeleteISO() throws Exception {
+		try {
+			selenium.open("/client/");
+			selenium.type("account_username", "admin");
+			selenium.type("account_password", "password");
+			selenium.click("loginbutton");
+			Thread.sleep(3000);
+			assertTrue(selenium.isTextPresent("admin"));
+			selenium.click("//div[@id='leftmenu_templates']/div");
+			selenium.click("//div[@id='leftmenu_submenu_my_iso']/div/div[2]");
+			Thread.sleep(3000);
+			selenium.click("label");
+
+			selenium.type("add_iso_name", "abc");
+			selenium.type("add_iso_display_text", "abc");			
+			String iso_url = System.getProperty("add_iso_url", "http://10.91.28.6/ISO/Fedora-11-i386-DVD.iso");
+			selenium.type("add_iso_url", iso_url);
+			String iso_zone = System.getProperty("add_iso_zone", "All Zones");	
+			selenium.select("add_iso_zone", "label="+iso_zone);
+			String iso_os_type = System.getProperty("add_iso_os_type", "Fedora 11");			
+			selenium.select("add_iso_os_type", "label="+iso_os_type);
+			selenium.click("//div[28]/div[11]/button[1]");
+			Thread.sleep(3000);
+			int  i=1;
+			try
+			{
+				for(;;i++)
+				{
+					System.out.println("i=   "+i);
+					selenium.click("//div[" +i+ "]/div/div[2]/span/span");
+				}
+			}
+			catch(Exception ex) {				
+			}
+
+			for (int second = 0;; second++) {
+				if (second >= 60) fail("timeout");
+				try { if (selenium.isVisible("//div[@id='after_action_info_container_on_top']")) break; } catch (Exception e) {}
+				Thread.sleep(10000);
+			}
+
+			assertTrue(selenium.isTextPresent("Adding succeeded"));
+			Thread.sleep(3000);
+			int status=1;
+			while(!selenium.isTextPresent("Ready"))
+			{
+				for(int j =1;j<=i;j++)
+
+				{
+					if (selenium.isTextPresent("Ready"))	
+					{
+						status=0;
+						break;
+					}
+					selenium.click("//div["+j+"]/div/div[2]/span/span");
+				}
+				if(status==0){
+					break;
+				}
+				else
+				{
+					selenium.click("//div[@id='leftmenu_submenu_featured_iso']/div/div[2]");
+					Thread.sleep(3000);
+					selenium.click("//div[@id='leftmenu_submenu_my_iso']/div/div[2]");
+					Thread.sleep(3000);
+				}
+
+			}
+			selenium.click("link=Delete ISO");
+			selenium.click("//div[28]/div[11]/button[1]");
+			for (int second = 0;; second++) {
+				if (second >= 60) fail("timeout");
+				try { if (selenium.isVisible("after_action_info_container_on_top")) break; } catch (Exception e) {}
+				Thread.sleep(1000);
+			}
+
+			assertTrue(selenium.isTextPresent("Delete ISO action succeeded"));
+			selenium.click("main_logout");
+			selenium.waitForPageToLoad("30000");
+			assertTrue(selenium.isTextPresent("Welcome to Management Console"));
+
+		} catch (SeleniumException ex) {
+
+			System.err.println(ex.getMessage());
+			fail(ex.getMessage());
+
+			throw ex;
+		}
+	}
+}
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/AddAndDeleteATemplate.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/AddAndDeleteATemplate.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/AddAndDeleteATemplate.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/AddAndDeleteATemplate.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,115 @@
+// 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.test.ui;
+
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import com.cloud.test.ui.AbstractSeleniumTestCase;
+import com.thoughtworks.selenium.SeleniumException;
+
+public class AddAndDeleteATemplate extends AbstractSeleniumTestCase {
+
+	@Test
+	public void testAddAndDeleteTemplate() throws Exception {
+		try {
+			selenium.open("/client/");
+			selenium.type("account_username", "admin");
+			selenium.type("account_password", "password");
+			selenium.click("loginbutton");
+			Thread.sleep(3000);
+			assertTrue(selenium.isTextPresent("admin"));
+			selenium.click("//div[@id='leftmenu_templates']/div");
+			selenium.click("//div[@id='leftmenu_submenu_my_template']/div/div[2]");
+			Thread.sleep(3000);
+			selenium.click("label");
+			selenium.type("add_template_name", "abc");
+			selenium.type("add_template_display_text", "abc");
+			String template_url = System.getProperty("add_template_url", "http://10.91.28.6/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2");
+			selenium.type("add_template_url", template_url);
+			String template_zone = System.getProperty("add_template_zone", "All Zones");	
+			selenium.select("add_template_zone", "label="+template_zone);
+			String template_os_type = System.getProperty("add_template_os_type", "CentOS 5.3 (32-bit)");			
+			selenium.select("add_template_os_type", "label="+template_os_type);
+			selenium.click("//div[28]/div[11]/button[1]");
+			Thread.sleep(3000);
+			int  i=1;
+			try
+			{
+				for(;;i++)
+				{
+					System.out.println("i=   "+i);
+					selenium.click("//div[" +i+ "]/div/div[2]/span/span");
+				}
+			}
+			catch(Exception ex) {				
+			}
+
+			for (int second = 0;; second++) {
+				if (second >= 60) fail("timeout");
+				try { if (selenium.isVisible("//div[@id='after_action_info_container_on_top']")) break; } catch (Exception e) {}
+				Thread.sleep(10000);
+			}
+
+			assertTrue(selenium.isTextPresent("Adding succeeded"));
+			Thread.sleep(3000);
+			int status=1;
+			while(!selenium.isTextPresent("Ready"))
+			{
+				for(int j =1;j<=i;j++)
+
+				{
+					if (selenium.isTextPresent("Ready"))	
+					{
+						status=0;
+						break;
+					}
+					selenium.click("//div["+j+"]/div/div[2]/span/span");
+				}
+				if(status==0){
+					break;
+				}
+				else
+				{
+					selenium.click("//div[@id='leftmenu_submenu_featured_template']/div/div[2]");
+					Thread.sleep(3000);
+					selenium.click("//div[@id='leftmenu_submenu_my_template']/div/div[2]");
+					Thread.sleep(3000);
+				}
+
+			}
+			selenium.click("link=Delete Template");
+			selenium.click("//div[28]/div[11]/button[1]");
+			for (int second = 0;; second++) {
+				if (second >= 60) fail("timeout");
+				try { if (selenium.isVisible("after_action_info_container_on_top")) break; } catch (Exception e) {}
+				Thread.sleep(1000);
+			}
+
+			assertTrue(selenium.isTextPresent("Delete Template action succeeded"));
+			selenium.click("main_logout");
+			selenium.waitForPageToLoad("30000");
+			assertTrue(selenium.isTextPresent("Welcome to Management Console"));
+		} catch (SeleniumException ex) {
+
+			System.err.println(ex.getMessage());
+			fail(ex.getMessage());
+
+			throw ex;
+		}
+	}
+}
\ No newline at end of file
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/UIScenarioTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/UIScenarioTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/ui/UIScenarioTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/ui/UIScenarioTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,84 @@
+// 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.test.ui;
+
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import com.cloud.test.ui.AbstractSeleniumTestCase;
+import com.thoughtworks.selenium.SeleniumException;
+
+public class UIScenarioTest extends AbstractSeleniumTestCase {
+
+	@Test
+	public void testLoginStartStopVMScenario() throws Exception {
+		try {
+			selenium.open("/client/");
+			selenium.type("account_username", "admin");
+			selenium.type("account_password", "password");
+			selenium.click("loginbutton");
+			Thread.sleep(3000);
+			assertTrue(selenium.isTextPresent("admin"));
+			selenium.click("//div[@id='leftmenu_instances']/div");
+			selenium
+					.click("//div[@id='leftmenu_instances_stopped_instances']/div/span");
+
+			Thread.sleep(3000);
+			selenium.click("//div[@id='midmenu_startvm_link']/div/div[2]");
+			selenium.click("//div[39]/div[11]/button[1]");
+
+			for (int second = 0;; second++) {
+				if (second >= 60)
+					fail("timeout");
+				try {
+					if (selenium.isVisible("//div/p[@id='after_action_info']"))
+						break;
+				} catch (Exception e) {
+				}
+				Thread.sleep(10000);
+			}
+			assertTrue(selenium
+					.isTextPresent("Start Instance action succeeded"));
+			selenium
+					.click("//div[@id='leftmenu_instances_running_instances']/div/span");
+
+			Thread.sleep(3000);
+			selenium.click("//div[@id='midmenu_stopvm_link']/div/div[2]");
+			selenium.click("//div[39]/div[11]/button[1]");
+			for (int second = 0;; second++) {
+				if (second >= 60)
+					fail("timeout");
+				try {
+					if (selenium.isVisible("//div/p[@id='after_action_info']"))
+						break;
+				} catch (Exception e) {
+				}
+				Thread.sleep(10000);
+			}
+
+			assertTrue(selenium.isTextPresent("Stop Instance action succeeded"));
+			selenium.click("main_logout");
+			selenium.waitForPageToLoad("30000");
+			assertTrue(selenium.isTextPresent("Welcome to Management Console"));
+
+		} catch (SeleniumException ex) {
+			fail(ex.getMessage());
+			System.err.println(ex.getMessage());
+			throw ex;
+		}
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/ConsoleProxy.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/ConsoleProxy.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/ConsoleProxy.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/ConsoleProxy.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,114 @@
+// 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.test.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.utils.script.OutputInterpreter;
+import com.cloud.utils.script.Script;
+
+public class ConsoleProxy implements Runnable {
+	public static String proxyIp;
+	private String command;
+	private int connectionsMade;
+	private long responseTime;
+	public static final Logger s_logger = Logger.getLogger(ConsoleProxy.class
+			.getClass());
+
+	public ConsoleProxy(String port, String sid, String host) {
+		this.command = "https://" + proxyIp
+				+ ".realhostip.com:8000/getscreen?w=100&h=75&host=" + host
+				+ "&port=" + port + "&sid=" + sid;
+		s_logger.info("Command for a console proxy is " + this.command);
+		this.connectionsMade=0;
+		this.responseTime=0;
+	}
+
+	public int getConnectionsMade() {
+		return this.connectionsMade;
+	}
+	
+	public long getResponseTime() {
+		return this.responseTime;
+	}
+	
+	public void run() {
+		while (true){
+			
+			Script myScript = new Script("wget");
+			myScript.add(command);
+			myScript.execute();
+			long begin = System.currentTimeMillis();
+			wgetInt process = new wgetInt();
+			String response = myScript.execute(process);
+			long end = process.getEnd();
+			if (response!=null){
+				s_logger.info("Content lenght is incorrect: "+response);
+			}
+			
+			long duration = (end - begin);
+			this.connectionsMade++;
+			this.responseTime=this.responseTime+duration;
+			try{
+			Thread.sleep(1000);
+			}catch (InterruptedException e){
+				
+			}
+			
+		}
+	}
+
+	public class wgetInt extends OutputInterpreter {
+		private long end;
+		
+		public long getEnd() {
+			return end;
+		}
+
+		public void setEnd(long end) {
+			this.end = end;
+		}
+
+		@Override
+		public String interpret(BufferedReader reader) throws IOException {
+			// TODO Auto-generated method stub
+			end = System.currentTimeMillis();
+			String status = null;
+			String line = null;
+            while ((line = reader.readLine()) != null) {
+                int index = line.indexOf("Length:");
+                if (index == -1) {
+                    continue;
+                }
+                else{
+                	int index1 = line.indexOf("Length: 1827");
+                	if (index1 == -1) {
+                        return status;
+                    }
+                	else
+                		status=line;
+                }
+                	          	
+            }
+			return status;
+		}
+
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/IpSqlGenerator.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/IpSqlGenerator.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/IpSqlGenerator.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/IpSqlGenerator.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,88 @@
+// 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.test.utils;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.StringTokenizer;
+
+public class IpSqlGenerator {
+	public static void main (String[] args) {
+		try {
+			if (args.length != 5) {
+				System.out.println("Usage -- generate-ip.sh <public|private> <begin ip range> <end ip range> <data center id> <pod id>");
+				System.out.println("Example -- generate-ip.sh public 192.168.1.1 192.168.1.255 1 1");
+				System.out.println("  will generate ips ranging from public ips 192.168.1.1 to 192.168.1.255 for dc 1 and pod 1");
+				return;
+			}
+			
+			String type = args[0];
+			
+			StringTokenizer st = new StringTokenizer(args[1], ".");
+			int ipS1 = Integer.parseInt(st.nextToken());
+			int ipS2 = Integer.parseInt(st.nextToken());
+			int ipS3 = Integer.parseInt(st.nextToken());
+			int ipS4 = Integer.parseInt(st.nextToken());
+			
+			st = new StringTokenizer(args[2], ".");
+			int ipE1 = Integer.parseInt(st.nextToken());
+			int ipE2 = Integer.parseInt(st.nextToken());
+			int ipE3 = Integer.parseInt(st.nextToken());
+			int ipE4 = Integer.parseInt(st.nextToken());
+			
+			String dcId = args[3];
+			String podId = args[4];
+			
+			if (type.equals("private")) {
+				FileOutputStream fs = new FileOutputStream(new File("private-ips.sql"));
+				DataOutputStream out = new DataOutputStream(fs);
+				for (int i = ipS1; i <= ipE1; i++) {
+					for (int j = ipS2; j <= ipE2; j++) {
+						for (int k = ipS3; k <= ipE3; k++) {
+							for (int l = ipS4; l <= ipE4; l++) {
+								out.writeBytes("INSERT INTO `vmops`.`dc_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES ('" 
+										+ i + "." + j + "." + k + "." + l + "'," + dcId + "," + podId + ");\r\n");
+							}
+						}
+					}
+				}
+				out.writeBytes("\r\n");
+				out.flush();
+				out.close();
+			} else {
+				FileOutputStream fs = new FileOutputStream(new File("public-ips.sql"));
+				DataOutputStream out = new DataOutputStream(fs);
+				for (int i = ipS1; i <= ipE1; i++) {
+					for (int j = ipS2; j <= ipE2; j++) {
+						for (int k = ipS3; k <= ipE3; k++) {
+							for (int l = ipS4; l <= ipE4; l++) {
+								out.writeBytes("INSERT INTO `vmops`.`user_ip_address` (ip_address, data_center_id) VALUES ('" 
+										+ i + "." + j + "." + k + "." + l + "'," + dcId + ");\r\n");
+							}
+						}
+					}
+				}
+				out.writeBytes("\r\n");
+				out.flush();
+				out.close();
+			}
+		} catch (Exception e) {
+			
+		}
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/ProxyLoadTemp.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/ProxyLoadTemp.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/ProxyLoadTemp.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/ProxyLoadTemp.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,121 @@
+// 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.test.utils;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.util.ArrayList;
+
+import org.apache.log4j.Logger;
+
+
+
+
+public class ProxyLoadTemp {
+	public static final Logger s_logger= Logger.getLogger(ProxyLoadTemp.class.getClass());
+	public static int numThreads=0;
+	public static ArrayList<ConsoleProxy> proxyList = new ArrayList<ConsoleProxy>();
+	public static long begin;
+	public static long end;
+	public static long sum=0;
+	
+	public ProxyLoadTemp(){		
+	}
+	
+	public static void main (String[] args){
+		begin= System.currentTimeMillis();
+		Runtime.getRuntime().addShutdownHook(new ShutdownThread(new ProxyLoadTemp()));
+		ConsoleProxy.proxyIp="172-16-1-101";
+		
+		try 
+        {
+		BufferedReader consoleInput = new BufferedReader(new FileReader("console.input"));
+		boolean eof = false;
+		s_logger.info("Started reading file");
+		while (!eof){
+			String line = consoleInput.readLine();
+			s_logger.info("Line is "+line);
+			if (line == null){
+				s_logger.info("Line "+numThreads+" is null");
+                eof=true;
+			}
+			else{
+				String[] result=null;
+                try 
+                {
+                	s_logger.info("Starting parsing line "+line);
+                   result= parseLine(line, "[,]");
+                   s_logger.info("Line retrieved from the file is "+result[0]+" "+result[1]+" "+result[2]);
+                   ConsoleProxy proxy = new ConsoleProxy(result[0], result[1], result[2]);
+                   proxyList.add(proxy);
+                   new Thread(proxy).start();
+                   numThreads++;           
+                   
+                }
+                catch (Exception ex){
+                	s_logger.warn(ex);
+                }
+			}
+			
+		}
+        }catch(Exception e){
+        	s_logger.warn(e);
+        }
+		
+	}
+	
+	public static class ShutdownThread extends Thread {
+		ProxyLoadTemp temp;
+		public ShutdownThread(ProxyLoadTemp temp) {
+			this.temp = temp;
+		}
+		public void run() {
+			s_logger.info("Program was running in "+numThreads+" threads");
+			
+			for (int j=0; j<proxyList.size(); j++){
+				long av=0;
+				if (proxyList.get(j).getConnectionsMade()!=0){
+					av=proxyList.get(j).getResponseTime()/proxyList.get(j).getConnectionsMade();
+				}
+				s_logger.info("Information for "+j+" thread: Number of requests sent is "+proxyList.get(j).getConnectionsMade()+". Average response time is "+av+" milliseconds");
+				sum=sum+av;
+
+			}
+			ProxyLoadTemp.end= System.currentTimeMillis();
+			s_logger.info("Summary for all"+numThreads+" threads: Average response time is "+sum/numThreads+" milliseconds");
+			s_logger.info("Test was running for "+(ProxyLoadTemp.end-ProxyLoadTemp.begin)/1000+" seconds");
+		}
+	}
+	
+	
+	public static String[] parseLine(String line, String del) throws Exception
+    {
+        String del1=del.substring(1, del.length()-1);
+        if (line.contains(del1)!=true)
+        {
+        throw new Exception();
+        }
+        else
+        {
+        String[] token = line.split(del);
+        return token;  
+        }
+
+    }
+	
+
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SignEC2.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SignEC2.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SignEC2.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SignEC2.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,148 @@
+// 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.test.utils;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+import org.apache.log4j.Logger;
+
+public class SignEC2 {
+	public static String url;
+	public static String secretkey;
+	public static String host;
+	public static String port;
+	public static String command;
+	public static String accessPoint;
+	public static final Logger s_logger = Logger
+	.getLogger(SignRequest.class.getName());
+	
+	
+	public static void main (String[] args) {
+		// Parameters
+		List<String> argsList = Arrays.asList(args);
+		Iterator<String> iter = argsList.iterator();
+		while (iter.hasNext()) {
+			String arg = iter.next();
+
+			if (arg.equals("-u")) {
+				url = iter.next();
+			}
+		}
+		
+		Properties prop = new Properties();
+		try {
+			prop.load(new FileInputStream("../conf/tool.properties"));
+		} catch (IOException ex) {
+			s_logger.error("Error reading from ../conf/tool.properties", ex);
+			System.exit(2);
+		}
+		
+		host = prop.getProperty("host");
+		secretkey = prop.getProperty("secretkey");
+		port = prop.getProperty("port");
+		
+		
+		if (host == null) {
+			s_logger.info("Please set host in tool.properties file");
+			System.exit(1);
+		}
+		
+		if (port == null) {
+			s_logger.info("Please set port in tool.properties file");
+			System.exit(1);
+		}
+		
+		if (url == null) {
+			s_logger.info("Please specify url with -u option");
+			System.exit(1);
+		}
+		
+		if (secretkey == null) {
+			s_logger.info("Please set secretkey in tool.properties file");
+			System.exit(1);
+		}
+		
+		if (prop.get("apikey") == null) {
+			s_logger.info("Please set apikey in tool.properties file");
+			System.exit(1);
+		}
+		
+		if (prop.get("accesspoint") == null) {
+			s_logger.info("Please set apikey in tool.properties file");
+			System.exit(1);
+		}
+		
+		
+		
+		TreeMap<String, String> param = new TreeMap<String, String>();
+		
+		String req = "GET\n" + host + ":" + prop.getProperty("port") + "\n/" + prop.getProperty("accesspoint") + "\n";
+		String temp = "";
+		param.put("AWSAccessKeyId", prop.getProperty("apikey"));
+		param.put("Expires",prop.getProperty("expires"));
+		param.put("SignatureMethod", "HmacSHA1");
+		param.put("SignatureVersion", "2");
+		param.put("Version", prop.getProperty("version"));
+		param.put("id", "1");
+		
+		StringTokenizer str1 = new StringTokenizer (url, "&");
+		while(str1.hasMoreTokens()) {
+			String newEl = str1.nextToken();
+			StringTokenizer str2 = new StringTokenizer(newEl, "=");
+			String name = str2.nextToken();
+			String value= str2.nextToken();
+			param.put(name, value);
+		}
+		
+		//sort url hash map by key
+		Set c = param.entrySet();
+		Iterator it = c.iterator();
+		while (it.hasNext()) {
+			Map.Entry me = (Map.Entry)it.next();
+			String key = (String) me.getKey();
+			String value = (String) me.getValue();
+			try {
+				temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
+			} catch (Exception ex) {
+				s_logger.error("Unable to set parameter " + value + " for the command " + param.get("command"));
+			}
+			
+		}
+		temp = temp.substring(0, temp.length()-1 );
+		String requestToSign = req + temp;
+		String signature = UtilsForTest.signRequest(requestToSign, secretkey);
+		String encodedSignature = "";
+		try {
+			encodedSignature = URLEncoder.encode(signature, "UTF-8");
+		} catch (Exception ex) {
+			s_logger.error(ex);
+		}
+		String url = "http://" + host + ":" + prop.getProperty("port") + "/" + prop.getProperty("accesspoint") + "?" + temp + "&Signature=" + encodedSignature;
+		s_logger.info("Url is " + url);
+		
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SignRequest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SignRequest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SignRequest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SignRequest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,114 @@
+// 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.test.utils;
+
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+public class SignRequest {
+	public static String url;
+	public static String apikey;
+	public static String secretkey;
+	public static String command;
+	
+	
+	public static void main (String[] args) {
+		// Parameters
+		List<String> argsList = Arrays.asList(args);
+		Iterator<String> iter = argsList.iterator();
+		while (iter.hasNext()) {
+			String arg = iter.next();
+			if (arg.equals("-a")) {
+				apikey = iter.next();
+				
+			}
+			if (arg.equals("-u")) {
+				url = iter.next();
+			}
+			
+			if (arg.equals("-s")) {
+				secretkey = iter.next();
+			}
+		}
+		
+		
+		if (url == null) {
+			System.out.println("Please specify url with -u option. Example: -u \"command=listZones&id=1\"");
+			System.exit(1);
+		}
+		
+		if (apikey == null) {
+			System.out.println("Please specify apikey with -a option");
+			System.exit(1);
+		}
+		
+		if (secretkey == null) {
+			System.out.println("Please specify secretkey with -s option");
+			System.exit(1);
+		}
+		
+		TreeMap<String, String> param = new TreeMap<String, String>();
+		
+		String temp = "";
+		param.put("apikey", apikey);
+		
+		StringTokenizer str1 = new StringTokenizer (url, "&");
+		while(str1.hasMoreTokens()) {
+			String newEl = str1.nextToken();
+			StringTokenizer str2 = new StringTokenizer(newEl, "=");
+			String name = str2.nextToken();
+			String value= str2.nextToken();
+			param.put(name, value);
+		}
+		
+		//sort url hash map by key
+		Set c = param.entrySet();
+		Iterator it = c.iterator();
+		while (it.hasNext()) {
+			Map.Entry me = (Map.Entry)it.next();
+			String key = (String) me.getKey();
+			String value = (String) me.getValue();
+			try {
+				temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
+			} catch (Exception ex) {
+				System.out.println("Unable to set parameter " + value + " for the command " + param.get("command"));
+			}
+			
+		}
+		temp = temp.substring(0, temp.length()-1 );
+		String requestToSign = temp.toLowerCase();	
+		System.out.println("After sorting: " + requestToSign);
+		String signature = UtilsForTest.signRequest(requestToSign, secretkey);
+		System.out.println("After Base64 encoding: " + signature);
+		String encodedSignature = "";
+		try {
+			encodedSignature = URLEncoder.encode(signature, "UTF-8");
+		} catch (Exception ex) {
+			System.out.println(ex);
+		}
+		System.out.println("After UTF8 encoding: " + encodedSignature);
+		String url = temp + "&signature=" + encodedSignature;
+		System.out.println("After sort and add signature: " + url);
+		
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SqlDataGenerator.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SqlDataGenerator.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SqlDataGenerator.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SqlDataGenerator.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,48 @@
+// 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.test.utils;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Formatter;
+
+public class SqlDataGenerator {
+	public static void main (String[] args) {
+		try {
+			FileOutputStream fs = new FileOutputStream(new File("out.txt"));
+			
+			DataOutputStream out = new DataOutputStream(fs);
+			
+			for (int i = 20; i < 171; i++) {
+				out.writeBytes("INSERT INTO `vmops`.`dc_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES ('192.168.2."+i+"',1,1);\r\n");
+			}
+			out.writeBytes("\r\n");
+			for (int i = 1; i < 10000; i++) {
+				StringBuilder imagePath = new StringBuilder();
+    	        Formatter formatter = new Formatter(imagePath);
+    	        formatter.format("%04x", i);
+				out.writeBytes("INSERT INTO `vmops`.`dc_vnet_alloc` (vnet, data_center_id) VALUES ('"+imagePath.toString()+"',1);\r\n");
+			}
+			
+			out.flush();
+			out.close();
+		} catch (Exception e) {
+			
+		}
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SubmitCert.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SubmitCert.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/SubmitCert.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/SubmitCert.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,203 @@
+// 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.test.utils;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+
+public class SubmitCert {
+    public static String url = "Action=SetCertificate";
+    public static String secretKey;
+    public static String apiKey;
+    public static String host;
+    public static String port;
+    public static String command;
+    public static String accessPoint;
+    public static String signatureMethod;
+    public static String fileName = "tool.properties";
+    public static String certFileName;
+    public static String cert;
+    public static final Logger s_logger = Logger
+    .getLogger(SubmitCert.class.getName());
+    
+    
+    public static void main (String[] args) {
+        // Parameters
+        List<String> argsList = Arrays.asList(args);
+        Iterator<String> iter = argsList.iterator();
+        while (iter.hasNext()) {
+            String arg = iter.next();
+
+            if (arg.equals("-c")) {
+                certFileName = iter.next();
+            }
+            
+            if (arg.equals("-s")) {
+                secretKey = iter.next();
+            }
+            
+            if (arg.equals("-a")) {
+                apiKey = iter.next();
+            }   
+            
+            if (arg.equals("-action")) {
+                url = "Action=" + iter.next();
+            }   
+        }
+        
+        Properties prop = new Properties();
+        try {
+            prop.load(new FileInputStream("conf/tool.properties"));
+        } catch (IOException ex) {
+            s_logger.error("Error reading from conf/tool.properties", ex);
+            System.exit(2);
+        }
+        
+        host = prop.getProperty("host");
+        port = prop.getProperty("port");
+
+        if (url.equals("Action=SetCertificate") && certFileName == null) {
+            s_logger.error("Please set path to certificate (including file name) with -c option");
+            System.exit(1);
+        }
+        
+        if (secretKey == null) {
+            s_logger.error("Please set secretkey  with -s option");
+            System.exit(1);
+        }
+        
+        if (apiKey == null) {
+            s_logger.error("Please set apikey with -a option");
+            System.exit(1);
+        }
+ 
+        if (host == null) {
+            s_logger.error("Please set host in tool.properties file");
+            System.exit(1);
+        }
+        
+        if (port == null) {
+            s_logger.error("Please set port in tool.properties file");
+            System.exit(1);
+        }
+        
+        
+        TreeMap<String, String> param = new TreeMap<String, String>();
+        
+        String req = "GET\n" + host + ":" + prop.getProperty("port") + "\n/" + prop.getProperty("accesspoint") + "\n";
+        String temp = "";
+        
+        if (certFileName != null) {
+            cert = readCert(certFileName);
+            param.put("cert", cert);
+        }
+       
+        param.put("AWSAccessKeyId", apiKey);
+        param.put("Expires",prop.getProperty("expires"));
+        param.put("SignatureMethod",  prop.getProperty("signaturemethod"));
+        param.put("SignatureVersion", "2");
+        param.put("Version", prop.getProperty("version"));
+        
+        StringTokenizer str1 = new StringTokenizer (url, "&");
+        while(str1.hasMoreTokens()) {
+            String newEl = str1.nextToken();
+            StringTokenizer str2 = new StringTokenizer(newEl, "=");
+            String name = str2.nextToken();
+            String value= str2.nextToken();
+            param.put(name, value);
+        }
+        
+        //sort url hash map by key
+        Set c = param.entrySet();
+        Iterator it = c.iterator();
+        while (it.hasNext()) {
+            Map.Entry me = (Map.Entry)it.next();
+            String key = (String) me.getKey();
+            String value = (String) me.getValue();
+            try {
+                temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
+            } catch (Exception ex) {
+                s_logger.error("Unable to set parameter " + value + " for the command " + param.get("command"), ex);
+            }
+            
+        }
+        temp = temp.substring(0, temp.length()-1 );
+        String requestToSign = req + temp;
+        String signature = UtilsForTest.signRequest(requestToSign, secretKey);
+        String encodedSignature = "";
+        try {
+            encodedSignature = URLEncoder.encode(signature, "UTF-8");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        
+        String url = "http://" + host + ":" + prop.getProperty("port") + "/" + prop.getProperty("accesspoint") + "?" + temp + "&Signature=" + encodedSignature;
+        s_logger.info("Sending request with url:  " + url + "\n");
+        sendRequest(url);
+    }
+    
+    public static String readCert(String filePath) {
+        try {
+            StringBuffer fileData = new StringBuffer(1000);
+            BufferedReader reader = new BufferedReader(
+                    new FileReader(filePath));
+            char[] buf = new char[1024];
+            int numRead=0;
+            while((numRead=reader.read(buf)) != -1){
+                String readData = String.valueOf(buf, 0, numRead);
+                fileData.append(readData);
+                buf = new char[1024];
+            }
+            reader.close();
+            return fileData.toString();
+        } catch (Exception ex) {
+            s_logger.error(ex);
+            return null;
+        }
+    }
+    
+    public static void sendRequest(String url) {
+        try {
+            HttpClient client = new HttpClient();
+            HttpMethod method = new GetMethod(url);
+            int responseCode = client.executeMethod(method);
+            String is = method.getResponseBodyAsString();
+            s_logger.info("Response code " + responseCode + ": " + is);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        
+    }
+   
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/TestClient.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/TestClient.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/TestClient.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/TestClient.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,381 @@
+// 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.test.utils;
+
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.apache.log4j.NDC;
+
+import com.trilead.ssh2.ChannelCondition;
+import com.trilead.ssh2.Connection;
+import com.trilead.ssh2.SCPClient;
+import com.trilead.ssh2.Session;
+
+public class TestClient {
+	private static long sleepTime = 180000L; // default 0
+	private static boolean cleanUp = true;
+	public static final Logger s_logger = Logger.getLogger(TestClient.class.getName());
+	private static boolean repeat = true;
+	private static int numOfUsers = 0;
+	private static String[] users = null;
+	private static boolean internet = true;
+	
+	private static final int MAX_RETRY_LINUX = 5;
+	private static final int MAX_RETRY_WIN = 10;
+	
+	public static void main (String[] args) {
+		String host = "http://localhost";
+		String port = "8080";
+		String testUrl = "/client/test";
+		int numThreads = 1;
+		
+		try {
+			// Parameters
+			List<String> argsList = Arrays.asList(args);
+			Iterator<String> iter = argsList.iterator();
+			while (iter.hasNext()) {
+				String arg = iter.next();
+				// host
+				if (arg.equals("-h")) {
+					host = "http://" + iter.next();
+				}
+				
+				if (arg.equals("-p")) {
+					port = iter.next();
+				}
+				
+				if (arg.equals("-t")) {
+					numThreads = Integer.parseInt(iter.next());
+				}
+				
+				if (arg.equals("-s")) {
+					sleepTime = Long.parseLong(iter.next());
+				}
+				
+				if (arg.equals("-c")) {
+					cleanUp = Boolean.parseBoolean(iter.next());
+					if (!cleanUp) sleepTime = 0L; // no need to wait if we don't ever cleanup
+				}
+				
+				if (arg.equals("-r")) {
+					repeat = Boolean.parseBoolean(iter.next());
+				}
+				
+				if (arg.equals("-u")) {
+					numOfUsers = Integer.parseInt(iter.next());
+				}
+				
+				if (arg.equals("-i")) {
+				    internet = Boolean.parseBoolean(iter.next());
+				}
+			}
+			
+			final String server = host+":"+port+testUrl;
+			s_logger.info("Starting test against server: " + server + " with " + numThreads + " thread(s)");
+			if (cleanUp) s_logger.info("Clean up is enabled, each test will wait " + sleepTime + " ms before cleaning up");
+			
+			if (numOfUsers > 0) {
+				s_logger.info("Pre-generating users for test of size : " + numOfUsers);
+				users = new String[numOfUsers];
+				Random ran = new Random();
+				for (int i = 0; i < numOfUsers; i++) {
+					users[i] = Math.abs(ran.nextInt()) + "-user";
+				}
+			}
+			
+			for (int i = 0; i < numThreads; i++) {
+				new Thread(new Runnable() {
+					public void run() {
+						do {
+							String username = null;
+							try {
+								long now = System.currentTimeMillis();
+								Random ran = new Random();
+								if (users != null) {
+									username = users[Math.abs(ran.nextInt()) % numOfUsers];
+								} else {
+									username = Math.abs(ran.nextInt())+"-user";
+								}
+								NDC.push(username);
+
+								String url = server+"?email="+username+"&password="+username+"&command=deploy";
+								s_logger.info("Launching test for user: " + username + " with url: " + url);
+								HttpClient client = new HttpClient();
+								HttpMethod method = new GetMethod(url);
+								int responseCode = client.executeMethod(method);
+								boolean success = false;
+								String reason = null;
+								if (responseCode == 200) {
+								    if (internet) {
+    									s_logger.info("Deploy successful...waiting 5 minute before SSH tests");
+    									Thread.sleep(300000L);  // Wait 60 seconds so the linux VM can boot up.
+    									
+    									s_logger.info("Begin Linux SSH test");
+    									reason = sshTest(method.getResponseHeader("linuxIP").getValue());
+    									
+    									if (reason == null) {
+    										s_logger.info("Linux SSH test successful");
+    										s_logger.info("Begin Windows SSH test");
+    										reason = sshWinTest(method.getResponseHeader("windowsIP").getValue());
+    									}
+								    }
+									if (reason == null) {
+									    if (internet) {
+									        s_logger.info("Windows SSH test successful");
+									    } else {
+									        s_logger.info("deploy test successful....now cleaning up");
+	                                        if (cleanUp) {
+	                                            s_logger.info("Waiting " + sleepTime + " ms before cleaning up vms");
+	                                            Thread.sleep(sleepTime);
+	                                        } else {
+	                                            success = true;
+	                                        }
+									    }
+									    if (users == null) {
+									    	s_logger.info("Sending cleanup command");
+									    	url = server+"?email="+username+"&password="+username+"&command=cleanup";
+									    } else {
+									    	s_logger.info("Sending stop DomR / destroy VM command");
+									    	url = server+"?email="+username+"&password="+username+"&command=stopDomR";
+									    }
+										method = new GetMethod(url);
+										responseCode = client.executeMethod(method);
+										if (responseCode == 200) {
+											success = true;
+										} else {
+											reason = method.getStatusText();
+										}
+									} else {
+										// Just stop but don't destroy the VMs/Routers
+										s_logger.info("SSH test failed with reason '" + reason + "', stopping VMs");
+										url = server+"?email="+username+"&password="+username+"&command=stop";
+										responseCode = client.executeMethod(new GetMethod(url));
+									}
+								} else {
+									// Just stop but don't destroy the VMs/Routers
+									reason = method.getStatusText();
+									s_logger.info("Deploy test failed with reason '" + reason + "', stopping VMs");
+									url = server+"?email="+username+"&password="+username+"&command=stop";
+									client.executeMethod(new GetMethod(url));
+								}
+
+								if (success) {
+									s_logger.info("***** Completed test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds");
+								} else {
+									s_logger.info("##### FAILED test for user : " + username + " in " + ((System.currentTimeMillis() - now) / 1000L) + " seconds with reason : " + reason);
+								}
+							} catch (Exception e) {
+								s_logger.warn("Error in thread", e);
+								try {
+									HttpClient client = new HttpClient();
+									String url = server+"?email="+username+"&password="+username+"&command=stop";
+									client.executeMethod(new GetMethod(url));
+								} catch (Exception e1) {
+								}
+							} finally {
+								NDC.clear();
+							}
+						} while (repeat);
+					}
+				}).start();
+			}
+		} catch (Exception e) {
+			s_logger.error(e);
+		}
+	}
+	
+	private static String sshWinTest(String host) {
+		if (host == null) {
+			s_logger.info("Did not receive a host back from test, ignoring win ssh test");
+			return null;
+		}
+		
+		// We will retry 5 times before quitting
+		int retry = 0;
+
+		while (true) {
+			try {
+				if (retry > 0) {
+					s_logger.info("Retry attempt : " + retry + " ...sleeping 300 seconds before next attempt");
+					Thread.sleep(300000);
+				}
+				
+				s_logger.info("Attempting to SSH into windows host " + host + " with retry attempt: " + retry);
+				
+				Connection conn = new Connection(host);
+				conn.connect(null, 60000, 60000);
+				
+				s_logger.info("SSHed successfully into windows host " + host);
+				boolean success = false;
+				boolean isAuthenticated = conn.authenticateWithPassword("vmops", "vmops");
+				if (isAuthenticated == false) {
+					return "Authentication failed";
+				}
+				SCPClient scp = new SCPClient(conn);
+				
+				scp.put("wget.exe", "");
+				
+				Session sess = conn.openSession();
+				s_logger.info("Executing : wget http://172.16.0.220/dump.bin");
+				sess.execCommand("wget http://172.16.0.220/dump.bin && dir dump.bin");
+				
+				InputStream stdout = sess.getStdout();
+				InputStream stderr = sess.getStderr();
+				
+				byte[] buffer = new byte[8192];
+				while (true) {
+					if ((stdout.available() == 0) && (stderr.available() == 0)) {
+						int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA
+								| ChannelCondition.EOF, 120000);
+						
+						if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+							s_logger.info("Timeout while waiting for data from peer.");
+							return null;
+						}
+						
+						if ((conditions & ChannelCondition.EOF) != 0) {
+							if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+								break;
+							}
+						}
+					}
+					
+					while (stdout.available() > 0) {
+						success = true;
+						int len = stdout.read(buffer);
+						if (len > 0) // this check is somewhat paranoid
+							s_logger.info(new String(buffer, 0, len));
+					}
+		
+					while (stderr.available() > 0) {
+						int len = stderr.read(buffer);
+					}
+				}
+				sess.close();
+				conn.close();
+				
+				if (success) {
+					return null;
+				} else {
+					retry++;
+					if (retry == MAX_RETRY_WIN) {
+						return "SSH Windows Network test fail";
+					}
+				}
+			} catch (Exception e) {
+				retry++;
+				if (retry == MAX_RETRY_WIN) {
+					return "SSH Windows Network test fail with error " + e.getMessage();
+				}
+			}
+		}
+	}
+	
+	private static String sshTest(String host) {
+		if (host == null) {
+			s_logger.info("Did not receive a host back from test, ignoring ssh test");
+			return null;
+		}
+		
+		// We will retry 5 times before quitting
+		int retry = 0;
+
+		while (true) {
+			try {
+				if (retry > 0) {
+					s_logger.info("Retry attempt : " + retry + " ...sleeping 120 seconds before next attempt");
+					Thread.sleep(120000);
+				}
+				
+				s_logger.info("Attempting to SSH into linux host " + host + " with retry attempt: " + retry);
+				
+				Connection conn = new Connection(host);
+				conn.connect(null, 60000, 60000);
+				
+				s_logger.info("SSHed successfully into linux host " + host);
+		
+				boolean isAuthenticated = conn.authenticateWithPassword("root", "password");
+		
+				if (isAuthenticated == false) {
+					return "Authentication failed";
+				}
+				boolean success = false;
+				Session sess = conn.openSession();
+				s_logger.info("Executing : wget http://172.16.0.220/dump.bin");
+				sess.execCommand("wget http://172.16.0.220/dump.bin && ls -al dump.bin");
+				
+				InputStream stdout = sess.getStdout();
+				InputStream stderr = sess.getStderr();
+				
+				byte[] buffer = new byte[8192];
+				while (true) {
+					if ((stdout.available() == 0) && (stderr.available() == 0)) {
+						int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA
+								| ChannelCondition.EOF, 120000);
+						
+						if ((conditions & ChannelCondition.TIMEOUT) != 0) {
+							s_logger.info("Timeout while waiting for data from peer.");
+							return null;
+						}
+						
+						if ((conditions & ChannelCondition.EOF) != 0) {
+							if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
+								break;
+							}
+						}
+					}
+					
+					while (stdout.available() > 0) {
+						success = true;
+						int len = stdout.read(buffer);
+						if (len > 0) // this check is somewhat paranoid
+							s_logger.info(new String(buffer, 0, len));
+					}
+		
+					while (stderr.available() > 0) {
+						int len = stderr.read(buffer);
+					}
+				}
+				
+				sess.close();
+				conn.close();
+				
+				if (success) {
+					return null;
+				} else {
+					retry++;
+					if (retry == MAX_RETRY_LINUX) {
+						return "SSH Linux Network test fail";
+					}
+				}
+			} catch (Exception e) {
+				retry++;
+				if (retry == MAX_RETRY_LINUX) {
+					return "SSH Linux Network test fail with error " + e.getMessage();
+				}
+			}
+		}
+	}
+}
diff -uNr /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/UtilsForTest.java ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/UtilsForTest.java
--- /home/ke4qqq/Documents/apache/cloudstack/incubator-cloudstack/tests/src/com/cloud/test/utils/UtilsForTest.java	1969-12-31 19:00:00.000000000 -0500
+++ ./vogxn-asf-marvin-updates-f66caa0/test/src/com/cloud/test/utils/UtilsForTest.java	2012-09-09 00:46:31.000000000 -0400
@@ -0,0 +1,237 @@
+// 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.test.utils;
+
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.codec.binary.Base64;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class UtilsForTest {
+
+    private static DocumentBuilderFactory factory = DocumentBuilderFactory
+            .newInstance();
+
+    public static boolean verifyTags (Map<String, String> params) {
+        boolean result = true;
+        for (String value : params.keySet()) {
+            if (params.get(value) == null) {
+                result=false;
+            }
+        }
+        return result;
+    }
+
+    public static boolean verifyTagValues (Map<String, String> params, Map<String, String> pattern) {
+        boolean result = true;
+
+        if (pattern != null) {
+            for (String value : pattern.keySet()) {
+                if (!pattern.get(value).equals(params.get(value))) {
+                    result=false;
+                    System.out.println("Tag " + value + " has " + params.get(value) + " while expected value is: " + pattern.get(value));
+                }
+            }
+        }
+        return result;
+    }
+
+
+    public static Map<String, String> parseXML(InputStream is,
+            String[] tagNames) {
+        Map<String, String> returnValues = new HashMap<String, String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    System.out.println("no " + tagNames[i]
+                            + " tag in the response");
+                    returnValues.put(tagNames[i], null);
+                } else {
+                    returnValues.put(tagNames[i], targetNodes.item(0)
+                            .getTextContent());
+                }
+            }
+        } catch (Exception ex) {
+            System.out.println("error processing XML");
+            ex.printStackTrace();
+        }
+        return returnValues;
+    }
+
+
+    public static ArrayList<HashMap<String, String>> parseMulXML (InputStream is, String[] tagNames){
+        ArrayList<HashMap<String, String>> returnValues = new ArrayList<HashMap <String, String>>();
+
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    System.out.println("no " + tagNames[i]
+                            + " tag in XML response...returning null");
+                } else {
+                    for (int j = 0; j < targetNodes.getLength(); j++) {
+                        HashMap<String, String> valueList = new HashMap<String,String> ();
+                        Node node = targetNodes.item(j);
+                        //parse child nodes
+                        NodeList child = node.getChildNodes();
+                        for (int c=0; c<node.getChildNodes().getLength(); c++){
+                            child.item(c).getNodeName();
+                            valueList.put(child.item(c).getNodeName(), child.item(c).getTextContent());
+                        }
+                        returnValues.add(valueList);
+                    }
+
+                }
+            }
+        } catch (Exception ex) {
+            System.out.println(ex);
+        }
+
+        return returnValues;
+    }
+
+
+    public static String createMD5String(String password) {
+        MessageDigest md5;
+        try {
+            md5 = MessageDigest.getInstance("MD5");
+        } catch (NoSuchAlgorithmException e) {
+            throw new CloudRuntimeException("Error", e);
+        }
+
+        md5.reset();
+        BigInteger pwInt = new BigInteger(1, md5.digest(password.getBytes()));
+
+        // make sure our MD5 hash value is 32 digits long...
+        StringBuffer sb = new StringBuffer();
+        String pwStr = pwInt.toString(16);
+        int padding = 32 - pwStr.length();
+        for (int i = 0; i < padding; i++) {
+            sb.append('0');
+        }
+        sb.append(pwStr);
+        return sb.toString();
+    }
+
+
+
+
+
+
+
+    public static Map<String, String> getSingleValueFromXML(InputStream is,
+            String[] tagNames) {
+        Map<String, String> returnValues = new HashMap<String, String>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    System.out.println("no " + tagNames[i]
+                            + " tag in XML response...returning null");
+                } else {
+                    returnValues.put(tagNames[i], targetNodes.item(0)
+                            .getTextContent());
+                }
+            }
+        } catch (Exception ex) {
+            System.out.println("error processing XML");
+            ex.printStackTrace();
+        }
+        return returnValues;
+    }
+
+
+    public static Map<String, List<String>> getMultipleValuesFromXML(
+            InputStream is, String[] tagNames) {
+        Map<String, List<String>> returnValues = new HashMap<String, List<String>>();
+        try {
+            DocumentBuilder docBuilder = factory.newDocumentBuilder();
+            Document doc = docBuilder.parse(is);
+            Element rootElement = doc.getDocumentElement();
+            for (int i = 0; i < tagNames.length; i++) {
+                NodeList targetNodes = rootElement
+                        .getElementsByTagName(tagNames[i]);
+                if (targetNodes.getLength() <= 0) {
+                    System.out.println("no " + tagNames[i]
+                            + " tag in XML response...returning null");
+                } else {
+                    List<String> valueList = new ArrayList<String>();
+                    for (int j = 0; j < targetNodes.getLength(); j++) {
+                        Node node = targetNodes.item(j);
+                        valueList.add(node.getTextContent());
+                    }
+                    returnValues.put(tagNames[i], valueList);
+                }
+            }
+        } catch (Exception ex) {
+            System.out.println(ex);
+        }
+        return returnValues;
+    }
+
+
+
+    public static String signRequest(String request, String key) {
+        try {
+            Mac mac = Mac.getInstance("HmacSHA1");
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(),
+                    "HmacSHA1");
+            mac.init(keySpec);
+            mac.update(request.getBytes());
+            byte[] encryptedBytes = mac.doFinal();
+            //System.out.println("HmacSHA1 hash: " + encryptedBytes);
+            return Base64.encodeBase64String(encryptedBytes);
+        } catch (Exception ex) {
+            System.out.println("unable to sign request");
+            ex.printStackTrace();
+        }
+        return null;
+    }
+
+}
